osx-wizard: fixed a couple of UTF8-bugs which prevented the proper naming of non...
authorFelix Paul Kühne <fkuehne@videolan.org>
Sun, 28 Dec 2008 23:03:00 +0000 (00:03 +0100)
committerFelix Paul Kühne <fkuehne@videolan.org>
Sun, 28 Dec 2008 23:03:14 +0000 (00:03 +0100)
additionally, the wizard now remembers the last selected encap format correctly

modules/gui/macosx/wizard.m

index 5deea00..f0f3cb0 100644 (file)
@@ -1,7 +1,7 @@
 /*****************************************************************************
  * wizard.m: MacOS X Streaming Wizard
  *****************************************************************************
- * Copyright (C) 2005-2007 the VideoLAN team
+ * Copyright (C) 2005-2008 the VideoLAN team
  * $Id$
  *
  * Authors: Felix Kühne <fkuehne@users.sf.net>
@@ -559,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;
                     }
@@ -713,6 +712,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];
@@ -1050,6 +1052,9 @@ static VLCWizard *_o_sharedInstance = nil;
         }
         if (anythingEnabled == YES)
         {
+            /* re-select the previously chosen item, if available */
+            [o_t5_matrix_encap selectCellWithTag: i_temp];
+
             /* go the encap-tab */
             [o_tab_pageHolder selectTabViewItemAtIndex:4];
         } else {
@@ -1470,10 +1475,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: @","];
@@ -1498,21 +1502,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
         {
@@ -1528,31 +1531,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
@@ -1562,24 +1562,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]];
                 }
             }
         }