summaryrefslogtreecommitdiffstats
path: root/macosx/HBJob+UIAdditions.m
blob: 6e5bf030a2aa1951ea2c0a974344b39885df746b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
/*  HBJob+UIAdditions.m $

 This file is part of the HandBrake source code.
 Homepage: <http://handbrake.fr/>.
 It may be used under the terms of the GNU General Public License. */

#import "HBJob+UIAdditions.h"
#include "hb.h"

@implementation HBJob (UIAdditions)

- (BOOL)mp4OptionsEnabled
{
    if (self.container & HB_MUX_MASK_MP4)
    {
        return YES;
    }
    else
    {
        return NO;
    }
}

- (NSArray *)angles
{
    NSMutableArray *angles = [NSMutableArray array];
    for (int i = 0; i < self.title.angles; i++)
    {
        [angles addObject:[NSString stringWithFormat: @"%d", i + 1]];
    }
    return angles;
}

@end

@implementation HBURLTransformer

+ (Class)transformedValueClass
{
    return [NSString class];
}

- (id)transformedValue:(id)value
{
    if (value)
        return [value path];
    else
        return nil;
}

+ (BOOL)allowsReverseTransformation
{
    return YES;
}

- (id)reverseTransformedValue:(id)value
{
    return [NSURL fileURLWithPath:value];
}

@end