summaryrefslogtreecommitdiffstats
path: root/macosx/InstantHandBrake/DeviceController.m
blob: 19a445b27fa423e4e546bac2976f5fc23ba32165 (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
63
64
65
66
67
68
69
70
71
//
//  DeviceController.m
//  InstantHandBrake
//
//  Created by Damiano Galassi on 23/01/08.
//  This file is part of the HandBrake source code.
//  Homepage: <http://handbrake.m0k.org/>.
//  It may be used under the terms of the GNU General Public License.
//
//

#import "DeviceController.h"
#import "hb.h"

@implementation DeviceController

- (id)init
{
    if (self = [super init])
    {
        deviceArray = [[NSMutableArray alloc] init];
        [self populateList];
    }
    return self;
}

- (id) populateList
{
    [deviceArray addObject:[[Device alloc] initWithDeviceName: @"iPod"]];
    [deviceArray addObject:[[Device alloc] initWithDeviceName: @"PSP"]];
    [deviceArray addObject:[[Device alloc] initWithDeviceName: @"Zune"]];
    [deviceArray addObject:[[Device alloc] initWithDeviceName: @"AppleTV"]];
    
    Preset * newPreset = [[Preset alloc] initWithMuxer: HB_MUX_IPOD
                                            videoCodec: HB_VCODEC_X264
                                          videoBitRate: 1500
                                     videoCodecOptions: @"bframes=0:cabac=0:ref=1:vbv-maxrate=1500:vbv-bufsize=2000:analyse=all:me=umh:subq=6:no-fast-pskip=1:level=30"
                                            audioCodec: HB_ACODEC_FAAC
                                          audioBitrate: 128
                                       audioSampleRate: 48000
                                              maxWidth: 640
                                             maxHeight: 480
                                            anamorphic: 0];
    
    [[deviceArray objectAtIndex:0] addPreset:newPreset];
    
    newPreset = [[Preset alloc] initWithMuxer: HB_MUX_MP4
                                   videoCodec: HB_VCODEC_X264
                                 videoBitRate: 600
                            videoCodecOptions: @""
                                   audioCodec: HB_ACODEC_FAAC
                                 audioBitrate: 128
                              audioSampleRate: 48000
                                     maxWidth: 480
                                    maxHeight: 272
                                   anamorphic: 0];
                                   
    [[deviceArray objectAtIndex:1] addPreset:newPreset];

}

- (NSArray *) deviceList
{
    NSArray *deviceList = [deviceArray copy];
    
    [deviceList autorelease];
    
    return deviceList;
} 

@end