]> git.sesse.net Git - vlc/blobdiff - modules/gui/macosx/wizard.m
legacy OSX interface: fixed transcoding with the wizard and re-added mp4a as valid...
[vlc] / modules / gui / macosx / wizard.m
index efc3fef4ff7cd636ad121d97b28de588f052a0bc..37dc0f06e9082f5462c330721565d035361be044 100644 (file)
@@ -1,10 +1,10 @@
 /*****************************************************************************
  * wizard.m: MacOS X Streaming Wizard
  *****************************************************************************
- * Copyright (C) 2005-2007 the VideoLAN team
+ * Copyright (C) 2005-2009 the VideoLAN team
  * $Id$
  *
- * Authors: Felix Kühne <fkuehne@users.sf.net>
+ * Authors: Felix Kühne <fkuehne at videolan dot org>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -344,10 +344,12 @@ static VLCWizard *_o_sharedInstance = nil;
     [[o_t2_matrix_inputSourceType cellAtRow:1 column:0] setTitle:
         _NS("Existing playlist item")];
     [o_t2_btn_chooseFile setTitle: _NS("Choose...")];
-    [[[o_t2_tbl_plst tableColumnWithIdentifier:@"1"] headerCell]
+    [[[o_t2_tbl_plst tableColumnWithIdentifier:@"name"] headerCell]
         setStringValue: _NS("Title")];
-    [[[o_t2_tbl_plst tableColumnWithIdentifier:@"2"] headerCell]
+    [[[o_t2_tbl_plst tableColumnWithIdentifier:@"artist"] headerCell]
         setStringValue: _NS("Author")];
+    [[[o_t2_tbl_plst tableColumnWithIdentifier:@"duration"] headerCell]
+     setStringValue: _NS("Duration")];
     [o_t2_box_prtExtrct setTitle: _NS("Partial Extract")];
     [o_t2_ckb_enblPartExtrct setTitle: _NS("Enable")];
     [o_t2_ckb_enblPartExtrct setToolTip: _NS("This can be used to read only a "
@@ -419,7 +421,7 @@ static VLCWizard *_o_sharedInstance = nil;
     [o_t7_btn_mrInfo_local setTitle: _NS("More Info")];
 
     /* page eight ("Summary") */
