]> git.sesse.net Git - vlc/blobdiff - modules/gui/macosx/wizard.m
macosx: remove 2 interface update timers (2 threads), 1 additional interface update...
[vlc] / modules / gui / macosx / wizard.m
index 8a7c5db77cd4fb8170ddce718341e5789e6d26a0..1e41dca832b3b7779b7a4c13cdd11145266bad3d 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
@@ -225,7 +225,6 @@ static VLCWizard *_o_sharedInstance = nil;
     NSArray * o_ogg;
     NSArray * o_raw;
     NSArray * o_asf;
-    NSArray * o_avi;
     NSArray * o_mp4;
     NSArray * o_mov;
     NSArray * o_wav;
@@ -239,13 +238,12 @@ static VLCWizard *_o_sharedInstance = nil;
     o_ogg = [NSArray arrayWithObjects: @"ogg", @"OGG", @"OGG", nil];
     o_raw = [NSArray arrayWithObjects: @"raw", @"RAW", @"RAW", nil];
     o_asf = [NSArray arrayWithObjects: @"asf", @"ASF", @"ASF", nil];
-    o_avi = [NSArray arrayWithObjects: @"avi", @"AVI", @"AVI", nil];
     o_mp4 = [NSArray arrayWithObjects: @"mp4", @"MP4", @"MPEG4", nil];
     o_mov = [NSArray arrayWithObjects: @"mov", @"MOV", @"MOV", nil];
     o_wav = [NSArray arrayWithObjects: @"wav", @"WAV", @"WAV", nil];
     o_asfh = [NSArray arrayWithObjects: @"asfh", @"ASFH", @"ASFH", nil];
     o_encapFormats = [[NSArray alloc] initWithObjects: o_ps, o_ts, o_mpeg,
-        o_ogg, o_raw, o_asf, o_avi, o_mp4, o_mov, o_wav, o_asfh, nil];
+        o_ogg, o_raw, o_asf, o_mp4, o_mov, o_wav, o_asfh, nil];
 
     /* yet another array on streaming methods including help texts */
     NSArray * o_http;
@@ -304,52 +302,10 @@ static VLCWizard *_o_sharedInstance = nil;
 
 - (void)resetWizard
 {
-    /* get the current state of our setting to keep the selections or not */
-    b_keepSettingsOrNot = (BOOL)config_GetInt( VLCIntf, "macosx-wizard-keep" );
-
     /* go to the front page and clean up a bit */
     [o_userSelections removeAllObjects];
     [o_btn_forward setTitle: _NS("Next")];
     [o_tab_pageHolder selectFirstTabViewItem:self];
-
-    if( b_keepSettingsOrNot )
-        return;
-    /* reset the wizard-window to its default values if wanted */
-    [o_t1_matrix_strmgOrTrnscd selectCellAtRow:0 column:0];
-    [[o_t1_matrix_strmgOrTrnscd cellAtRow:1 column:0] setState: NSOffState];
-
-    /* "Input" */
-    [o_t2_fld_pathToNewStrm setStringValue: @""];
-    [o_t2_ckb_enblPartExtrct setState: NSOffState];
-    [self t2_enableExtract:nil];
-    [o_t2_matrix_inputSourceType selectCellAtRow:0 column:0];
-    [[o_t2_matrix_inputSourceType cellAtRow:1 column:0] setState: NSOffState];
-    [o_t2_fld_pathToNewStrm setEnabled:YES];
-    [o_t2_btn_chooseFile setEnabled:YES];
-    [o_t2_tbl_plst setEnabled:NO];
-
-    /* "Streaming 1" */
-    [o_t3_fld_address setStringValue: @""];
-    [o_t3_matrix_stmgMhd selectCellAtRow:0 column:0];
-    [[o_t3_matrix_stmgMhd cellAtRow:0 column:1] setState: NSOffState];
-    [[o_t3_matrix_stmgMhd cellAtRow:1 column:1] setState: NSOffState];
-    [[o_t3_matrix_stmgMhd cellAtRow:1 column:2] setState: NSOffState];
-
-    /* "Transcode 1" */
-    [o_t4_ckb_audio setState: NSOffState];
-    [o_t4_ckb_video setState: NSOffState];
-    [self t4_enblVidTrnscd:nil];
-    [self t4_enblAudTrnscd:nil];
-
-    /* "Streaming 2" */
-    [o_t6_fld_ttl setStringValue: @"1"];
-    [o_t6_ckb_sap setState: NSOffState];
-    [self t6_enblSapAnnce:nil];
-
-    /* "Transcode 2" */
-    [o_t7_fld_filePath setStringValue: @""];
 }
 
 - (void)initStrings
