- vlc_object_attach( p_playlist->p_preparse, p_playlist );
- if( vlc_thread_create( p_playlist->p_preparse, "preparser",
- RunPreparse, VLC_THREAD_PRIORITY_LOW, VLC_TRUE ) )
- {
- msg_Err( p_playlist, "cannot spawn preparse thread" );
- vlc_object_detach( p_playlist->p_preparse );
- vlc_object_destroy( p_playlist->p_preparse );
- return;
- }
+ vlc_join( p_sys->thread, NULL );
+ assert( !p_sys->p_input );
+
+ /* release input resources */
+ if( p_sys->p_input_resource )
+ input_resource_Delete( p_sys->p_input_resource );
+ p_sys->p_input_resource = NULL;
+
+ if( var_InheritBool( p_playlist, "media-library" ) )
+ playlist_MLDump( p_playlist );
+
+ PL_LOCK;
+
+ /* Release the current node */
+ set_current_status_node( p_playlist, NULL );
+
+ /* Release the current item */
+ set_current_status_item( p_playlist, NULL );
+
+ PL_UNLOCK;
+
+ msg_Dbg( p_playlist, "Deactivated" );
+}
+
+/* */
+
+/* Input Callback */
+static int InputEvent( vlc_object_t *p_this, char const *psz_cmd,
+ vlc_value_t oldval, vlc_value_t newval, void *p_data )
+{
+ VLC_UNUSED(p_this); VLC_UNUSED(psz_cmd); VLC_UNUSED(oldval);
+ playlist_t *p_playlist = p_data;
+
+ if( newval.i_int != INPUT_EVENT_STATE &&
+ newval.i_int != INPUT_EVENT_DEAD )
+ return VLC_SUCCESS;
+
+ PL_LOCK;
+
+ /* XXX: signaling while not changing any parameter... suspicious... */
+ vlc_cond_signal( &pl_priv(p_playlist)->signal );
+
+ PL_UNLOCK;
+ return VLC_SUCCESS;
+}
+
+static void UpdateActivity( playlist_t *p_playlist, int i_delta )
+{
+ PL_ASSERT_LOCKED;
+
+ const int i_activity = var_GetInteger( p_playlist, "activity" ) ;
+ var_SetInteger( p_playlist, "activity", i_activity + i_delta );
+}
+
+/**
+ * Synchronise the current index of the playlist
+ * to match the index of the current item.
+ *
+ * \param p_playlist the playlist structure
+ * \param p_cur the current playlist item
+ * \return nothing
+ */
+static void ResyncCurrentIndex( playlist_t *p_playlist, playlist_item_t *p_cur )
+{
+ PL_ASSERT_LOCKED;