-    [o_t8_txt_text setStringValue: _NS("This page lists all the settings."
+    [o_t8_txt_text setStringValue: _NS("This page lists all the settings. "
         "Click \"Finish\" to start streaming or transcoding.")];
     [o_t8_txt_title setStringValue: _NS("Summary")];
     [o_t8_txt_destination setStringValue: [_NS("Destination")
@@ -475,7 +477,7 @@ static VLCWizard *_o_sharedInstance = nil;
     [o_wizard_window close];
 }
 
-- (id)getPlaylistWizard
+- (id)playlistWizard
 {
     return o_playlist_wizard;
 }
@@ -557,8 +559,7 @@ static VLCWizard *_o_sharedInstance = nil;
                     if( p_item->i_children <= 0 )
                     {
                         char *psz_uri = input_item_GetURI( p_item->p_input );
-                        [tempArray addObject: [NSString stringWithUTF8String:
-                        psz_uri]];
+                        [tempArray addObject: [NSString stringWithUTF8String: psz_uri]];
                         free( psz_uri );
                         stop = NO;
                     }
@@ -626,7 +627,6 @@ static VLCWizard *_o_sharedInstance = nil;
             [o_userSelections setObject:@"1" forKey:@"stmgMhd"];
  
             /* disable all codecs which don't support ASF / ASFH */
-            [o_t4_pop_audioCodec removeItemWithTitle:@"MPEG 4 Audio"];
             [o_t4_pop_audioCodec removeItemWithTitle:@"Vorbis"];
             [o_t4_pop_audioCodec removeItemWithTitle:@"FLAC"];
             [o_t4_pop_audioCodec removeItemWithTitle:@"Speex"];
@@ -711,6 +711,9 @@ static VLCWizard *_o_sharedInstance = nil;
             [o_userSelections setObject:@"NO" forKey:@"trnscdAudio"];
         }
 
+        /* store the currently selected item for further reference */
+        int i_temp = [[o_t5_matrix_encap selectedCell] tag];
+
         /* disable all encap-formats */
         [[o_t5_matrix_encap cellAtRow:0 column:0] setEnabled:NO];
         [[o_t5_matrix_encap cellAtRow:1 column:0] setEnabled:NO];
@@ -1048,6 +1051,10 @@ static VLCWizard *_o_sharedInstance = nil;
         }
         if (anythingEnabled == YES)
         {
+            /* re-select the previously chosen item, if available */
+            if( [[o_t5_matrix_encap cellWithTag: i_temp] isEnabled] )
+                [o_t5_matrix_encap selectCellWithTag: i_temp];
+
             /* go the encap-tab */
             [o_tab_pageHolder selectTabViewItemAtIndex:4];
         } else {
@@ -1255,7 +1262,7 @@ static VLCWizard *_o_sharedInstance = nil;
     {
         intf_thread_t * p_intf = VLCIntf;
 
-        playlist_t * p_playlist = pl_Yield( p_intf );
+        playlist_t * p_playlist = pl_Get( p_intf );
 
         int x = 0;
         int y = [[o_userSelections objectForKey:@"pathToStrm"] count];
@@ -1265,32 +1272,36 @@ static VLCWizard *_o_sharedInstance = nil;
             NSString *tempString = [NSString stringWithFormat:
                 @"%@ (%i/%i)", _NS("Streaming/Transcoding Wizard"),
                 ( x + 1 ), y];
-            input_item_t *p_input = input_ItemNew( p_playlist,
+            input_item_t *p_input = input_item_New( p_playlist,
                 [[[o_userSelections objectForKey:@"pathToStrm"]
                 objectAtIndex:x] UTF8String],
                 [tempString UTF8String] );
-            input_ItemAddOption( p_input, [[[o_userSelections
-                objectForKey:@"opts"] objectAtIndex: x] UTF8String]);
+            input_item_AddOption( p_input, [[[o_userSelections
+                objectForKey:@"opts"] objectAtIndex: x] UTF8String],
+                VLC_INPUT_OPTION_TRUSTED );
 
             if(! [[o_userSelections objectForKey:@"partExtractFrom"]
                 isEqualToString:@""] )
             {
-                input_ItemAddOption( p_input, [[NSString
+                input_item_AddOption( p_input, [[NSString
                     stringWithFormat: @"start-time=%@", [o_userSelections
-                    objectForKey: @"partExtractFrom"]] UTF8String] );
+                    objectForKey: @"partExtractFrom"]] UTF8String],
+                                       VLC_INPUT_OPTION_TRUSTED );
             }
 
             if(! [[o_userSelections objectForKey:@"partExtractTo"]
                 isEqualToString:@""] )
             {
-                input_ItemAddOption( p_input, [[NSString
+                input_item_AddOption( p_input, [[NSString
                     stringWithFormat: @"stop-time=%@", [o_userSelections
-                    objectForKey: @"partExtractTo"]] UTF8String] );
+                    objectForKey: @"partExtractTo"]] UTF8String],
+                    VLC_INPUT_OPTION_TRUSTED );
             }
 
-            input_ItemAddOption( p_input, [[NSString stringWithFormat:
+            input_item_AddOption( p_input, [[NSString stringWithFormat:
                 @"ttl=%@", [o_userSelections objectForKey:@"ttl"]]
-                UTF8String] );
+                UTF8String],
+                VLC_INPUT_OPTION_TRUSTED );
 
             /* FIXME: playlist_AddInput() can fail */
             playlist_AddInput( p_playlist, p_input, PLAYLIST_STOP,
@@ -1300,7 +1311,7 @@ static VLCWizard *_o_sharedInstance = nil;
             {
                 /* play the first item and add the others afterwards */
                 PL_LOCK;
-                playlist_item_t *p_item = playlist_ItemGetByInput( p_playlist, p_input, pl_Locked );
+                playlist_item_t *p_item = playlist_ItemGetByInput( p_playlist, p_input );
                 playlist_Control( p_playlist, PLAYLIST_VIEWPLAY, pl_Locked, NULL,
                           p_item );
                 PL_UNLOCK;
@@ -1310,8 +1321,6 @@ static VLCWizard *_o_sharedInstance = nil;
             x += 1;
         }
 
-        vlc_object_release( p_playlist );
-
         /* close the window, since we are done */
         [o_wizard_window close];
     }
@@ -1468,10 +1477,9 @@ static VLCWizard *_o_sharedInstance = nil;
         if ([[o_userSelections objectForKey:@"trnscdVideo"] isEqualToString:@"YES"])
         {
             [o_trnscdCmd appendString: @"transcode{"];
-            [o_trnscdCmd appendFormat: @"vcodec=%s,vb=%i", [[[o_videoCodecs
-                objectAtIndex:[[o_userSelections objectForKey:@"trnscdVideoCodec"]
-                intValue]] objectAtIndex:1] UTF8String],  [[o_userSelections
-                objectForKey:@"trnscdVideoBitrate"] intValue]];
+            [o_trnscdCmd appendFormat: @"vcodec=%@,vb=%i", 
+                [[o_videoCodecs objectAtIndex:[[o_userSelections objectForKey:@"trnscdVideoCodec"] intValue]] objectAtIndex:1],
+                [[o_userSelections objectForKey:@"trnscdVideoBitrate"] intValue]];
             if ([[o_userSelections objectForKey:@"trnscdAudio"] isEqualToString:@"YES"])
             {
                 [o_trnscdCmd appendString: @","];
@@ -1496,21 +1504,20 @@ static VLCWizard *_o_sharedInstance = nil;
                 /* in case we transcode the audio only, add this */
                 [o_trnscdCmd appendString: @"transcode{"];
             }
-            [o_trnscdCmd appendFormat: @"acodec=%s,ab=%i}:", [[[o_audioCodecs
-                objectAtIndex:[[o_userSelections objectForKey:@"trnscdAudioCodec"]
-                intValue]] objectAtIndex:1] UTF8String],  [[o_userSelections
-                objectForKey:@"trnscdAudioBitrate"] intValue]];
+            [o_trnscdCmd appendFormat: @"acodec=%@,ab=%i}:", 
+                [[o_audioCodecs objectAtIndex:[[o_userSelections objectForKey:@"trnscdAudioCodec"] intValue]] objectAtIndex:1],
+                [[o_userSelections objectForKey:@"trnscdAudioBitrate"] intValue]];
         }
  
         if ([[o_userSelections objectForKey:@"trnscdOrStrmg"] isEqualToString:@"trnscd"])
         {
             /* we are just transcoding and dumping the stuff to a file */
             [o_opts_string appendFormat:
-                @":sout=#%s%sstandard{mux=%s,dst=%s,access=file}", [o_duplicateCmd
-                UTF8String], [o_trnscdCmd UTF8String], [[[o_encapFormats
-                objectAtIndex: [[o_userSelections objectForKey:@"encapFormat"]
-                intValue]] objectAtIndex:0] UTF8String], [[[o_userSelections
-                objectForKey: @"trnscdFilePath"] objectAtIndex: x] UTF8String]];
+                @":sout=#%@%@standard{mux=%@,dst=%@,access=file}", 
+                o_duplicateCmd,
+                o_trnscdCmd, 
+                [[o_encapFormats objectAtIndex: [[o_userSelections objectForKey:@"encapFormat"] intValue]] objectAtIndex:0],
+                [[o_userSelections objectForKey: @"trnscdFilePath"] objectAtIndex: x]];
         }
         else
         {
@@ -1526,31 +1533,28 @@ static VLCWizard *_o_sharedInstance = nil;
                 }
                 else
                 {
-                    [o_sap_option appendFormat: @"sap,name=\"%s\"",
-                        [[o_userSelections objectForKey:@"sapText"] UTF8String]];
+                    [o_sap_option appendFormat: @"sap,name=\"%@\"",
+                        [o_userSelections objectForKey:@"sapText"]];
                 }
                 if( [[o_strmgMthds objectAtIndex: [[o_userSelections objectForKey: @"stmgMhd"] intValue]] objectAtIndex:0] == @"rtp" )
                 {
                     /* RTP is no access out, but a stream out module */
                     [o_opts_string appendFormat:
-                                             @":sout=#%s%srtp{mux=%s,dst=%s,%s}",
-                        [o_duplicateCmd UTF8String], [o_trnscdCmd UTF8String],
-                        [[[o_encapFormats objectAtIndex: [[o_userSelections objectForKey: @"encapFormat"] intValue]] objectAtIndex:0]
-                            UTF8String], 
-                        [[o_userSelections objectForKey: @"stmgDest"] UTF8String],
-                        [o_sap_option UTF8String]];
+                                             @":sout=#%@%@rtp{mux=%@,dst=%@,%@}",
+                        o_duplicateCmd, o_trnscdCmd,
+                        [[o_encapFormats objectAtIndex: [[o_userSelections objectForKey: @"encapFormat"] intValue]] objectAtIndex:0], 
+                        [o_userSelections objectForKey: @"stmgDest"],
+                        o_sap_option];
                 }
                 else
                 {
                     [o_opts_string appendFormat:
-                                             @":sout=#%s%sstandard{mux=%s,dst=%s,access=%s,%s}",
-                        [o_duplicateCmd UTF8String], [o_trnscdCmd UTF8String],
-                        [[[o_encapFormats objectAtIndex: [[o_userSelections objectForKey: @"encapFormat"] intValue]] objectAtIndex:0]
-                            UTF8String], 
-                        [[o_userSelections objectForKey: @"stmgDest"] UTF8String], 
-                        [[[o_strmgMthds objectAtIndex: [[o_userSelections objectForKey: @"stmgMhd"] intValue]] objectAtIndex:0]
-                            UTF8String], 
-                        [o_sap_option UTF8String]];                    
+                                             @":sout=#%@%@standard{mux=%@,dst=%@,access=%@,%@}",
+                        o_duplicateCmd, o_trnscdCmd,
+                        [[o_encapFormats objectAtIndex: [[o_userSelections objectForKey: @"encapFormat"] intValue]] objectAtIndex:0], 
+                        [o_userSelections objectForKey: @"stmgDest"],
+                        [[o_strmgMthds objectAtIndex: [[o_userSelections objectForKey: @"stmgMhd"] intValue]] objectAtIndex:0], 
+                        o_sap_option];
                 }
             }
             else