@@ -386,10 +342,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 "
@@ -461,7 +419,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")
@@ -517,7 +475,7 @@ static VLCWizard *_o_sharedInstance = nil;
     [o_wizard_window close];
 }
 
-- (id)getPlaylistWizard
+- (id)playlistWizard
 {
     return o_playlist_wizard;
 }
@@ -599,8 +557,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;
                     }
@@ -668,7 +625,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"];
@@ -730,7 +686,7 @@ static VLCWizard *_o_sharedInstance = nil;
         if ([o_t4_ckb_video state] == NSOnState)
         {
             NSNumber * theNum;
-            theNum = [NSNumber numberWithInt:[o_t4_pop_videoCodec indexOfSelectedItem]];
+            theNum = [NSNumber numberWithInt:[[o_t4_pop_videoCodec selectedItem]tag]];
             [o_userSelections setObject:@"YES" forKey:@"trnscdVideo"];
             [o_userSelections setObject:[o_t4_pop_videoBitrate titleOfSelectedItem]
                 forKey:@"trnscdVideoBitrate"];
@@ -744,7 +700,7 @@ static VLCWizard *_o_sharedInstance = nil;
         if ([o_t4_ckb_audio state] == NSOnState)
         {
             NSNumber * theNum;
-            theNum = [NSNumber numberWithInt:[o_t4_pop_audioCodec indexOfSelectedItem]];
+            theNum = [NSNumber numberWithInt:[[o_t4_pop_audioCodec selectedItem]tag]];
             [o_userSelections setObject:@"YES" forKey:@"trnscdAudio"];
             [o_userSelections setObject:[o_t4_pop_audioBitrate titleOfSelectedItem]
                 forKey:@"trnscdAudioBitrate"];
@@ -753,6 +709,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];
@@ -836,24 +795,14 @@ static VLCWizard *_o_sharedInstance = nil;
                         [o_t5_matrix_encap selectCellAtRow:5 column:0];
                     }
                 }
