[vlc-commits] macosx: when opening subtitles while playing a movie, try to add them to the clip instead of the playlist

Felix Paul Kühne git at videolan.org
Thu Feb 16 19:54:29 CET 2012


vlc/vlc-2.0 | branch: master | Felix Paul Kühne <fkuehne at videolan.org> | Thu Feb 16 19:53:36 2012 +0100| [3eba0ea3315a70d3df3ff97a8ddc546fbd7207b2] | committer: Felix Paul Kühne

macosx: when opening subtitles while playing a movie, try to add them to the clip instead of the playlist
(cherry picked from commit 6a6539f95f99f9cdebbce39fb7fb80b9efa91804)

> http://git.videolan.org/gitweb.cgi/vlc/vlc-2.0.git/?a=commit;h=3eba0ea3315a70d3df3ff97a8ddc546fbd7207b2
---

 modules/gui/macosx/intf.m     |   16 ++++++++++++++++
 modules/gui/macosx/misc.m     |   26 ++++++++++++++++++++++++++
 modules/gui/macosx/playlist.m |   14 ++++++++++++++
 3 files changed, 56 insertions(+), 0 deletions(-)

diff --git a/modules/gui/macosx/intf.m b/modules/gui/macosx/intf.m
index 4dc37d7..b635111 100644
--- a/modules/gui/macosx/intf.m
+++ b/modules/gui/macosx/intf.m
@@ -870,6 +870,22 @@ static VLCMain *_o_sharedMainInstance = nil;
     if( !psz_uri )
         return( FALSE );
 
+    input_thread_t * p_input = pl_CurrentInput( VLCIntf );
+    BOOL b_returned = NO;
+
+    if (p_input)
+    {
+        b_returned = input_AddSubtitle( p_input, psz_uri, true );
+        vlc_object_release( p_input );
+        if(!b_returned)
+        {
+            free( psz_uri );
+            return YES;
+        }
+    }
+    else if( p_input )
+        vlc_object_release( p_input );
+
     NSDictionary *o_dic = [NSDictionary dictionaryWithObject:[NSString stringWithCString:psz_uri encoding:NSUTF8StringEncoding] forKey:@"ITEM_URL"];
 
     free( psz_uri );
diff --git a/modules/gui/macosx/misc.m b/modules/gui/macosx/misc.m
index d1211c9..5ad6792 100644
--- a/modules/gui/macosx/misc.m
+++ b/modules/gui/macosx/misc.m
@@ -425,6 +425,19 @@ static NSMutableArray *blackoutWindows = NULL;
             NSArray *o_values = [[o_paste propertyListForType: NSFilenamesPboardType] sortedArrayUsingSelector:@selector(caseInsensitiveCompare:)];
             NSUInteger count = [o_values count];
 
+            input_thread_t * p_input = pl_CurrentInput( VLCIntf );
+            BOOL b_returned = NO;
+
+            if (count == 1 && p_input)
+            {
+                b_returned = input_AddSubtitle( p_input, make_URI([[o_values objectAtIndex:0] UTF8String], NULL), true );
+                vlc_object_release( p_input );
+                if(!b_returned)
+                    return YES;
+            }
+            else if( p_input )
+                vlc_object_release( p_input );
+
             for( NSUInteger i = 0; i < count; i++)
             {
                 NSDictionary *o_dic;
@@ -512,6 +525,19 @@ static NSMutableArray *blackoutWindows = NULL;
             NSArray *o_values = [[o_paste propertyListForType: NSFilenamesPboardType] sortedArrayUsingSelector:@selector(caseInsensitiveCompare:)];
             NSUInteger count = [o_values count];
 
+            input_thread_t * p_input = pl_CurrentInput( VLCIntf );
+            BOOL b_returned = NO;
+
+            if (count == 1 && p_input)
+            {
+                b_returned = input_AddSubtitle( p_input, make_URI([[o_values objectAtIndex:0] UTF8String], NULL), true );
+                vlc_object_release( p_input );
+                if(!b_returned)
+                    return YES;
+            }
+            else if( p_input )
+                vlc_object_release( p_input );
+
             for( NSUInteger i = 0; i < count; i++)
             {
                 NSDictionary *o_dic;
diff --git a/modules/gui/macosx/playlist.m b/modules/gui/macosx/playlist.m
index 86f45ac..b095bd7 100644
--- a/modules/gui/macosx/playlist.m
+++ b/modules/gui/macosx/playlist.m
@@ -1542,6 +1542,7 @@
 
 - (BOOL)outlineView:(NSOutlineView *)outlineView acceptDrop:(id <NSDraggingInfo>)info item:(id)item childIndex:(NSInteger)index
 {
+    NSLog( @"- (BOOL)outlineView:(NSOutlineView *)outlineView acceptDrop:(id <NSDraggingInfo>)info item:(id)item childIndex:(NSInteger)index" );
     playlist_t * p_playlist =  pl_Get( VLCIntf );
     NSPasteboard *o_pasteboard = [info draggingPasteboard];
 
@@ -1629,12 +1630,25 @@
 
     else if( [[o_pasteboard types] containsObject: NSFilenamesPboardType] )
     {
+        NSLog( @"NSFilenamesPboardType" );
         playlist_item_t *p_node = [item pointerValue];
 
         NSArray *o_values = [[o_pasteboard propertyListForType: NSFilenamesPboardType]
                                 sortedArrayUsingSelector: @selector(caseInsensitiveCompare:)];
         NSUInteger count = [o_values count];
         NSMutableArray *o_array = [NSMutableArray arrayWithCapacity:count];
+        input_thread_t * p_input = pl_CurrentInput( VLCIntf );
+        BOOL b_returned = NO;
+
+        if (count == 1 && p_input)
+        {
+            b_returned = input_AddSubtitle( p_input, make_URI([[o_values objectAtIndex:0] UTF8String], NULL), true );
+            vlc_object_release( p_input );
+            if(!b_returned)
+                return YES;
+        }
+        else if( p_input )
+            vlc_object_release( p_input );
 
         for( NSUInteger i = 0; i < count; i++)
         {



More information about the vlc-commits mailing list