]> git.sesse.net Git - vlc/blobdiff - lib/media_player.c
macosx: video effects panel: synchronize text field and stepper values properly by...
[vlc] / lib / media_player.c
index a41b8c7cc764a424456a967277089999735e13c2..0ac48968cc3784137acaf010cca9e4bd6f985957 100644 (file)
@@ -357,13 +357,6 @@ static int snapshot_was_taken(vlc_object_t *p_this, char const *psz_cmd,
     return VLC_SUCCESS;
 }
 
-static input_thread_t *find_input (vlc_object_t *obj)
-{
-    libvlc_media_player_t *mp = (libvlc_media_player_t *)obj;
-
-    return libvlc_get_input_thread (mp);
-}
-
 /* */
 static void libvlc_media_player_destroy( libvlc_media_player_t * );
 
@@ -466,8 +459,6 @@ libvlc_media_player_new( libvlc_instance_t *instance )
     var_Create (mp, "aout", VLC_VAR_STRING | VLC_VAR_DOINHERIT);
     var_Create (mp, "mute", VLC_VAR_BOOL);
     var_Create (mp, "volume", VLC_VAR_FLOAT);
-    var_Create (mp, "find-input-callback", VLC_VAR_ADDRESS);
-    var_SetAddress (mp, "find-input-callback", find_input);
     var_Create (mp, "corks", VLC_VAR_INTEGER);
     var_Create (mp, "amem-data", VLC_VAR_ADDRESS);
     var_Create (mp, "amem-setup", VLC_VAR_ADDRESS);
@@ -486,12 +477,18 @@ libvlc_media_player_new( libvlc_instance_t *instance )
     mp->state = libvlc_NothingSpecial;
     mp->p_libvlc_instance = instance;
     mp->input.p_thread = NULL;
-    mp->input.p_resource = NULL;
+    mp->input.p_resource = input_resource_New(VLC_OBJECT(mp));
+    if (unlikely(mp->input.p_resource == NULL))
+    {
+        vlc_object_release(mp);
+        return NULL;
+    }
     vlc_mutex_init (&mp->input.lock);
     mp->i_refcount = 1;
     mp->p_event_manager = libvlc_event_manager_new(mp, instance);
     if (unlikely(mp->p_event_manager == NULL))
     {
+        input_resource_Release(mp->input.p_resource);
         vlc_object_release(mp);
         return NULL;
     }
@@ -569,12 +566,8 @@ static void libvlc_media_player_destroy( libvlc_media_player_t *p_mi )
     /* No need for lock_input() because no other threads knows us anymore */
     if( p_mi->input.p_thread )
         release_input_thread(p_mi, true);
-    if( p_mi->input.p_resource )
-    {
-        input_resource_Terminate( p_mi->input.p_resource );
-        input_resource_Release( p_mi->input.p_resource );
-        p_mi->input.p_resource = NULL;
-    }
+    input_resource_Terminate( p_mi->input.p_resource );
+    input_resource_Release( p_mi->input.p_resource );
     vlc_mutex_destroy( &p_mi->input.lock );
 
     libvlc_event_manager_release( p_mi->p_event_manager );
@@ -718,8 +711,6 @@ int libvlc_media_player_play( libvlc_media_player_t *p_mi )
         return -1;
     }
 
-    if( !p_mi->input.p_resource )
-        p_mi->input.p_resource = input_resource_New( VLC_OBJECT( p_mi ) );
     p_input_thread = input_Create( p_mi, p_mi->p_md->p_input_item, NULL,
                                    p_mi->input.p_resource );
     unlock(p_mi);
@@ -819,8 +810,7 @@ void libvlc_media_player_stop( libvlc_media_player_t *p_mi )
         libvlc_event_send( p_mi->p_event_manager, &event );
     }
 
-    if( p_mi->input.p_resource != NULL )
-        input_resource_Terminate( p_mi->input.p_resource );
+    input_resource_Terminate( p_mi->input.p_resource );
     unlock_input(p_mi);
 }
 
@@ -1240,7 +1230,7 @@ int libvlc_media_player_will_play( libvlc_media_player_t *p_mi )
     if ( !p_input_thread )
         return false;
 
-    b_will_play = !p_input_thread->b_die && !p_input_thread->b_dead;
+    b_will_play = !p_input_thread->b_dead;
     vlc_object_release( p_input_thread );
 
     return b_will_play;