-                if ([[o_videoCodecs objectAtIndex:[[o_userSelections objectForKey:
-                    @"trnscdVideoCodec"] intValue]] containsObject: @"MUX_AVI"])
-                {
-                    if ([[o_audioCodecs objectAtIndex:[[o_userSelections objectForKey:
-                        @"trnscdAudioCodec"] intValue]] containsObject: @"MUX_AVI"])
-                    {
-                        [[o_t5_matrix_encap cellAtRow:6 column:0] setEnabled:YES];
-                        [o_t5_matrix_encap selectCellAtRow:6 column:0];
-                    }
-                }
                 if ([[o_videoCodecs objectAtIndex:[[o_userSelections objectForKey:
                     @"trnscdVideoCodec"] intValue]] containsObject: @"MUX_MP4"])
                 {
                     if ([[o_audioCodecs objectAtIndex:[[o_userSelections objectForKey:
                         @"trnscdAudioCodec"] intValue]] containsObject: @"MUX_MP4"])
                     {
-                        [[o_t5_matrix_encap cellAtRow:7 column:0] setEnabled:YES];
-                        [o_t5_matrix_encap selectCellAtRow:7 column:0];
+                        [[o_t5_matrix_encap cellAtRow:6 column:0] setEnabled:YES];
+                        [o_t5_matrix_encap selectCellAtRow:6 column:0];
                     }
                 }
                 if ([[o_videoCodecs objectAtIndex:[[o_userSelections objectForKey:
@@ -862,8 +811,8 @@ static VLCWizard *_o_sharedInstance = nil;
                     if ([[o_audioCodecs objectAtIndex:[[o_userSelections objectForKey:
                         @"trnscdAudioCodec"] intValue]] containsObject: @"MUX_MOV"])
                     {
-                        [[o_t5_matrix_encap cellAtRow:8 column:0] setEnabled:YES];
-                        [o_t5_matrix_encap selectCellAtRow:8 column:0];
+                        [[o_t5_matrix_encap cellAtRow:7 column:0] setEnabled:YES];
+                        [o_t5_matrix_encap selectCellAtRow:7 column:0];
                     }
                 }
                 if ([[o_videoCodecs objectAtIndex:[[o_userSelections objectForKey:
@@ -872,8 +821,8 @@ static VLCWizard *_o_sharedInstance = nil;
                     if ([[o_audioCodecs objectAtIndex:[[o_userSelections objectForKey:
                         @"trnscdAudioCodec"] intValue]] containsObject: @"MUX_WAV"])
                     {
-                        [[o_t5_matrix_encap cellAtRow:9 column:0] setEnabled:YES];
-                        [o_t5_matrix_encap selectCellAtRow:9 column:0];
+                        [[o_t5_matrix_encap cellAtRow:8 column:0] setEnabled:YES];
+                        [o_t5_matrix_encap selectCellAtRow:8 column:0];
                     }
                 }
 
@@ -919,29 +868,23 @@ static VLCWizard *_o_sharedInstance = nil;
                     [o_t5_matrix_encap selectCellAtRow:5 column:0];
                 }
                 if ([[o_audioCodecs objectAtIndex:[[o_userSelections objectForKey:
-                    @"trnscdAudioCodec"] intValue]] containsObject: @"MUX_AVI"])
+                    @"trnscdAudioCodec"] intValue]] containsObject: @"MUX_MP4"])
                 {
                     [[o_t5_matrix_encap cellAtRow:6 column:0] setEnabled:YES];
                     [o_t5_matrix_encap selectCellAtRow:6 column:0];
                 }
                 if ([[o_audioCodecs objectAtIndex:[[o_userSelections objectForKey:
-                    @"trnscdAudioCodec"] intValue]] containsObject: @"MUX_MP4"])
+                    @"trnscdAudioCodec"] intValue]] containsObject: @"MUX_MOV"])
                 {
                     [[o_t5_matrix_encap cellAtRow:7 column:0] setEnabled:YES];
                     [o_t5_matrix_encap selectCellAtRow:7 column:0];
                 }
                 if ([[o_audioCodecs objectAtIndex:[[o_userSelections objectForKey:
-                    @"trnscdAudioCodec"] intValue]] containsObject: @"MUX_MOV"])
+                    @"trnscdAudioCodec"] intValue]] containsObject: @"MUX_WAV"])
                 {
                     [[o_t5_matrix_encap cellAtRow:8 column:0] setEnabled:YES];
                     [o_t5_matrix_encap selectCellAtRow:8 column:0];
                 }
-                if ([[o_audioCodecs objectAtIndex:[[o_userSelections objectForKey:
-                    @"trnscdAudioCodec"] intValue]] containsObject: @"MUX_WAV"])
-                {
-                    [[o_t5_matrix_encap cellAtRow:9 column:0] setEnabled:YES];
-                    [o_t5_matrix_encap selectCellAtRow:9 column:0];
-                }
             }
         }
         else if ([[o_userSelections objectForKey:@"trnscdVideo"] isEqualTo: @"YES"])
