Changeset 966feba166c6a6abe77fc2660da9da4549b4d104

Show
Ignore:
Timestamp:
06/14/08 15:03:15 (3 months ago)
Author:
Pierre d'Herbemont <pdherbemont@videolan.org>
git-committer:
Pierre d'Herbemont <pdherbemont@videolan.org> 1213448595 +0200
git-parent:

[c75d563f2fb190ba3cbd8ff7137c01cf05f0d84d]

git-author:
Pierre d'Herbemont <pdherbemont@videolan.org> 1213448595 +0200
Message:

playlist: Use a set/release accessor for playlist->p_input.

(To better track when to attach/detach events).

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • src/playlist/control.c

    r65892ac r966feba  
    477477    var_SetInteger( p_playlist, "activity", i_activity + 
    478478                    DEFAULT_INPUT_ACTIVITY ); 
    479     p_playlist->p_input = 
     479 
     480    input_thread_t * p_input_thread = 
    480481        input_CreateThreadExtended( p_playlist, p_input, NULL, *pp_sout ); 
     482    playlist_set_current_input( p_playlist, p_input_thread ); 
     483    vlc_object_release( p_input_thread ); 
     484 
    481485    *pp_sout = NULL; 
    482486 
  • src/playlist/engine.c

    rbd054d3 r966feba  
    4040static void VariablesInit( playlist_t *p_playlist ); 
    4141static void playlist_Destructor( vlc_object_t * p_this ); 
     42static void playlist_Destructor( vlc_object_t * p_this ); 
    4243 
    4344static int RandomCallback( vlc_object_t *p_this, char const *psz_cmd, 
     
    245246 
    246247            p_input = p_playlist->p_input; 
    247             p_playlist->p_input = NULL; 
     248 
    248249            assert( *pp_sout == NULL ); 
    249250            if( var_CreateGetBool( p_input, "sout-keep" ) ) 
    250251                *pp_sout = input_DetachSout( p_input ); 
    251252 
    252             /* Release the playlist lock, because we may get stuck 
    253              * in vlc_object_release() for some time. */ 
    254             PL_UNLOCK; 
    255  
    256253            /* Destroy input */ 
    257             vlc_object_release( p_input ); 
    258  
    259             PL_LOCK; 
     254            playlist_release_current_input( p_playlist ); 
    260255 
    261256            p_playlist->gc_date = mdate(); 
     
    276271            var_SetInteger( p_playlist, "activity", i_activity - 
    277272                            DEFAULT_INPUT_ACTIVITY ); 
     273 
    278274            goto check_input; 
    279275        } 
     
    379375        if( p_playlist->p_input->b_dead ) 
    380376        { 
    381             input_thread_t *p_input; 
    382  
    383             /* Unlink current input */ 
    384             p_input = p_playlist->p_input; 
    385             p_playlist->p_input = NULL; 
    386             PL_UNLOCK; 
     377            /* remove input */ 
     378            playlist_release_current_input( p_playlist ); 
    387379 
    388380            /* sout-keep: no need to anything here. 
    389381             * The last input will destroy its sout, if any, by itself */ 
    390382 
    391             /* Destroy input */ 
    392             vlc_object_release( p_input ); 
     383            PL_UNLOCK; 
    393384            continue; 
    394385        } 
  • src/playlist/playlist_internal.h

    rbc35aea r966feba  
    3636 
    3737#include "input/input_internal.h" 
     38#include <assert.h> 
    3839 
    3940struct playlist_preparse_t 
     
    110111int playlist_ItemDelete ( playlist_item_t * ); 
    111112 
     113static inline void playlist_release_current_input( playlist_t * p_playlist ) 
     114{ 
     115    vlc_assert_locked( &p_playlist->object_lock ); 
     116 
     117    if( !p_playlist->p_input ) return; 
     118 
     119    input_thread_t * p_input = p_playlist->p_input; 
     120    p_playlist->p_input = NULL; 
     121 
     122    /* Release the playlist lock, because we may get stuck 
     123     * in vlc_object_release() for some time. */ 
     124    PL_UNLOCK; 
     125    vlc_object_release( p_input ); 
     126    PL_LOCK; 
     127} 
     128 
     129static inline void playlist_set_current_input( 
     130    playlist_t * p_playlist, input_thread_t * p_input ) 
     131{ 
     132    vlc_assert_locked( &p_playlist->object_lock ); 
     133 
     134    playlist_release_current_input( p_playlist ); 
     135 
     136    if( p_input ) 
     137    { 
     138        vlc_object_yield( p_input ); 
     139        p_playlist->p_input = p_input; 
     140    } 
     141} 
     142 
     143 
    112144/** 
    113145 * @}