]> git.sesse.net Git - vlc/commitdiff
We use setRepresentedFilename if access is File.
authorJérome Decoodt <djc@videolan.org>
Tue, 22 Feb 2005 17:27:04 +0000 (17:27 +0000)
committerJérome Decoodt <djc@videolan.org>
Tue, 22 Feb 2005 17:27:04 +0000 (17:27 +0000)
Title is found in input instead of playlist (fix a small vlm bug...).

modules/gui/macosx/vout.m

index 5813dcb9ddd2cbd51035c9d795b006e8d7980fc5..684eae391e5843a0c1e08fb1e7b5b3f77767a503 100644 (file)
 
 - (void)updateTitle
 {
-    NSMutableString * o_title;
-    playlist_t * p_playlist;
+    NSMutableString * o_title,* o_mrl;
+    vlc_bool_t b_file = VLC_FALSE;
+    input_thread_t * p_input;
     
     if( p_vout == NULL )
     {
         return;
     }
     
-    p_playlist = vlc_object_find( p_vout, VLC_OBJECT_PLAYLIST,
-                                                FIND_ANYWHERE );
+    p_input = vlc_object_find( p_vout, VLC_OBJECT_INPUT,
+                                                FIND_PARENT );
     
-    if( p_playlist == NULL )
+    if( p_input == NULL )
     {
         return;
     }
 
-    vlc_mutex_lock( &p_playlist->object_lock );
-    o_title = [NSMutableString stringWithUTF8String: 
-        p_playlist->status.p_item->input.psz_uri]; 
-    vlc_mutex_unlock( &p_playlist->object_lock );
-    vlc_object_release( p_playlist );
+    if( ! strcmp( p_input->input.p_access->p_module->psz_shortname, "File" ) )
+        b_file = VLC_TRUE;
+    if( p_input->input.p_item->psz_name != NULL )
+        o_title = [NSMutableString stringWithUTF8String:
+            p_input->input.p_item->psz_name];
+    if( p_input->input.p_item->psz_uri != NULL )
+        o_mrl = [NSMutableString stringWithUTF8String:
+            p_input->input.p_item->psz_uri];
+    if( o_title == nil )
+        o_title = o_mrl;
 
-    if( o_title != nil )
+    vlc_object_release( p_input );
+    if( o_mrl != nil )
     {
-        NSRange prefix_range = [o_title rangeOfString: @"file:"];
-        if( prefix_range.location != NSNotFound )
+        if( b_file == VLC_TRUE )
         {
-            [o_title deleteCharactersInRange: prefix_range];
-            [self setTitleWithRepresentedFilename: o_title];
+            NSRange prefix_range = [o_mrl rangeOfString: @"file:"];
+            if( prefix_range.location != NSNotFound )
+                [o_mrl deleteCharactersInRange: prefix_range];
+            [self setRepresentedFilename: o_mrl];
         }
-            [self setTitle: o_title];
+        [self setTitle: o_title];
     }
     else
     {