@@ -987,29 +930,23 @@ static VLCWizard *_o_sharedInstance = nil;
                 [o_t5_matrix_encap selectCellAtRow:5 column:0];
             }
             if ([[o_videoCodecs objectAtIndex:[[o_userSelections objectForKey:
-                @"trnscdVideoCodec"] intValue]] containsObject: @"MUX_AVI"])
+                @"trnscdVideoCodec"] intValue]] containsObject: @"MUX_MP4"])
             {
                 [[o_t5_matrix_encap cellAtRow:6 column:0] setEnabled:YES];
                 [o_t5_matrix_encap selectCellAtRow:6 column:0];
             }
             if ([[o_videoCodecs objectAtIndex:[[o_userSelections objectForKey:
-                @"trnscdVideoCodec"] intValue]] containsObject: @"MUX_MP4"])
+                @"trnscdVideoCodec"] intValue]] containsObject: @"MUX_MOV"])
             {
                 [[o_t5_matrix_encap cellAtRow:7 column:0] setEnabled:YES];
                 [o_t5_matrix_encap selectCellAtRow:7 column:0];
             }
             if ([[o_videoCodecs objectAtIndex:[[o_userSelections objectForKey:
-                @"trnscdVideoCodec"] intValue]] containsObject: @"MUX_MOV"])
+                @"trnscdVideoCodec"] intValue]] containsObject: @"MUX_WAV"])
             {
                 [[o_t5_matrix_encap cellAtRow:8 column:0] setEnabled:YES];
                 [o_t5_matrix_encap selectCellAtRow:8 column:0];
             }
