]> git.sesse.net Git - vlc/blobdiff - modules/gui/macosx/wizard.m
* Only allow playlist files in open playlist (Refs:#940)
[vlc] / modules / gui / macosx / wizard.m
index 8e6c66d07bfdfe66eaa58cf58f4d86f9a323bc3f..c2f3845f758bcad8fc0000244789ef86ead607e6 100644 (file)
@@ -33,9 +33,8 @@
  *****************************************************************************/
 #import "wizard.h"
 #import "intf.h"
-#import "network.h"
 #import "playlist.h"
-#import <vlc/intf.h>
+#import <vlc_interface.h>
 
 /*****************************************************************************
  * VLCWizard implementation
@@ -306,7 +305,7 @@ static VLCWizard *_o_sharedInstance = nil;
 - (void)resetWizard
 {
     /* get the current state of our setting to keep the selections or not */
-    keepSettingsOrNot = (BOOL *)config_GetInt( VLCIntf, "macosx-wizard-keep" );
+    b_keepSettingsOrNot = (BOOL)config_GetInt( VLCIntf, "macosx-wizard-keep" );
 
     /* go to the front page and clean up a bit */
     [o_userSelections removeAllObjects];
@@ -314,7 +313,7 @@ static VLCWizard *_o_sharedInstance = nil;
     [o_tab_pageHolder selectFirstTabViewItem:self];
 
     
-    if( keepSettingsOrNot )
+    if( b_keepSettingsOrNot )
         return;
     
     /* reset the wizard-window to its default values if wanted */
@@ -1198,10 +1197,10 @@ 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( (int)[[[NSFileManager defaultManager] fileAttributesAtPath: \
+                    if( [[[NSFileManager defaultManager] fileAttributesAtPath: \
                         [[o_userSelections objectForKey:@"pathToStrm"] \
                         objectAtIndex: x] traverseLink: NO] objectForKey: \
-                        NSFileExtensionHidden] == YES )
+                        NSFileExtensionHidden] )
                         fileNameToUse = [NSString stringWithString:
                             [[NSFileManager defaultManager] displayNameAtPath:
                             [[o_userSelections objectForKey:@"pathToStrm"]
@@ -1277,63 +1276,59 @@ static VLCWizard *_o_sharedInstance = nil;
     {
         intf_thread_t * p_intf = VLCIntf;
 
-        playlist_t * p_playlist = (playlist_t *)vlc_object_find( p_intf,
-                            VLC_OBJECT_PLAYLIST, FIND_ANYWHERE);
-        if( p_playlist )
+        playlist_t * p_playlist = pl_Yield( p_intf );
+
+        int x = 0;
+        int y = [[o_userSelections objectForKey:@"pathToStrm"] count];
+        while( x != y )
         {
-            int x = 0;
-            int y = [[o_userSelections objectForKey:@"pathToStrm"] count];
-            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];
+            input_item_t *p_input = input_ItemNew( p_playlist, \
+                [[[o_userSelections objectForKey:@"pathToStrm"] \
+                objectAtIndex:x] UTF8String], \
+                [tempString UTF8String] );
+            input_ItemAddOption( p_input, [[[o_userSelections \
+                objectForKey:@"opts"] objectAtIndex: x] UTF8String]);
+
+            if(! [[o_userSelections objectForKey:@"partExtractFrom"] \
+                isEqualToString:@""] )
             {
-                /* 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];
-                input_item_t *p_input = input_ItemNew( p_playlist, \
-                    [[[o_userSelections objectForKey:@"pathToStrm"] \
-                    objectAtIndex:x] UTF8String], \
-                    [tempString UTF8String] );
-                vlc_input_item_AddOption( p_input, [[[o_userSelections \
-                    objectForKey:@"opts"] objectAtIndex: x] UTF8String]);
-
-                if(! [[o_userSelections objectForKey:@"partExtractFrom"] \
-                    isEqualToString:@""] )
-                {
-                    vlc_input_item_AddOption( p_input, [[NSString \
-                        stringWithFormat: @"start-time=%@", [o_userSelections \
-                        objectForKey: @"partExtractFrom"]] UTF8String] );
-                }
-
-                if(! [[o_userSelections objectForKey:@"partExtractTo"] \
-                    isEqualToString:@""] )
-                {
-                    vlc_input_item_AddOption( p_input, [[NSString \
-                        stringWithFormat: @"stop-time=%@", [o_userSelections \
-                        objectForKey: @"partExtractTo"]] UTF8String] );
-                }
+                input_ItemAddOption( p_input, [[NSString \
+                    stringWithFormat: @"start-time=%@", [o_userSelections \
+                    objectForKey: @"partExtractFrom"]] UTF8String] );
+            }
 
-                vlc_input_item_AddOption( p_input, [[NSString stringWithFormat: \
-                    @"ttl=%@", [o_userSelections objectForKey:@"ttl"]] \
-                    UTF8String] );
+            if(! [[o_userSelections objectForKey:@"partExtractTo"] \
+                isEqualToString:@""] )
+            {
+                input_ItemAddOption( p_input, [[NSString \
+                    stringWithFormat: @"stop-time=%@", [o_userSelections \
+                    objectForKey: @"partExtractTo"]] UTF8String] );
+            }
 
-                playlist_PlaylistAddInput( p_playlist, p_input, PLAYLIST_STOP, PLAYLIST_END );
+            input_ItemAddOption( p_input, [[NSString stringWithFormat: \
+                @"ttl=%@", [o_userSelections objectForKey:@"ttl"]] \
+                UTF8String] );
 
-                if( x == 0 )
-                {
-                    /* play the first item and add the others afterwards */
-                    playlist_item_t *p_item = playlist_ItemGetByInput( p_playlist, p_input );
-                    playlist_Control( p_playlist, PLAYLIST_VIEWPLAY, NULL,
-                                     p_item );
-                }
+            playlist_AddInput( p_playlist, p_input, PLAYLIST_STOP, 
+                       PLAYLIST_END, VLC_TRUE );
 
-                x += 1;
+            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,
+                          p_item );
             }
 
-            vlc_object_release(p_playlist);
-        } else {
-            msg_Err( p_intf, "unable to find playlist" );
+            x += 1;
         }
 
+        vlc_object_release( p_playlist );
+
         /* close the window, since we are done */
         [o_wizard_window close];
     }
@@ -1352,7 +1347,7 @@ static VLCWizard *_o_sharedInstance = nil;
             objectAtIndex:0]];
         x += 1;
     }
-    if( keepSettingsOrNot && savePreviousSel >= 0 )
+    if( b_keepSettingsOrNot && savePreviousSel >= 0 )
         [o_t4_pop_videoCodec selectItemAtIndex: savePreviousSel];
 
     savePreviousSel = [o_t4_pop_audioCodec indexOfSelectedItem];
@@ -1364,7 +1359,7 @@ static VLCWizard *_o_sharedInstance = nil;
             objectAtIndex:0]];
         x += 1;
     }
-    if( keepSettingsOrNot && savePreviousSel >= 0 )
+    if( b_keepSettingsOrNot && savePreviousSel >= 0 )
         [o_t4_pop_audioCodec selectItemAtIndex: savePreviousSel];
 }