]> git.sesse.net Git - vlc/blobdiff - modules/gui/macosx/wizard.m
macosx: misc minor improvements to the legacy transcoding code
[vlc] / modules / gui / macosx / wizard.m
index aea2f60e47d6124d277bd15162380f3ef26a760a..c1a4f795d56edbe2f3453d52590caef7be23b6ff 100644 (file)
@@ -1,10 +1,10 @@
 /*****************************************************************************
  * wizard.m: MacOS X Streaming Wizard
  *****************************************************************************
- * Copyright (C) 2005-2012 VLC authors and VideoLAN
+ * Copyright (C) 2005-2013 VLC authors and VideoLAN
  * $Id$
  *
- * Authors: Felix Paul Kühne <fkuehne at videolan dot org>,
+ * Authors: Felix Paul Kühne <fkuehne at videolan dot org>,
  *          Brendon Justin <brendonjustin at gmail.com>
  *
  * This program is free software; you can redistribute it and/or modify
@@ -25,7 +25,7 @@
 
 /*****************************************************************************
  * Note: this code is partially based upon ../wxwidgets/wizard.cpp and
- *         ../wxwidgets/streamdata.h; both written by Clément Stenac.
+ *         ../wxwidgets/streamdata.h; both written by ClÃ\83©ment Stenac.
  *****************************************************************************/
 
 
@@ -73,7 +73,7 @@ static VLCWizard *_o_sharedInstance = nil;
 
 - (void)awakeFromNib
 {
-    if (OSX_LION)
+    if (!OSX_SNOW_LEOPARD)
         [o_wizard_window setCollectionBehavior: NSWindowCollectionBehaviorFullScreenAuxiliary];
 
     /* some minor cleanup */
@@ -272,7 +272,7 @@ static VLCWizard *_o_sharedInstance = nil;
         "computers using the Microsoft MMS protocol. This protocol is used as "
         "transport method by many Microsoft's softwares. Note that only a "
         "small part of the MMS protocol is supported (MMS encapsulated in "
-        "HTTP)." ), nil];
+        "HTTP)."), nil];
     o_udp_uni = [NSArray arrayWithObjects: @"udp", @"UDP-Unicast", _NS("Enter "
         "the address of the computer to stream to."), _NS("Use this to stream "
         "to a single computer."), nil];
@@ -494,7 +494,7 @@ static VLCWizard *_o_sharedInstance = nil;
          * store information for later usage */
         NSString *o_mode;
         o_mode = [[o_t1_matrix_strmgOrTrnscd selectedCell] title];