-            if ([[o_videoCodecs objectAtIndex:[[o_userSelections objectForKey:
-                @"trnscdVideoCodec"] intValue]] containsObject: @"MUX_WAV"])
-            {
-                [[o_t5_matrix_encap cellAtRow:9 column:0] setEnabled:YES];
-                [o_t5_matrix_encap selectCellAtRow:9 column:0];
-            }
         } else {
             /* we don't do any transcoding
              * -> enabled the encap-formats allowed when streaming content via
@@ -1026,11 +963,10 @@ static VLCWizard *_o_sharedInstance = nil;
             [[o_t5_matrix_encap cellAtRow:3 column:0] setEnabled:YES];
             [[o_t5_matrix_encap cellAtRow:4 column:0] setEnabled:YES];
             [[o_t5_matrix_encap cellAtRow:5 column:0] setEnabled:YES];
-            [[o_t5_matrix_encap cellAtRow:6 column:0] setEnabled:NO];
+            [[o_t5_matrix_encap cellAtRow:6 column:0] setEnabled:YES];
             [[o_t5_matrix_encap cellAtRow:7 column:0] setEnabled:YES];
-            [[o_t5_matrix_encap cellAtRow:8 column:0] setEnabled:YES];
+            [[o_t5_matrix_encap cellAtRow:8 column:0] setEnabled:NO];
             [[o_t5_matrix_encap cellAtRow:9 column:0] setEnabled:NO];
-            [[o_t5_matrix_encap cellAtRow:10 column:0] setEnabled:NO];
             [o_t5_matrix_encap selectCellAtRow:0 column:0];
         }
 
@@ -1046,9 +982,8 @@ static VLCWizard *_o_sharedInstance = nil;
             [[o_t5_matrix_encap cellAtRow:6 column:0] setEnabled:NO];
             [[o_t5_matrix_encap cellAtRow:7 column:0] setEnabled:NO];
             [[o_t5_matrix_encap cellAtRow:8 column:0] setEnabled:NO];
-            [[o_t5_matrix_encap cellAtRow:9 column:0] setEnabled:NO];
-            [[o_t5_matrix_encap cellAtRow:10 column:0] setEnabled:YES];
-            [o_t5_matrix_encap selectCellAtRow:10 column:0];
+            [[o_t5_matrix_encap cellAtRow:9 column:0] setEnabled:YES];
+            [o_t5_matrix_encap selectCellAtRow:9 column:0];
         }
         else if ( [o_userSelections objectForKey:@"stmgMhd"] == @"0" )
         {
@@ -1058,7 +993,6 @@ static VLCWizard *_o_sharedInstance = nil;
             [[o_t5_matrix_encap cellAtRow:7 column:0] setEnabled:NO];
             [[o_t5_matrix_encap cellAtRow:8 column:0] setEnabled:NO];
             [[o_t5_matrix_encap cellAtRow:9 column:0] setEnabled:NO];
-            [[o_t5_matrix_encap cellAtRow:10 column:0] setEnabled:NO];
         }
         else if ( [[o_userSelections objectForKey:@"stmgMhd"] intValue] >= 2 )
         {
@@ -1072,7 +1006,6 @@ static VLCWizard *_o_sharedInstance = nil;
             [[o_t5_matrix_encap cellAtRow:7 column:0] setEnabled:NO];
             [[o_t5_matrix_encap cellAtRow:8 column:0] setEnabled:NO];
             [[o_t5_matrix_encap cellAtRow:9 column:0] setEnabled:NO];
-            [[o_t5_matrix_encap cellAtRow:10 column:0] setEnabled:NO];
             [[o_t5_matrix_encap cellAtRow:1 column:0] setEnabled:YES];
             [o_t5_matrix_encap selectCellAtRow:1 column:0];
         }
@@ -1090,6 +1023,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 {
@@ -1213,9 +1150,9 @@ static VLCWizard *_o_sharedInstance = nil;
                     /* check whether the extension is hidden or not.
                      * if not, remove it
                      * we need the casting to make GCC4 happy */
-                    if( [[[NSFileManager defaultManager] fileAttributesAtPath:
+                    if( [[[NSFileManager defaultManager] attributesOfItemAtPath:
                         [[o_userSelections objectForKey:@"pathToStrm"]
-                        objectAtIndex: x] traverseLink: NO] objectForKey:
+                         objectAtIndex: x] error:nil] objectForKey:
                         NSFileExtensionHidden] )
                         fileNameToUse = [NSString stringWithString:
                             [[NSFileManager defaultManager] displayNameAtPath:
@@ -1297,7 +1234,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];
@@ -1307,49 +1244,55 @@ 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(
                 [[[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,
-                PLAYLIST_END, VLC_TRUE, VLC_FALSE );
+                PLAYLIST_END, true, pl_Unlocked );
 
             if( x == 0 )
             {
                 /* play the first item and add the others afterwards */
-                playlist_item_t *p_item = playlist_ItemGetByInput( p_playlist, p_input, VLC_TRUE );
-                playlist_Control( p_playlist, PLAYLIST_VIEWPLAY, VLC_TRUE, NULL,
+                PL_LOCK;
+                playlist_item_t *p_item = playlist_ItemGetByInput( p_playlist, p_input );
+                playlist_Control( p_playlist, PLAYLIST_VIEWPLAY, pl_Locked, NULL,
                           p_item );
+                PL_UNLOCK;
             }
 
+            vlc_gc_decref( p_input );
             x += 1;
         }
 
-        vlc_object_release( p_playlist );
-
         /* close the window, since we are done */
         [o_wizard_window close];
     }
@@ -1366,9 +1309,10 @@ static VLCWizard *_o_sharedInstance = nil;
     {
         [o_t4_pop_videoCodec addItemWithTitle:[[o_videoCodecs objectAtIndex:x]
             objectAtIndex:0]];
+        [[o_t4_pop_videoCodec lastItem] setTag:x];
         x += 1;
     }
-    if( b_keepSettingsOrNot && savePreviousSel >= 0 )
+    if( savePreviousSel >= 0 )
         [o_t4_pop_videoCodec selectItemAtIndex: savePreviousSel];
 
     savePreviousSel = [o_t4_pop_audioCodec indexOfSelectedItem];
@@ -1378,9 +1322,10 @@ static VLCWizard *_o_sharedInstance = nil;
     {
         [o_t4_pop_audioCodec addItemWithTitle:[[o_audioCodecs objectAtIndex:x]
             objectAtIndex:0]];
+        [[o_t4_pop_audioCodec lastItem] setTag:x];
         x += 1;
     }
-    if( b_keepSettingsOrNot && savePreviousSel >= 0 )
+    if( savePreviousSel >= 0 )
         [o_t4_pop_audioCodec selectItemAtIndex: savePreviousSel];
 }
 
@@ -1506,10 +1451,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: @","];
@@ -1534,21 +1478,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
         {
@@ -1564,31 +1507,54 @@ 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=#%@%@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=#%@%@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];
                 }
-                [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]];
             }
             else
             {
                 /* no SAP, just streaming */
-                [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]];
+                if( [[o_strmgMthds objectAtIndex: [[o_userSelections objectForKey: @"stmgMhd"] intValue]] objectAtIndex:0] == @"rtp" )
+                {
+                    /* RTP is different from the other protocols, as it isn't provided through an access out module anymore */
+                    [o_opts_string appendFormat:
+                                             @":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=#%@%@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]];
+                }
             }
         }
 