@@ -1560,24 +1564,22 @@ static VLCWizard *_o_sharedInstance = nil;
                 {
                     /* RTP is different from the other protocols, as it isn't provided through an access out module anymore */
                     [o_opts_string appendFormat:
-                                             @":sout=#%s%srtp{mux=%s,dst=%s}",
-                        [o_duplicateCmd UTF8String], 
-                        [o_trnscdCmd UTF8String],
-                        [[[o_encapFormats objectAtIndex: [[o_userSelections objectForKey: @"encapFormat"] intValue]] objectAtIndex:0]
-                            UTF8String], 
-                        [[o_userSelections objectForKey: @"stmgDest"] UTF8String]];
+                                             @":sout=#%@%@rtp{mux=%@,dst=%@}",
+                        o_duplicateCmd,
+                        o_trnscdCmd,
+                        [[o_encapFormats objectAtIndex: [[o_userSelections objectForKey: @"encapFormat"] intValue]] objectAtIndex:0], 
+                        [o_userSelections objectForKey: @"stmgDest"]];
                 }
                 else
                 {
                     /* all other protocols are cool */
                     [o_opts_string appendFormat:
-                                             @":sout=#%s%sstandard{mux=%s,dst=%s,access=%s}",
-                        [o_duplicateCmd UTF8String], 
-                        [o_trnscdCmd UTF8String],
-                        [[[o_encapFormats objectAtIndex: [[o_userSelections objectForKey: @"encapFormat"] intValue]] objectAtIndex:0]
-                            UTF8String], 
-                        [[o_userSelections objectForKey: @"stmgDest"] UTF8String], 
-                        [[[o_strmgMthds objectAtIndex: [[o_userSelections objectForKey: @"stmgMhd"] intValue]] objectAtIndex:0] UTF8String]];
+                                             @":sout=#%@%@standard{mux=%@,dst=%@,access=%@}",
+                        o_duplicateCmd,
+                        o_trnscdCmd,
+                        [[o_encapFormats objectAtIndex: [[o_userSelections objectForKey: @"encapFormat"] intValue]] objectAtIndex:0], 
+                        [o_userSelections objectForKey: @"stmgDest"],
+                        [[o_strmgMthds objectAtIndex: [[o_userSelections objectForKey: @"stmgMhd"] intValue]] objectAtIndex:0]];
                 }
             }
         }
@@ -1590,8 +1592,8 @@ static VLCWizard *_o_sharedInstance = nil;
         }
  
         /* add subtitles to the video if desired */
-        [o_opts_string appendFormat: @":sout-transcode-soverlay=%@",
-                [o_userSelections objectForKey:@"soverlay"]];
+        if ([[o_userSelections objectForKey:@"soverlay"] intValue] > 0)
+            [o_opts_string appendString: @" --sout-transcode-soverlay"];
 
         [tempArray addObject: o_opts_string];
 
@@ -1660,7 +1662,7 @@ static VLCWizard *_o_sharedInstance = nil;
         @"Input"])
     {
         /* reset the wizard before going backwards. Otherwise, we might get
-         * unwanted behaviours in the Encap-Selection */
+         * unwanted behaviour in the Encap-Selection */
         [self resetWizard];
         /* show "Hello" */
         [o_tab_pageHolder selectTabViewItemAtIndex:0];