[vlc-commits] macosx: CAS: added profiles and implemented profile switcher

Felix Paul Kühne git at videolan.org
Fri Jun 1 00:08:12 CEST 2012


vlc | branch: master | Felix Paul Kühne <fkuehne at videolan.org> | Fri Jun  1 00:07:57 2012 +0200| [f2f9b87543586ad03a7f820930fca3604110b7f1] | committer: Felix Paul Kühne

macosx: CAS: added profiles and implemented profile switcher

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=f2f9b87543586ad03a7f820930fca3604110b7f1
---

 modules/gui/macosx/ConvertAndSave.m |   75 ++++++++++++++++++++++++++++++++++-
 1 file changed, 73 insertions(+), 2 deletions(-)

diff --git a/modules/gui/macosx/ConvertAndSave.m b/modules/gui/macosx/ConvertAndSave.m
index 0acb27f..a02c2e0 100644
--- a/modules/gui/macosx/ConvertAndSave.m
+++ b/modules/gui/macosx/ConvertAndSave.m
@@ -26,9 +26,15 @@
 #import <vlc_common.h>
 #import <vlc_url.h>
 
+ at interface VLCConvertAndSave ()
+ at property (readwrite, retain) NSArray * profileNames;
+ at property (readwrite, retain) NSArray * profileValueList;
+ at property (readwrite, retain) NSMutableArray * currentProfile;
+ at end
+
 @implementation VLCConvertAndSave
 
- at synthesize MRL=_MRL, outputDestination=_outputDestination;
+ at synthesize MRL=_MRL, outputDestination=_outputDestination, profileNames=_profileNames, profileValueList=_profileValueList, currentProfile=_currentProfile;
 
 static VLCConvertAndSave *_o_sharedInstance = nil;
 
@@ -48,6 +54,22 @@ static VLCConvertAndSave *_o_sharedInstance = nil;
     return _o_sharedInstance;
 }
 
+- (void)dealloc
+{
+    if (_MRL)
+        [_MRL release];
+    if (_outputDestination)
+        [_outputDestination release];
+    if (_profileNames)
+        [_profileNames release];
+    if (_profileValueList)
+        [_profileValueList release];
+    if (_currentProfile)
+        [_currentProfile release];
+
+    [super dealloc];
+}
+
 - (void)awakeFromNib
 {
     [_window setTitle: _NS("Convert & Save")];
@@ -60,6 +82,49 @@ static VLCConvertAndSave *_o_sharedInstance = nil;
     [_destination_lbl setStringValue: _NS("Choose Destination")];
     [_destination_filename_stub_lbl setStringValue: _NS("Choose an output location")];
     [_destination_filename_lbl setHidden: YES];
+
+    _profileNames = [[NSArray alloc] initWithObjects:
+                     @"Video - H.264 + MP3 (MP4)",
+                     @"Video - VP80 + Vorbis (Webm)",
+                     @"Video - H.264 + MP3 (TS)",
+                     @"Video - Dirac + MP3 (TS)",
+                     @"Video - Theora + Vorbis (OGG)",
+                     @"Video - Theora + Flac (OGG)",
+                     @"Video - MPEG-2 + MPGA (TS)",
+                     @"Video - WMV + WMA (ASF)",
+                     @"Video - DIV3 + MP3 (ASF)",
+                     @"Audio - Vorbis (OGG)",
+                     @"Audio - MP3",
+                     @"Audio - MP3 (MP4)",
+                     @"Audio - FLAC",
+                     @"Audio - CD",
+                     _NS("Custom"),
+                     nil];
+
+    /* We are using the same format as the Qt4 intf here:
+     * Container(string), transcode video(bool), transcode audio(bool),
+     * use subtitles(bool), video codec(string), video bitrate(integer),
+     * scale(float), fps(float), width(integer, height(integer),
+     * audio codec(string), audio bitrate(integer), channels(integer),
+     * samplerate(integer), subtitle codec(string), subtitle overlay(bool) */
+    _profileValueList = [[NSArray alloc] initWithObjects:
+                         @"mp4;1;1;0;h264;0;0;0;0;0;mpga;128;2;44100;0;1",
+                         @"webm;1;1;0;VP80;2000;0;0;0;0;vorb;128;2;44100;0;1",
+                         @"ts;1;1;0;h264;800;1;0;0;0;mpga;128;2;44100;0;0",
+                         @"ts;1;1;0;drac;800;1;0;0;0;mpga;128;2;44100;0;0",
+                         @"ogg;1;1;0;theo;800;1;0;0;0;vorb;128;2;44100;0;0",
+                         @"ogg;1;1;0;theo;800;1;0;0;0;flac;128;2;44100;0;0",
+                         @"ts;1;1;0;mp2v;800;1;0;0;0;mpga;128;2;44100;0;0",
+                         @"asf;1;1;0;WMV2;800;1;0;0;0;wma2;128;2;44100;0;0",
+                         @"asf;1;1;0;DIV3;800;1;0;0;0;mp3;128;2;44100;0;0",
+                         @"ogg;1;1;0;none;800;1;0;0;0;vorb;128;2;44100;none;0",
+                         @"raw;1;1;0;none;800;1;0;0;0;mp3;128;2;44100;none;0",
+                         @"mp4;1;1;0;none;800;1;0;0;0;mpga;128;2;44100;none;0",
+                         @"raw;1;1;0;none;800;1;0;0;0;flac;128;2;44100;none;0",
+                         @"wav;1;1;0;none;800;1;0;0;0;s16l;128;2;44100;none;0", nil];
+
+    [_profile_pop removeAllItems];
+    [_profile_pop addItemsWithTitles: _profileNames];
 }
 
 - (void)toggleWindow
@@ -77,6 +142,13 @@ static VLCConvertAndSave *_o_sharedInstance = nil;
 
 - (IBAction)profileSelection:(id)sender
 {
+    NSInteger index = [sender indexOfSelectedItem];
+    if (index != ([sender numberOfItems] - 1))
+    {
+        if (_currentProfile)
+            [_currentProfile release];
+        _currentProfile = [[NSMutableArray alloc] initWithArray: [[_profileValueList objectAtIndex:index] componentsSeparatedByString:@";"]];
+    }
 }
 
 - (IBAction)customizeProfile:(id)sender
@@ -150,7 +222,6 @@ static VLCConvertAndSave *_o_sharedInstance = nil;
     return NO;
 }
 
-
 @end
 
 



More information about the vlc-commits mailing list