@@ -1600,8 +1566,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];
 
@@ -1670,7 +1636,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];
@@ -1713,8 +1679,7 @@ static VLCWizard *_o_sharedInstance = nil;
 {
     if (returnCode == NSOKButton)
     {
-        [o_t2_fld_pathToNewStrm setStringValue: [@"file://"
-            stringByAppendingString: [sheet filename]]];
+        [o_t2_fld_pathToNewStrm setStringValue: [[sheet URL] absoluteString]];
     }
 }
 
@@ -1811,7 +1776,7 @@ static VLCWizard *_o_sharedInstance = nil;
 {
     /* update codec info */
     [o_t4_txt_hintAudio setStringValue:[[o_audioCodecs objectAtIndex:
-        [o_t4_pop_audioCodec indexOfSelectedItem]] objectAtIndex:2]];
+        [[o_t4_pop_audioCodec selectedItem]tag]] objectAtIndex:2]];
 }
 
 - (IBAction)t4_enblAudTrnscd:(id)sender
@@ -1853,7 +1818,7 @@ static VLCWizard *_o_sharedInstance = nil;
 {
     /* update codec info */
     [o_t4_txt_hintVideo setStringValue:[[o_videoCodecs objectAtIndex:
-        [o_t4_pop_videoCodec indexOfSelectedItem]] objectAtIndex:2]];
+        [[o_t4_pop_videoCodec selectedItem]tag]] objectAtIndex:2]];
 }
 
 - (IBAction)t6_enblSapAnnce:(id)sender
@@ -1932,9 +1897,9 @@ static VLCWizard *_o_sharedInstance = nil;
         [[o_userSelections objectForKey:@"encapFormat"] intValue]]
         objectAtIndex:0];
         if( theEncapFormat != @"ps" )
-            [saveFilePanel setRequiredFileType: theEncapFormat];
+            [saveFilePanel setAllowedFileTypes: [NSArray arrayWithObject:theEncapFormat]];
         else
-            [saveFilePanel setRequiredFileType: @"mpg"];
+            [saveFilePanel setAllowedFileTypes: [NSArray arrayWithObject:@"mpg"]];
 
         [saveFilePanel setCanSelectHiddenExtension: YES];
         [saveFilePanel setCanCreateDirectories: YES];
@@ -1952,9 +1917,9 @@ static VLCWizard *_o_sharedInstance = nil;
          * selected a folder */
         if( [[o_userSelections objectForKey:@"pathToStrm"] count] > 1 )
             [o_t7_fld_filePath setStringValue: [NSString stringWithFormat:
-                @"%@/", [sheet filename]]];
+                @"%@/", [[sheet URL] path]]];
         else
-            [o_t7_fld_filePath setStringValue:[sheet filename]];
+            [o_t7_fld_filePath setStringValue:[[sheet URL] path]];
     }
     [sheet release];
 }