OSDN Git Service

19a445b27fa423e4e546bac2976f5fc23ba32165
[handbrake-jp/handbrake-jp-git.git] / macosx / InstantHandBrake / DeviceController.m
1 //
2 //  DeviceController.m
3 //  InstantHandBrake
4 //
5 //  Created by Damiano Galassi on 23/01/08.
6 //  This file is part of the HandBrake source code.
7 //  Homepage: <http://handbrake.m0k.org/>.
8 //  It may be used under the terms of the GNU General Public License.
9 //
10 //
11
12 #import "DeviceController.h"
13 #import "hb.h"
14
15 @implementation DeviceController
16
17 - (id)init
18 {
19     if (self = [super init])
20     {
21         deviceArray = [[NSMutableArray alloc] init];
22         [self populateList];
23     }
24     return self;
25 }
26
27 - (id) populateList
28 {
29     [deviceArray addObject:[[Device alloc] initWithDeviceName: @"iPod"]];
30     [deviceArray addObject:[[Device alloc] initWithDeviceName: @"PSP"]];
31     [deviceArray addObject:[[Device alloc] initWithDeviceName: @"Zune"]];
32     [deviceArray addObject:[[Device alloc] initWithDeviceName: @"AppleTV"]];
33     
34     Preset * newPreset = [[Preset alloc] initWithMuxer: HB_MUX_IPOD
35                                             videoCodec: HB_VCODEC_X264
36                                           videoBitRate: 1500
37                                      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"
38                                             audioCodec: HB_ACODEC_FAAC
39                                           audioBitrate: 128
40                                        audioSampleRate: 48000
41                                               maxWidth: 640
42                                              maxHeight: 480
43                                             anamorphic: 0];
44     
45     [[deviceArray objectAtIndex:0] addPreset:newPreset];
46     
47     newPreset = [[Preset alloc] initWithMuxer: HB_MUX_MP4
48                                    videoCodec: HB_VCODEC_X264
49                                  videoBitRate: 600
50                             videoCodecOptions: @""
51                                    audioCodec: HB_ACODEC_FAAC
52                                  audioBitrate: 128
53                               audioSampleRate: 48000
54                                      maxWidth: 480
55                                     maxHeight: 272
56                                    anamorphic: 0];
57                                    
58     [[deviceArray objectAtIndex:1] addPreset:newPreset];
59
60 }
61
62 - (NSArray *) deviceList
63 {
64     NSArray *deviceList = [deviceArray copy];
65     
66     [deviceList autorelease];
67     
68     return deviceList;
69
70
71 @end