Changeset 966feba166c6a6abe77fc2660da9da4549b4d104
- 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
| r65892ac |
r966feba |
|
| 477 | 477 | var_SetInteger( p_playlist, "activity", i_activity + |
|---|
| 478 | 478 | DEFAULT_INPUT_ACTIVITY ); |
|---|
| 479 | | p_playlist->p_input = |
|---|
| | 479 | |
|---|
| | 480 | input_thread_t * p_input_thread = |
|---|
| 480 | 481 | 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 | |
|---|
| 481 | 485 | *pp_sout = NULL; |
|---|
| 482 | 486 | |
|---|
| rbd054d3 |
r966feba |
|
| 40 | 40 | static void VariablesInit( playlist_t *p_playlist ); |
|---|
| 41 | 41 | static void playlist_Destructor( vlc_object_t * p_this ); |
|---|
| | 42 | static void playlist_Destructor( vlc_object_t * p_this ); |
|---|
| 42 | 43 | |
|---|
| 43 | 44 | static int RandomCallback( vlc_object_t *p_this, char const *psz_cmd, |
|---|
| … | … | |
| 245 | 246 | |
|---|
| 246 | 247 | p_input = p_playlist->p_input; |
|---|
| 247 | | p_playlist->p_input = NULL; |
|---|
| | 248 | |
|---|
| 248 | 249 | assert( *pp_sout == NULL ); |
|---|
| 249 | 250 | if( var_CreateGetBool( p_input, "sout-keep" ) ) |
|---|
| 250 | 251 | *pp_sout = input_DetachSout( p_input ); |
|---|
| 251 | 252 | |
|---|
| 252 | | /* Release the playlist lock, because we may get stuck |
|---|
| 253 | | * in vlc_object_release() for some time. */ |
|---|
| 254 | | PL_UNLOCK; |
|---|
| 255 | | |
|---|
| 256 | 253 | /* Destroy input */ |
|---|
| 257 | | vlc_object_release( p_input ); |
|---|
| 258 | | |
|---|
| 259 | | PL_LOCK; |
|---|
| | 254 | playlist_release_current_input( p_playlist ); |
|---|
| 260 | 255 | |
|---|
| 261 | 256 | p_playlist->gc_date = mdate(); |
|---|
| … | … | |
| 276 | 271 | var_SetInteger( p_playlist, "activity", i_activity - |
|---|
| 277 | 272 | DEFAULT_INPUT_ACTIVITY ); |
|---|
| | 273 | |
|---|
| 278 | 274 | goto check_input; |
|---|
| 279 | 275 | } |
|---|
| … | … | |
| 379 | 375 | if( p_playlist->p_input->b_dead ) |
|---|
| 380 | 376 | { |
|---|
| 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 ); |
|---|
| 387 | 379 | |
|---|
| 388 | 380 | /* sout-keep: no need to anything here. |
|---|
| 389 | 381 | * The last input will destroy its sout, if any, by itself */ |
|---|
| 390 | 382 | |
|---|
| 391 | | /* Destroy input */ |
|---|
| 392 | | vlc_object_release( p_input ); |
|---|
| | 383 | PL_UNLOCK; |
|---|
| 393 | 384 | continue; |
|---|
| 394 | 385 | } |
|---|
| rbc35aea |
r966feba |
|
| 36 | 36 | |
|---|
| 37 | 37 | #include "input/input_internal.h" |
|---|
| | 38 | #include <assert.h> |
|---|
| 38 | 39 | |
|---|
| 39 | 40 | struct playlist_preparse_t |
|---|
| … | … | |
| 110 | 111 | int playlist_ItemDelete ( playlist_item_t * ); |
|---|
| 111 | 112 | |
|---|
| | 113 | static 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 | |
|---|
| | 129 | static 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 | |
|---|
| 112 | 144 | /** |
|---|
| 113 | 145 | * @} |
|---|