-        if( [o_mode isEqualToString: _NS("Stream to network")] )
+        if ([o_mode isEqualToString: _NS("Stream to network")])
         {
             /* we will be streaming */
             [o_userSelections setObject:@"strmg" forKey:@"trnscdOrStrmg"];
@@ -532,7 +532,7 @@ static VLCWizard *_o_sharedInstance = nil;
         BOOL stop;
         stop = NO;
         o_mode = [[o_t2_matrix_inputSourceType selectedCell] title];
-        if( [o_mode isEqualToString: _NS("Select a stream")] )
+        if ([o_mode isEqualToString: _NS("Select a stream")])
         {
             [o_userSelections setObject:@"YES" forKey:@"newStrm"];
             if ([[o_t2_fld_pathToNewStrm stringValue] isEqualToString: @""])
@@ -553,15 +553,15 @@ static VLCWizard *_o_sharedInstance = nil;
                 NSIndexSet * selectedIndexes = [o_t2_tbl_plst selectedRowIndexes];
                 NSUInteger count = [selectedIndexes count];
                 NSMutableArray * tempArray = [[NSMutableArray alloc] init];
-                for( NSUInteger x = 0; x < count; x++ )
+                for( NSUInteger x = 0; x < count; x++)
                 {
                     playlist_item_t *p_item = [[o_t2_tbl_plst itemAtRow: [selectedIndexes indexGreaterThanOrEqualToIndex: x]] pointerValue];
 
-                    if( p_item->i_children <= 0 )
+                    if (p_item->i_children <= 0)
                     {
-                        char *psz_uri = input_item_GetURI( p_item->p_input );
+                        char *psz_uri = input_item_GetURI( p_item->p_input);
                         [tempArray addObject: [NSString stringWithUTF8String: psz_uri]];
-                        free( psz_uri );
+                        free( psz_uri);
                         stop = NO;
                     }
                     else
@@ -596,7 +596,7 @@ static VLCWizard *_o_sharedInstance = nil;
         } else {
             /* show a sheet that the user didn't select a file */
             NSBeginInformationalAlertSheet(_NS("No input selected"),
-                _NS("OK"), @"", @"", o_wizard_window, nil, nil, nil, nil,
+                _NS("OK"), @"", @"", o_wizard_window, nil, nil, nil, nil, @"%@",
                 _NS("No new stream or valid playlist item has been selected.\n\n"
                 "Choose one before going to the next page."));
         }
@@ -609,7 +609,7 @@ static VLCWizard *_o_sharedInstance = nil;
         /* check which streaming method is selected and store it */
         int mode;
         mode = [[o_t3_matrix_stmgMhd selectedCell] tag];
-        if( mode == 0 )
+        if (mode == 0)
         {
             /* HTTP Streaming */
             [o_userSelections setObject:@"0" forKey:@"stmgMhd"];
@@ -619,7 +619,7 @@ static VLCWizard *_o_sharedInstance = nil;
             [o_t4_pop_audioCodec removeItemWithTitle:@"Uncompressed, integer"];
             [o_t4_pop_audioCodec removeItemWithTitle:@"Uncompressed, floating point"];
 
-        } else if ( mode == 1 )
+        } else if ( mode == 1)
         {
             /* MMS Streaming */
             [o_userSelections setObject:@"1" forKey:@"stmgMhd"];
@@ -651,14 +651,14 @@ static VLCWizard *_o_sharedInstance = nil;
         }
 
         /* store the destination and check whether is it empty */
-        if([[o_userSelections objectForKey:@"stmgMhd"] intValue] >=2 )
+        if([[o_userSelections objectForKey:@"stmgMhd"] intValue] >=2)
         {
            /* empty field is valid for HTTP and MMS */
-            if( [[o_t3_fld_address stringValue] isEqualToString: @""] )
+            if ([[o_t3_fld_address stringValue] isEqualToString: @""])
             {
                 /* complain to the user that "" is no valid dest. */
                 NSBeginInformationalAlertSheet(_NS("No valid destination"),
-                    _NS("OK"), @"", @"", o_wizard_window, nil, nil, nil, nil,
+                    _NS("OK"), @"", @"", o_wizard_window, nil, nil, nil, nil, @"%@",
                     _NS("A valid destination has to be selected "
                     "Enter either a Unicast-IP or a Multicast-IP."
                     "\n\nIf you don't know what this means, have a look at "
@@ -938,7 +938,7 @@ static VLCWizard *_o_sharedInstance = nil;
         }
 
         NSInteger i_streamingMethod = [[o_userSelections objectForKey:@"stmgMhd"] intValue];
-        if ( i_streamingMethod == 1 )
+        if ( i_streamingMethod == 1)
         {
             /* if MMS is the streaming protocol, only ASFH is available */
             [[o_t5_matrix_encap cellAtRow:0 column:0] setEnabled:NO];
@@ -953,7 +953,7 @@ static VLCWizard *_o_sharedInstance = nil;
             [[o_t5_matrix_encap cellAtRow:9 column:0] setEnabled:YES];
             [o_t5_matrix_encap selectCellAtRow:9 column:0];
         }
-        else if ( i_streamingMethod == 0 )
+        else if ( i_streamingMethod == 0)
         {
             /* if HTTP is the streaming protocol, disable all unsupported
              * encap-formats, but don't touch the other ones selected above */
@@ -962,7 +962,7 @@ static VLCWizard *_o_sharedInstance = nil;
             [[o_t5_matrix_encap cellAtRow:8 column:0] setEnabled:NO];
             [[o_t5_matrix_encap cellAtRow:9 column:0] setEnabled:NO];
         }
-        else if ( i_streamingMethod >= 2 )
+        else if ( i_streamingMethod >= 2)
         {
             /* if UDP/RTP is the streaming protocol, only MPEG-TS is available */
             [[o_t5_matrix_encap cellAtRow:0 column:0] setEnabled:NO];
@@ -981,7 +981,7 @@ static VLCWizard *_o_sharedInstance = nil;
         BOOL anythingEnabled;
         anythingEnabled = NO;
         NSUInteger count = [o_t5_matrix_encap numberOfRows];
-        for (NSUInteger x = 0; x < count; x++ )
+        for (NSUInteger x = 0; x < count; x++)
         {
             if ([[o_t5_matrix_encap cellAtRow:x column:0] isEnabled])
                 anythingEnabled = YES;
@@ -990,7 +990,7 @@ 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] )
+            if ([[o_t5_matrix_encap cellWithTag: i_temp] isEnabled])
                 [o_t5_matrix_encap selectCellWithTag: i_temp];
 
             /* go the encap-tab */
@@ -998,7 +998,7 @@ static VLCWizard *_o_sharedInstance = nil;
         } else {
             /* show a sheet that the selected codecs are not compatible */
             NSBeginInformationalAlertSheet(_NS("Invalid selection"), _NS("OK"),
-                @"", @"", o_wizard_window, nil, nil, nil, nil, _NS("The "
+                @"", @"", o_wizard_window, nil, nil, nil, nil, @"%@", _NS("The "
                 "chosen codecs are not compatible with each other. For example: "
                 "It is not possible to mix uncompressed audio with any video codec.\n\n"
                 "Correct your selection and try again."));
@@ -1022,7 +1022,7 @@ static VLCWizard *_o_sharedInstance = nil;
             [o_tab_pageHolder selectTabViewItemAtIndex:6];
             /* in case that we are processing multiple items, let the user
              * select a folder instead of a localtion for a single item */
-            if( [[o_userSelections objectForKey:@"pathToStrm"] count] > 1 )
+            if ([[o_userSelections objectForKey:@"pathToStrm"] count] > 1)
             {
                 [o_t7_txt_saveFileTo setStringValue:
                     _NS("Select the directory to save to")];
@@ -1075,10 +1075,10 @@ static VLCWizard *_o_sharedInstance = nil;
         }
 
         /* check whether the path != "" and store it */
-        if( [[o_t7_fld_filePath stringValue] isEqualToString: @""] )
+        if ([[o_t7_fld_filePath stringValue] isEqualToString: @""])
         {
             /* complain to the user that "" is no valid path for a folder/file */
-            if( [[o_userSelections objectForKey:@"pathToStrm"] count] > 1 )
+            if ([[o_userSelections objectForKey:@"pathToStrm"] count] > 1)
                 NSBeginInformationalAlertSheet(_NS("No folder selected"),
                     _NS("OK"), @"", @"", o_wizard_window, nil, nil, nil, nil,
                     @"%@\n\n%@", _NS("A directory "
@@ -1097,27 +1097,27 @@ static VLCWizard *_o_sharedInstance = nil;
             NSString * theEncapFormat = [[o_encapFormats objectAtIndex:
                 [[o_userSelections objectForKey:@"encapFormat"] intValue]]
                 objectAtIndex:0];
-            if( theEncapFormat == @"ps" )
+            if ([theEncapFormat isEqualToString:@"ps"])
                 theEncapFormat = @"mpg";
 
             /* look whether we need to process multiple items or not.
              * choose a faster variant if we just want a single item */
-            if( [[o_userSelections objectForKey:@"pathToStrm"] count] > 1 )
+            if ([[o_userSelections objectForKey:@"pathToStrm"] count] > 1)
             {
                 NSMutableArray * tempArray = [[NSMutableArray alloc] init];
                 int x = 0;
                 int y = [[o_userSelections objectForKey:@"pathToStrm"] count];
                 NSMutableString * tempString = [[NSMutableString alloc] init];
-                while( x != y )
+                while( x != y)
                 {
                     NSString * fileNameToUse;
                     /* check whether the extension is hidden or not.
                      * if not, remove it
                      * we need the casting to make GCC4 happy */
-                    if[[[NSFileManager defaultManager] attributesOfItemAtPath:
+                    if ([[[NSFileManager defaultManager] attributesOfItemAtPath:
                         [[o_userSelections objectForKey:@"pathToStrm"]
                          objectAtIndex: x] error:nil] objectForKey:
-                        NSFileExtensionHidden] )
+                        NSFileExtensionHidden])
                         fileNameToUse = [NSString stringWithString:
                             [[NSFileManager defaultManager] displayNameAtPath:
                             [[o_userSelections objectForKey:@"pathToStrm"]
@@ -1131,7 +1131,7 @@ static VLCWizard *_o_sharedInstance = nil;
                             objectAtIndex: x]]
                             componentsSeparatedByString: @"."] count];
                         fileNameToUse = @"";
-                        while( z < (count - 1) )
+                        while( z < (count - 1))
                         {
                             fileNameToUse = [fileNameToUse stringByAppendingString:
                                 [[[[NSFileManager defaultManager]
@@ -1146,26 +1146,26 @@ static VLCWizard *_o_sharedInstance = nil;
                     tempString = [NSString stringWithFormat: @"%@%@.%@",
                         [o_t7_fld_filePath stringValue],
                         fileNameToUse, theEncapFormat];
-                    if[[NSFileManager defaultManager] fileExistsAtPath:
-                        tempString] )
+                    if ([[NSFileManager defaultManager] fileExistsAtPath:
+                        tempString])
                     {
                         /* we don't wanna overwrite existing files, so add an
                          * int to the file-name */
                         int additionalInt = 1;
-                        while( additionalInt < 100 )
+                        while( additionalInt < 100)
                         {
                             tempString = [NSString stringWithFormat:@"%@%@ %i.%@",
                                 [o_t7_fld_filePath stringValue],
                                 fileNameToUse, additionalInt, theEncapFormat];
                             if(! [[NSFileManager defaultManager]
-                                fileExistsAtPath: tempString] )
+                                fileExistsAtPath: tempString])
                                 break;
                             additionalInt += 1;
                         }
-                        if( additionalInt >= 100 )
+                        if (additionalInt >= 100)
                             msg_Err( VLCIntf, "Files with the same name are "
                                 "already present in the destination directory. "
-                                "Delete these files or choose a different directory." );
+                                "Delete these files or choose a different directory.");
                     }
                     [tempArray addObject: [tempString retain]];
                     x += 1;
@@ -1197,63 +1197,75 @@ static VLCWizard *_o_sharedInstance = nil;
     {
         intf_thread_t * p_intf = VLCIntf;
 
-        playlist_t * p_playlist = pl_Get( p_intf );
+        playlist_t * p_playlist = pl_Get( p_intf);
 
         int x = 0;
         int y = [[o_userSelections objectForKey:@"pathToStrm"] count];
-        while( x != y )
+        while( x != y)
         {
             /* we need a temp. variable here to work-around a GCC4-bug */
             NSString *tempString = [NSString stringWithFormat:
                 @"%@ (%i/%i)", _NS("Streaming/Transcoding Wizard"),
-                ( x + 1 ), y];
+                ( x + 1), y];
             input_item_t *p_input = input_item_New(
                 [[[o_userSelections objectForKey:@"pathToStrm"]
                 objectAtIndex:x] UTF8String],
-                [tempString UTF8String] );
+                [tempString UTF8String]);
 
             /* use the MRL from the text field, in case the user
              * modified it */
-            input_item_AddOption( p_input, [[o_t8_fld_mrl stringValue] UTF8String], VLC_INPUT_OPTION_TRUSTED );
+            input_item_AddOption( p_input, [[o_t8_fld_mrl stringValue] UTF8String], VLC_INPUT_OPTION_TRUSTED);
 
             if(! [[o_userSelections objectForKey:@"partExtractFrom"]
-                isEqualToString:@""] )
-            {
-                input_item_AddOption( p_input, [[NSString
-                    stringWithFormat: @"start-time=%@", [o_userSelections
-                    objectForKey: @"partExtractFrom"]] UTF8String],
-                    VLC_INPUT_OPTION_TRUSTED );
+                isEqualToString:@""]) {
+                NSArray * components = [[o_userSelections objectForKey: @"partExtractFrom"] componentsSeparatedByString:@":"];
+                NSUInteger componentCount = [components count];
+                NSUInteger time = 0;
+                if (componentCount == 1)
+                    time = 1000000 * ([[components objectAtIndex:0] intValue]);
+                else if (componentCount == 2)
+                    time = 1000000 * ([[components objectAtIndex:0] intValue] * 60 + [[components objectAtIndex:1] intValue]);
+                else if (componentCount == 3)
+                    time = 1000000 * ([[components objectAtIndex:0] intValue] * 3600 + [[components objectAtIndex:1] intValue] * 60 + [[components objectAtIndex:2] intValue]);
+                else
+                    msg_Err(VLCIntf, "Invalid string format for time");
+                input_item_AddOption(p_input, [[NSString stringWithFormat: @"start-time=%lu", time] UTF8String], VLC_INPUT_OPTION_TRUSTED);
             }
 
             if(! [[o_userSelections objectForKey:@"partExtractTo"]
-                isEqualToString:@""] )
-            {
-                input_item_AddOption( p_input, [[NSString
-                    stringWithFormat: @"stop-time=%@", [o_userSelections
-                    objectForKey: @"partExtractTo"]] UTF8String],
-                    VLC_INPUT_OPTION_TRUSTED );
+                isEqualToString:@""]) {
+                NSArray * components = [[o_userSelections objectForKey: @"partExtractTo"] componentsSeparatedByString:@":"];
+                NSUInteger componentCount = [components count];
+                NSUInteger time = 0;
+                if (componentCount == 1)
+                    time = 1000000 * ([[components objectAtIndex:0] intValue]);
+                else if (componentCount == 2)
+                    time = 1000000 * ([[components objectAtIndex:0] intValue] * 60 + [[components objectAtIndex:1] intValue]);
+                else if (componentCount == 3)
+                    time = 1000000 * ([[components objectAtIndex:0] intValue] * 3600 + [[components objectAtIndex:1] intValue] * 60 + [[components objectAtIndex:2] intValue]);
+                else
+                    msg_Err(VLCIntf, "Invalid string format for time");
+                input_item_AddOption(p_input, [[NSString stringWithFormat: @"stop-time=%lu", time] UTF8String], VLC_INPUT_OPTION_TRUSTED);
             }
 
             input_item_AddOption( p_input, [[NSString stringWithFormat:
                 @"ttl=%@", [o_userSelections objectForKey:@"ttl"]]
                 UTF8String],
-                VLC_INPUT_OPTION_TRUSTED );
+                VLC_INPUT_OPTION_TRUSTED);
 
-            /* FIXME: playlist_AddInput() can fail */
-            playlist_AddInput( p_playlist, p_input, PLAYLIST_STOP,
-                PLAYLIST_END, true, pl_Unlocked );
+            int returnValue = playlist_AddInput( p_playlist, p_input, PLAYLIST_STOP, PLAYLIST_END, true, pl_Unlocked);
 
-            if( x == 0 )
+            if (x == 0 && returnValue != VLC_SUCCESS)
             {
                 /* play the first item and add the others afterwards */
                 PL_LOCK;
-                playlist_item_t *p_item = playlist_ItemGetByInput( p_playlist, p_input );
+                playlist_item_t *p_item = playlist_ItemGetByInput( p_playlist, p_input);
                 playlist_Control( p_playlist, PLAYLIST_VIEWPLAY, pl_Locked, NULL,
-                          p_item );
+                          p_item);
                 PL_UNLOCK;
             }
 
-            vlc_gc_decref( p_input );
+            vlc_gc_decref( p_input);
             x += 1;
         }
 
@@ -1268,13 +1280,13 @@ static VLCWizard *_o_sharedInstance = nil;
     savePreviousSel = [o_t4_pop_videoCodec indexOfSelectedItem];
     [o_t4_pop_videoCodec removeAllItems];
     NSUInteger count = [o_videoCodecs count];
-    for (NSUInteger x = 0; x < count; x++ )
+    for (NSUInteger x = 0; x < count; x++)
     {
         [o_t4_pop_videoCodec addItemWithTitle:[[o_videoCodecs objectAtIndex:x]
             objectAtIndex:0]];
         [[o_t4_pop_videoCodec lastItem] setTag:x];
     }
-    if( savePreviousSel >= 0 )
+    if (savePreviousSel >= 0)
         [o_t4_pop_videoCodec selectItemAtIndex: savePreviousSel];
 
     savePreviousSel = [o_t4_pop_audioCodec indexOfSelectedItem];
@@ -1286,7 +1298,7 @@ static VLCWizard *_o_sharedInstance = nil;
             objectAtIndex:0]];
         [[o_t4_pop_audioCodec lastItem] setTag:x];
     }
-    if( savePreviousSel >= 0 )
+    if (savePreviousSel >= 0)
         [o_t4_pop_audioCodec selectItemAtIndex: savePreviousSel];
 }
 
@@ -1295,7 +1307,7 @@ static VLCWizard *_o_sharedInstance = nil;
     [o_btn_forward setTitle: _NS("Finish")];
     /* if we will transcode multiple items, just give their number; otherwise
      * print the URI of the single item */
-    if( [[o_userSelections objectForKey:@"pathToStrm"] count] > 1 )
+    if ([[o_userSelections objectForKey:@"pathToStrm"] count] > 1)
         [o_t8_fld_inptStream setStringValue: [NSString stringWithFormat:
             _NS("%i items"),
             [[o_userSelections objectForKey:@"pathToStrm"] count]]];
@@ -1313,7 +1325,7 @@ static VLCWizard *_o_sharedInstance = nil;
     if ([[o_userSelections objectForKey:@"partExtract"] isEqualToString: @"YES"])
     {
         [o_t8_fld_partExtract setStringValue: [NSString stringWithFormat:
-            _NS("yes: from %@ to %@ secs"),
+            _NS("yes: from %@ to %@"),
             [o_userSelections objectForKey:@"partExtractFrom"],
             [o_userSelections objectForKey:@"partExtractTo"]]];
     } else {
@@ -1376,7 +1388,7 @@ static VLCWizard *_o_sharedInstance = nil;
         [o_t8_fld_ttl setStringValue: @"-"];
         [o_t8_fld_sap setStringValue: @"-"];
         /* do only show the destination of the first item and add a counter, if needed */
-        if( [[o_userSelections objectForKey: @"trnscdFilePath"] count] > 1 )
+        if ([[o_userSelections objectForKey: @"trnscdFilePath"] count] > 1)
             [o_t8_fld_saveFileTo setStringValue:
                 [NSString stringWithFormat: @"%@ (+%li)",
                 [[o_userSelections objectForKey: @"trnscdFilePath"] objectAtIndex:0],
@@ -1405,7 +1417,7 @@ static VLCWizard *_o_sharedInstance = nil;
     NSMutableArray * tempArray = [[NSMutableArray alloc] init];
 
     /* loop to create an opt-string for each item we're processing */
-    while( x != y )
+    while( x != y)
     {
         /* check whether we transcode the audio and/or the video and compose a
          * string reflecting the settings, if needed */
@@ -1448,7 +1460,7 @@ static VLCWizard *_o_sharedInstance = nil;
         {
             /* we are just transcoding and dumping the stuff to a file */
             [o_opts_string appendFormat:
-                @":sout=#%@%@standard{mux=%@,dst=%@,access=file}",
+                @":sout=#%@%@standard{mux=%@,access=file{no-overwrite},dst=%@}",
                 o_duplicateCmd,
                 o_trnscdCmd,
                 [[o_encapFormats objectAtIndex: [[o_userSelections objectForKey:@"encapFormat"] intValue]] objectAtIndex:0],
@@ -1471,7 +1483,7 @@ static VLCWizard *_o_sharedInstance = nil;
                     [o_sap_option appendFormat: @"sap,name=\"%@\"",
                         [o_userSelections objectForKey:@"sapText"]];
                 }
-                if( [[o_strmgMthds objectAtIndex: [[o_userSelections objectForKey: @"stmgMhd"] intValue]] objectAtIndex:0] == @"rtp" )
+                if ([[[o_strmgMthds objectAtIndex: [[o_userSelections objectForKey: @"stmgMhd"] intValue]] objectAtIndex:0] isEqualToString:@"rtp"])
                 {
                     /* RTP is no access out, but a stream out module */
                     [o_opts_string appendFormat:
@@ -1495,7 +1507,7 @@ static VLCWizard *_o_sharedInstance = nil;
             else
             {
                 /* no SAP, just streaming */
-                if( [[o_strmgMthds objectAtIndex: [[o_userSelections objectForKey: @"stmgMhd"] intValue]] objectAtIndex:0] == @"rtp" )
+                if ([[[o_strmgMthds objectAtIndex: [[o_userSelections objectForKey: @"stmgMhd"] intValue]] objectAtIndex:0] isEqualToString:@"rtp"])
                 {
                     /* RTP is different from the other protocols, as it isn't provided through an access out module anymore */
                     [o_opts_string appendFormat:
@@ -1606,7 +1618,7 @@ static VLCWizard *_o_sharedInstance = nil;
 {
     /* show a sheet for the help */
     NSBeginInformationalAlertSheet(_NS("Stream to network"),
-        _NS("OK"), @"", @"", o_wizard_window, nil, nil, nil, nil,
+        _NS("OK"), @"", @"", o_wizard_window, nil, nil, nil, nil, @"%@",
         _NS("This allows streaming on a network."));
 }
 
@@ -1614,7 +1626,7 @@ static VLCWizard *_o_sharedInstance = nil;
 {
     /* show a sheet for the help */
     NSBeginInformationalAlertSheet(_NS("Transcode/Save to file"),
-        _NS("OK"), @"", @"", o_wizard_window, nil, nil, nil, nil,
+        _NS("OK"), @"", @"", o_wizard_window, nil, nil, nil, nil, @"%@",
         _NS("This allows saving a stream to a file. The "
         "can be reencoded on the fly. Whatever "
         "VLC can read can be saved.\nPlease note that VLC is not very suited "
@@ -1626,18 +1638,10 @@ static VLCWizard *_o_sharedInstance = nil;
 {
     NSOpenPanel * openPanel = [NSOpenPanel openPanel];
     SEL sel = @selector(t2_getNewStreamFromDialog:returnCode:contextInfo:);
-    [openPanel beginSheetForDirectory:nil file:nil types:nil modalForWindow:
-        o_wizard_window modalDelegate:self didEndSelector:sel contextInfo:nil];
-}
-
-- (void)t2_getNewStreamFromDialog: (NSOpenPanel *)sheet
-                       returnCode: (int)returnCode
-                      contextInfo: (void *)contextInfo
-{
-    if (returnCode == NSOKButton)
-    {
-        [o_t2_fld_pathToNewStrm setStringValue: [[sheet URL] absoluteString]];
-    }
+    [openPanel beginSheetModalForWindow: o_wizard_window completionHandler: ^(NSInteger returnCode) {
+        if (returnCode == NSOKButton)
+            [o_t2_fld_pathToNewStrm setStringValue: [[openPanel URL] absoluteString]];
+    }];
 }
 
 - (IBAction)t2_chooseStreamOrPlst:(id)sender
@@ -1646,7 +1650,7 @@ static VLCWizard *_o_sharedInstance = nil;
     NSString *o_mode;
     o_mode = [[o_t2_matrix_inputSourceType selectedCell] title];
 
-    if( [o_mode isEqualToString: _NS("Select a stream")] )
+    if ([o_mode isEqualToString: _NS("Select a stream")])
     {
         [o_t2_btn_chooseFile setEnabled:YES];
         [o_t2_fld_pathToNewStrm setEnabled:YES];
@@ -1679,7 +1683,7 @@ static VLCWizard *_o_sharedInstance = nil;
      * streaming method */
     int mode;
     mode = [[o_t3_matrix_stmgMhd selectedCell] tag];
-    if( mode == 0 )
+    if (mode == 0)
     {
         /* HTTP */
         [o_t3_txt_destInfo setStringValue: [[o_strmgMthds objectAtIndex:0]
@@ -1687,7 +1691,7 @@ static VLCWizard *_o_sharedInstance = nil;
         [o_t3_txt_strgMthdInfo setStringValue: [[o_strmgMthds objectAtIndex:0]
             objectAtIndex:3]];
     }
-    else if( mode == 1 )
+    else if (mode == 1)
     {
         /* MMS */
         [o_t3_txt_destInfo setStringValue: [[o_strmgMthds objectAtIndex:1]
@@ -1695,7 +1699,7 @@ static VLCWizard *_o_sharedInstance = nil;
         [o_t3_txt_strgMthdInfo setStringValue: [[o_strmgMthds objectAtIndex:1]
             objectAtIndex:3]];
     }
-    else if( mode == 2 )
+    else if (mode == 2)
     {
         /* UDP-Unicast */
         [o_t3_txt_destInfo setStringValue: [[o_strmgMthds objectAtIndex:2]
@@ -1703,7 +1707,7 @@ static VLCWizard *_o_sharedInstance = nil;
         [o_t3_txt_strgMthdInfo setStringValue: [[o_strmgMthds objectAtIndex:2]
         objectAtIndex:3]];
     }
-    else if( mode == 3 )
+    else if (mode == 3)
     {
         /* UDP-Multicast */
         [o_t3_txt_destInfo setStringValue: [[o_strmgMthds objectAtIndex:3]
@@ -1711,7 +1715,7 @@ static VLCWizard *_o_sharedInstance = nil;
         [o_t3_txt_strgMthdInfo setStringValue: [[o_strmgMthds objectAtIndex:3]
         objectAtIndex:3]];
     }
-    else if( mode == 4 )
+    else if (mode == 4)
     {
         /* RTP-Unicast */
         [o_t3_txt_destInfo setStringValue: [[o_strmgMthds objectAtIndex:4]
@@ -1719,7 +1723,7 @@ static VLCWizard *_o_sharedInstance = nil;
         [o_t3_txt_strgMthdInfo setStringValue: [[o_strmgMthds objectAtIndex:4]
             objectAtIndex:3]];
     }
-    else if( mode == 5 )
+    else if (mode == 5)
     {
         /* RTP-Multicast */
         [o_t3_txt_destInfo setStringValue: [[o_strmgMthds objectAtIndex:5]
@@ -1794,7 +1798,7 @@ static VLCWizard *_o_sharedInstance = nil;
 {
     /* show a sheet for the help */
     NSBeginInformationalAlertSheet(_NS("Time-To-Live (TTL)"),
-        _NS("OK"), @"", @"", o_wizard_window, nil, nil, nil, nil,
+        _NS("OK"), @"", @"", o_wizard_window, nil, nil, nil, nil, @"%@",
         _NS("This allows defining the TTL (Time-To-Live) of the stream. "
             "This parameter is the maximum number of routers your stream can "
             "go through. If you don't know what it means, or if you want to "
@@ -1805,7 +1809,7 @@ static VLCWizard *_o_sharedInstance = nil;
 {
     /* show a sheet for the help */
     NSBeginInformationalAlertSheet(_NS("SAP Announce"),
-        _NS("OK"), @"", @"", o_wizard_window, nil, nil, nil, nil,
+        _NS("OK"), @"", @"", o_wizard_window, nil, nil, nil, nil, @"%@",
         _NS("When streaming using UDP, the streams can be "
         "announced using the SAP/SDP announcing protocol. This "
         "way, the clients won't have to type in the multicast address, it "
@@ -1818,7 +1822,7 @@ static VLCWizard *_o_sharedInstance = nil;
 {
     /* show a sheet for the help */
     NSBeginInformationalAlertSheet(_NS("Local playback"),
-            _NS("OK"), @"", @"", o_wizard_window, nil, nil, nil, nil,
+            _NS("OK"), @"", @"", o_wizard_window, nil, nil, nil, nil, @"%@",
             _NS("When this option is enabled, the stream will be both played "
             "and transcoded/streamed.\n\nNote that this requires much more "
             "CPU power than simple transcoding or streaming."));
@@ -1830,9 +1834,7 @@ static VLCWizard *_o_sharedInstance = nil;
      * his/her new file. We take a modified NSOpenPanel to select a folder
      * and a plain NSSavePanel to save a single file. */
 
-    SEL sel = @selector(t7_getTrnscdDestFile:returnCode:contextInfo:);
-
-    if( [[o_userSelections objectForKey:@"pathToStrm"] count] > 1 )
+    if ([[o_userSelections objectForKey:@"pathToStrm"] count] > 1)
     {
         NSOpenPanel * saveFolderPanel = [[NSOpenPanel alloc] init];
 
@@ -1840,8 +1842,11 @@ static VLCWizard *_o_sharedInstance = nil;
         [saveFolderPanel setCanChooseFiles: NO];
         [saveFolderPanel setCanSelectHiddenExtension: NO];
         [saveFolderPanel setCanCreateDirectories: YES];
-        [saveFolderPanel beginSheetForDirectory:nil file:nil modalForWindow:
-        o_wizard_window modalDelegate:self didEndSelector:sel contextInfo:nil];
+        [saveFolderPanel beginSheetModalForWindow: o_wizard_window completionHandler:^(NSInteger returnCode) {
+            if (returnCode == NSOKButton)
+                [o_t7_fld_filePath setStringValue: [NSString stringWithFormat: @"%@/", [[saveFolderPanel URL] path]]];
+        }];
+        [saveFolderPanel release];
     }
     else
     {
@@ -1853,32 +1858,19 @@ static VLCWizard *_o_sharedInstance = nil;
         NSString * theEncapFormat = [[o_encapFormats objectAtIndex:
         [[o_userSelections objectForKey:@"encapFormat"] intValue]]
         objectAtIndex:0];
-        if( theEncapFormat != @"ps" )
+        if (![theEncapFormat isEqualToString:@"ps"])
             [saveFilePanel setAllowedFileTypes: [NSArray arrayWithObject:theEncapFormat]];
         else
             [saveFilePanel setAllowedFileTypes: [NSArray arrayWithObject:@"mpg"]];
 
         [saveFilePanel setCanSelectHiddenExtension: YES];
         [saveFilePanel setCanCreateDirectories: YES];
-        [saveFilePanel beginSheetForDirectory:nil file:nil modalForWindow:
-        o_wizard_window modalDelegate:self didEndSelector:sel contextInfo:nil];
-    }
-}
-
-- (void)t7_getTrnscdDestFile: (NSOpenPanel *)sheet returnCode:
-    (int)returnCode contextInfo: (void *)contextInfo
-{
-    if (returnCode == NSOKButton)
-    {
-        /* output returned path to text-field, add a / to the end if the user
-         * selected a folder */
-        if( [[o_userSelections objectForKey:@"pathToStrm"] count] > 1 )
-            [o_t7_fld_filePath setStringValue: [NSString stringWithFormat:
-                @"%@/", [[sheet URL] path]]];
-        else
-            [o_t7_fld_filePath setStringValue:[[sheet URL] path]];
+        [saveFilePanel beginSheetModalForWindow: o_wizard_window completionHandler:^(NSInteger returnCode) {
+            if (returnCode == NSOKButton)
+                [o_t7_fld_filePath setStringValue:[[saveFilePanel URL] path]];
+        }];
+        [saveFilePanel release];
     }
-    [sheet release];
 }
 
 @end