Changeset 673861da5ce8bfeb0a4adbd5be95aa5fd2da9e4b
- Timestamp:
- 12/11/06 00:37:25 (2 years ago)
- git-parent:
- Files:
-
- include/vlc_input.h (modified) (1 diff)
- include/vlc_playlist.h (modified) (7 diffs)
- include/vlc_symbols.h (modified) (11 diffs)
- modules/access/cdda.c (modified) (1 diff)
- modules/access/directory.c (modified) (5 diffs)
- modules/access/mms/mmsh.c (modified) (1 diff)
- modules/codec/cmml/intf.c (modified) (1 diff)
- modules/control/http/macro.c (modified) (1 diff)
- modules/control/http/rpn.c (modified) (1 diff)
- modules/control/rc.c (modified) (2 diffs)
- modules/demux/mp4/mp4.c (modified) (1 diff)
- modules/demux/playlist/asx.c (modified) (3 diffs)
- modules/demux/playlist/b4s.c (modified) (2 diffs)
- modules/demux/playlist/dvb.c (modified) (2 diffs)
- modules/demux/playlist/gvp.c (modified) (4 diffs)
- modules/demux/playlist/m3u.c (modified) (4 diffs)
- modules/demux/playlist/playlist.c (modified) (1 diff)
- modules/demux/playlist/playlist.h (modified) (2 diffs)
- modules/demux/playlist/pls.c (modified) (3 diffs)
- modules/demux/playlist/podcast.c (modified) (2 diffs)
- modules/demux/playlist/qtl.c (modified) (4 diffs)
- modules/demux/playlist/sgimb.c (modified) (1 diff)
- modules/demux/playlist/shoutcast.c (modified) (4 diffs)
- modules/demux/playlist/xspf.c (modified) (4 diffs)
- modules/gui/beos/InterfaceWindow.cpp (modified) (2 diffs)
- modules/gui/macosx/applescript.m (modified) (1 diff)
- modules/gui/macosx/playlist.m (modified) (1 diff)
- modules/gui/macosx/wizard.m (modified) (1 diff)
- modules/gui/qt4/dialogs/playlist.cpp (modified) (1 diff)
- modules/gui/qt4/dialogs_provider.cpp (modified) (6 diffs)
- modules/gui/qt4/main_interface.cpp (modified) (1 diff)
- modules/gui/skins2/commands/cmd_add_item.cpp (modified) (1 diff)
- modules/gui/skins2/commands/cmd_playlist.cpp (modified) (1 diff)
- modules/gui/wxwidgets/dialogs.cpp (modified) (2 diffs)
- modules/gui/wxwidgets/dialogs/open.cpp (modified) (1 diff)
- modules/gui/wxwidgets/dialogs/playlist.cpp (modified) (1 diff)
- modules/gui/wxwidgets/dialogs/wizard.cpp (modified) (1 diff)
- modules/gui/wxwidgets/interface.cpp (modified) (1 diff)
- modules/meta_engine/taglib.cpp (modified) (1 diff)
- src/libvlc.c (modified) (2 diffs)
- src/misc/win32_specific.c (modified) (1 diff)
- src/playlist/item.c (modified) (5 diffs)
- src/playlist/loadsave.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
include/vlc_input.h
rfad2848 r673861d 28 28 29 29 #include <vlc_es.h> 30 #include <vlc_playlist.h>31 30 #include <vlc_meta.h> 32 31 include/vlc_playlist.h
r717e0b6 r673861d 26 26 27 27 #include <assert.h> 28 #include <vlc_input.h> 29 #include <stdio.h> 30 #include <stdlib.h> 28 31 29 32 TYPEDEF_ARRAY(playlist_item_t*, playlist_item_array_t); … … 74 77 #define PLAYLIST_EXPANDED_FLAG 0x0020 /**< Expanded node */ 75 78 76 /** 77 * Playlist status 78 */ 79 /** Playlist status */ 79 80 typedef enum 80 81 { PLAYLIST_STOPPED,PLAYLIST_RUNNING,PLAYLIST_PAUSED } playlist_status_t; … … 96 97 { 97 98 VLC_COMMON_MEMBERS 98 /**99 \name playlist_t100 These members are uniq to playlist_t101 */102 /*@{*/103 99 int i_enabled; /**< How many items are enabled ? */ 104 100 … … 173 169 input_thread_t *p_stats_computer; 174 170 global_stats_t *p_stats; /**< Global statistics */ 175 /*@}*/ 176 }; 177 178 /* Helper to add an item */ 171 }; 172 173 /** Helper to add an item */ 179 174 struct playlist_add_t 180 175 { … … 251 246 252 247 /* Load/Save */ 253 VLC_EXPORT( int, playlist_Import, ( playlist_t *, const char *, playlist_item_t *, vlc_bool_t ) );254 248 VLC_EXPORT( int, playlist_Export, ( playlist_t *, const char *, playlist_item_t *, const char * ) ); 255 249 … … 297 291 VLC_EXPORT( void, playlist_NodeAddItem, ( playlist_t *, playlist_item_t *, playlist_item_t *,int , int ) ); 298 292 VLC_EXPORT( int, playlist_BothAddInput, ( playlist_t *, input_item_t *,playlist_item_t *,int , int ) ); 299 VLC_EXPORT( void, playlist_AddWhereverNeeded, (playlist_t* , input_item_t*, playlist_item_t*,playlist_item_t*,vlc_bool_t, int ) );300 301 /** Add a MRL into the playlist.302 * \see playlist_Add303 */304 static inline int playlist_PlaylistAdd( playlist_t *p_playlist,305 const char *psz_uri, const char *psz_name,306 int i_mode, int i_pos )307 {308 return playlist_Add( p_playlist, psz_uri, psz_name, i_mode, i_pos,309 VLC_TRUE);310 }311 312 /** Add a MRL to the media library313 * \see playlist_Add314 */315 static inline int playlist_MLAdd( playlist_t *p_playlist, const char *psz_uri,316 const char *psz_name, int i_mode, int i_pos )317 {318 return playlist_Add( p_playlist, psz_uri, psz_name, i_mode, i_pos,319 VLC_FALSE );320 }321 322 /** Add a MRL to the playlist, with duration and options given323 * \see playlist_AddExt324 */325 static inline int playlist_PlaylistAddExt( playlist_t *p_playlist,326 const char * psz_uri, const char *psz_name, int i_mode, int i_pos,327 mtime_t i_duration, const char **ppsz_options, int i_options )328 {329 return playlist_AddExt( p_playlist, psz_uri, psz_name, i_mode, i_pos,330 i_duration, ppsz_options, i_options, VLC_TRUE );331 }332 333 /** Add a MRL to the media library, with duration and options given334 * \see playlist_AddExt335 */336 static inline int playlist_MLAddExt( playlist_t *p_playlist,337 const char * psz_uri, const char *psz_name, int i_mode, int i_pos,338 mtime_t i_duration, const char **ppsz_options, int i_options )339 {340 return playlist_AddExt( p_playlist, psz_uri, psz_name, i_mode, i_pos,341 i_duration, ppsz_options, i_options, VLC_FALSE );342 }343 344 /** Add an input item to the playlist node345 * \see playlist_AddInput346 */347 static inline int playlist_PlaylistAddInput( playlist_t* p_playlist,348 input_item_t *p_input, int i_mode, int i_pos )349 {350 return playlist_AddInput( p_playlist, p_input, i_mode, i_pos, VLC_TRUE );351 }352 353 /** Add an input item to the media library354 * \see playlist_AddInput355 */356 static inline int playlist_MLAddInput( playlist_t* p_playlist,357 input_item_t *p_input, int i_mode, int i_pos )358 {359 return playlist_AddInput( p_playlist, p_input, i_mode, i_pos, VLC_FALSE );360 }361 293 362 294 /********************** Misc item operations **********************/ … … 414 346 * Inline functions 415 347 ***********************************************************************/ 348 /** Open a playlist file, add its content to the current playlist */ 349 static inline int playlist_Import( playlist_t *p_playlist, const char *psz_file){ 350 char psz_uri[256+10]; 351 input_item_t *p_input; 352 snprintf( psz_uri, 256+9, "file/://%s", psz_file ); 353 p_input = input_ItemNewExt( p_playlist, psz_uri, psz_file, 0, NULL, -1 ); 354 playlist_AddInput( p_playlist, p_input, PLAYLIST_APPEND, PLAYLIST_END, 355 VLC_TRUE ); 356 input_Read( p_playlist, p_input, VLC_TRUE ); 357 return VLC_SUCCESS; 358 } 416 359 417 360 /** Tell if the playlist is currently running */ 418 static inline vlc_bool_t playlist_IsPlaying( playlist_t * p_playlist ) 419 { 420 vlc_bool_t b_playing; 421 vlc_mutex_lock( &p_playlist->object_lock ); 422 b_playing = p_playlist->status.i_status == PLAYLIST_RUNNING; 423 vlc_mutex_unlock( &p_playlist->object_lock ); 424 return( b_playing ); 425 } 361 #define playlist_IsPlaying( pl ) ( pl->status.i_status == PLAYLIST_RUNNING ) 426 362 427 363 /** Tell if the playlist is empty */ 428 static inline vlc_bool_t playlist_IsEmpty( playlist_t * p_playlist ) 429 { 430 vlc_bool_t b_empty; 431 vlc_mutex_lock( &p_playlist->object_lock ); 432 b_empty = p_playlist->items.i_size == 0; 433 vlc_mutex_unlock( &p_playlist->object_lock ); 434 return( b_empty ); 435 } 364 #define playlist_IsEmpty( pl ) ( pl->items.i_size == 0 ) 436 365 437 366 /** Tell the number of items in the current playing context */ 438 static inline int playlist_CurrentSize( vlc_object_t *p_this ) 439 { 440 return p_this->p_libvlc->p_playlist->current.i_size; 441 } 367 #define playlist_CurrentSize( obj ) obj->p_libvlc->p_playlist->current.i_size 368 442 369 443 370 /** Ask the playlist to do some work */ include/vlc_symbols.h
r4e3e7fc r673861d 313 313 int (*playlist_NodeSort_inner) (playlist_t *, playlist_item_t *,int, int); 314 314 int (*playlist_RecursiveNodeSort_inner) (playlist_t *, playlist_item_t *,int, int); 315 int (*playlist_Import_inner) (playlist_t *, const char *, playlist_item_t *, vlc_bool_t);315 void *playlist_Import_deprecated; 316 316 int (*playlist_Export_inner) (playlist_t *, const char *, playlist_item_t *, const char *); 317 317 spu_t * (*__spu_Create_inner) (vlc_object_t *); … … 507 507 int (*playlist_DeleteAllFromInput_inner) (playlist_t *, int); 508 508 int (*playlist_LockDeleteAllFromInput_inner) (playlist_t *, int); 509 void (*playlist_AddWhereverNeeded_inner) (playlist_t* , input_item_t*, playlist_item_t*,playlist_item_t*,vlc_bool_t, int);509 void *playlist_AddWhereverNeeded_deprecated; 510 510 int (*playlist_DeleteFromItemId_inner) (playlist_t *, int); 511 511 void (*playlist_NodeDump_inner) (playlist_t *p_playlist, playlist_item_t *p_item, int i_level); … … 558 558 char * (*str_format_time_inner) (char *); 559 559 char * (*__str_format_meta_inner) (vlc_object_t *, char *); 560 int (*vout_Snapshot_inner) (vout_thread_t *p_vout, picture_t *p_pic); 560 561 }; 561 562 # if defined (__PLUGIN__) … … 822 823 # define playlist_NodeSort (p_symbols)->playlist_NodeSort_inner 823 824 # define playlist_RecursiveNodeSort (p_symbols)->playlist_RecursiveNodeSort_inner 824 # define playlist_Import (p_symbols)->playlist_Import_inner825 825 # define playlist_Export (p_symbols)->playlist_Export_inner 826 826 # define __spu_Create (p_symbols)->__spu_Create_inner … … 997 997 # define playlist_DeleteAllFromInput (p_symbols)->playlist_DeleteAllFromInput_inner 998 998 # define playlist_LockDeleteAllFromInput (p_symbols)->playlist_LockDeleteAllFromInput_inner 999 # define playlist_AddWhereverNeeded (p_symbols)->playlist_AddWhereverNeeded_inner1000 999 # define playlist_DeleteFromItemId (p_symbols)->playlist_DeleteFromItemId_inner 1001 1000 # define playlist_NodeDump (p_symbols)->playlist_NodeDump_inner … … 1035 1034 # define str_format_time (p_symbols)->str_format_time_inner 1036 1035 # define __str_format_meta (p_symbols)->__str_format_meta_inner 1036 # define vout_Snapshot (p_symbols)->vout_Snapshot_inner 1037 1037 # elif defined (HAVE_DYNAMIC_PLUGINS) && !defined (__BUILTIN__) 1038 1038 /****************************************************************** … … 1302 1302 ((p_symbols)->playlist_NodeSort_inner) = playlist_NodeSort; \ 1303 1303 ((p_symbols)->playlist_RecursiveNodeSort_inner) = playlist_RecursiveNodeSort; \ 1304 ((p_symbols)->playlist_Import_inner) = playlist_Import; \1305 1304 ((p_symbols)->playlist_Export_inner) = playlist_Export; \ 1306 1305 ((p_symbols)->__spu_Create_inner) = __spu_Create; \ … … 1477 1476 ((p_symbols)->playlist_DeleteAllFromInput_inner) = playlist_DeleteAllFromInput; \ 1478 1477 ((p_symbols)->playlist_LockDeleteAllFromInput_inner) = playlist_LockDeleteAllFromInput; \ 1479 ((p_symbols)->playlist_AddWhereverNeeded_inner) = playlist_AddWhereverNeeded; \1480 1478 ((p_symbols)->playlist_DeleteFromItemId_inner) = playlist_DeleteFromItemId; \ 1481 1479 ((p_symbols)->playlist_NodeDump_inner) = playlist_NodeDump; \ … … 1515 1513 ((p_symbols)->str_format_time_inner) = str_format_time; \ 1516 1514 ((p_symbols)->__str_format_meta_inner) = __str_format_meta; \ 1515 ((p_symbols)->vout_Snapshot_inner) = vout_Snapshot; \ 1517 1516 (p_symbols)->net_ConvertIPv4_deprecated = NULL; \ 1518 1517 (p_symbols)->__sout_CfgParse_deprecated = NULL; \ … … 1546 1545 (p_symbols)->playlist_Move_deprecated = NULL; \ 1547 1546 (p_symbols)->playlist_NodeGroup_deprecated = NULL; \ 1547 (p_symbols)->playlist_Import_deprecated = NULL; \ 1548 1548 (p_symbols)->playlist_NodeRemoveParent_deprecated = NULL; \ 1549 1549 (p_symbols)->__vlc_fix_readdir_charset_deprecated = NULL; \ … … 1565 1565 (p_symbols)->playlist_PlaylistAddInput_deprecated = NULL; \ 1566 1566 (p_symbols)->vlc_input_item_AddOption_deprecated = NULL; \ 1567 (p_symbols)->playlist_AddWhereverNeeded_deprecated = NULL; \ 1567 1568 (p_symbols)->__intf_UserOkayCancel_deprecated = NULL; \ 1568 1569 (p_symbols)->playlist_NodesCreateForSD_deprecated = NULL; \ modules/access/cdda.c
r19f542a r673861d 502 502 } 503 503 #endif 504 playlist_ AddWhereverNeeded( p_playlist, p_input_item, p_parent,505 p_item_in_category, VLC_FALSE, PLAYLIST_APPEND );504 playlist_BothAddInput( p_playlist, p_input_item, p_item_in_category, 505 PLAYLIST_APPEND, PLAYLIST_END ); 506 506 free( psz_uri ); free( psz_opt ); free( psz_name ); 507 507 free( psz_first ); free( psz_last ); modules/access/directory.c
r128cbba r673861d 179 179 static int Read( access_t *p_access, uint8_t *p_buffer, int i_len) 180 180 { 181 char *psz; 182 int i_mode, i_activity; 183 184 char *psz_name = strdup (p_access->psz_path); 185 if (psz_name == NULL) 181 char *psz; 182 int i_mode, i_activity; 183 playlist_t *p_playlist = pl_Yield( p_access ); 184 playlist_item_t *p_item_in_category; 185 input_item_t *p_current_input = ( (input_thread_t*)p_access->p_parent) 186 ->input.p_item; 187 playlist_item_t *p_current = 188 playlist_LockItemGetByInput( p_playlist, p_current_input ); 189 char *psz_name = strdup (p_access->psz_path); 190 191 if( psz_name == NULL ) 186 192 return VLC_ENOMEM; 193 194 if( p_current == NULL ) { 195 msg_Err( p_access, "unable to find item in playlist" ); 196 return VLC_ENOOBJ; 197 } 187 198 188 199 /* Remove the ending '/' char */ … … 197 208 } 198 209 } 199 200 playlist_item_t *p_item, *p_root_category;201 playlist_t *p_playlist = pl_Yield( p_access );202 210 203 211 /* Handle mode */ … … 213 221 msg_Dbg( p_access, "opening directory `%s'", p_access->psz_path ); 214 222 215 if( p_playlist->status.p_item && p_playlist->status.p_item->p_input == 216 ((input_thread_t *)p_access->p_parent)->input.p_item ) 217 p_item = p_playlist->status.p_item; 218 else 219 { 220 input_item_t *p_current = ( (input_thread_t*)p_access->p_parent)-> 221 input.p_item; 222 p_item = playlist_LockItemGetByInput( p_playlist, p_current ); 223 if( !p_item ) 224 { 225 msg_Dbg( p_playlist, "unable to find item in playlist"); 226 return VLC_ENOOBJ; 227 } 228 } 229 p_item->p_input->i_type = ITEM_TYPE_DIRECTORY; 230 231 p_root_category = playlist_LockItemToNode( p_playlist, p_item ); 223 p_current->p_input->i_type = ITEM_TYPE_DIRECTORY; 224 p_item_in_category = playlist_LockItemToNode( p_playlist, p_current ); 232 225 233 226 i_activity = var_GetInteger( p_playlist, "activity" ); … … 235 228 DIRECTORY_ACTIVITY ); 236 229 237 ReadDir( p_playlist, psz_name, i_mode, p_ item, p_root_category );230 ReadDir( p_playlist, psz_name, i_mode, p_current, p_item_in_category ); 238 231 239 232 i_activity = var_GetInteger( p_playlist, "activity" ); 240 233 var_SetInteger( p_playlist, "activity", i_activity - 241 234 DIRECTORY_ACTIVITY ); 235 242 236 if( psz_name ) free( psz_name ); 243 237 vlc_object_release( p_playlist ); … … 476 470 -1, ITEM_TYPE_VFILE ); 477 471 if (p_input != NULL) 478 playlist_AddWhereverNeeded (p_playlist, p_input, p_parent, 479 p_parent_category, VLC_FALSE, 480 PLAYLIST_APPEND|PLAYLIST_PREPARSE); 472 playlist_BothAddInput( p_playlist, p_input, 473 p_parent_category, 474 PLAYLIST_APPEND|PLAYLIST_PREPARSE, 475 PLAYLIST_END ); 481 476 } 482 477 } modules/access/mms/mmsh.c
r415749b r673861d 113 113 114 114 /** \bug we do not autodelete here */ 115 playlist_ PlaylistAdd( p_playlist, psz_location, psz_location,116 PLAYLIST_INSERT | PLAYLIST_GO, PLAYLIST_END);115 playlist_Add( p_playlist, psz_location, psz_location, 116 PLAYLIST_INSERT | PLAYLIST_GO, PLAYLIST_END, VLC_TRUE ); 117 117 vlc_object_release( p_playlist ); 118 118 modules/codec/cmml/intf.c
ra79b5f6 r673861d 796 796 { 797 797 playlist_Stop( p_playlist ); 798 (void) playlist_ PlaylistAdd( p_playlist, psz_uri, psz_uri,799 PLAYLIST_INSERT /* FIXME: used to be PLAYLIST_REPLACE */, PLAYLIST_END|PLAYLIST_GO /* FIXME: p_playlist->status.i_index */ );798 (void) playlist_Add( p_playlist, psz_uri, psz_uri, 799 PLAYLIST_INSERT /* FIXME: used to be PLAYLIST_REPLACE */, PLAYLIST_END|PLAYLIST_GO, VLC_TRUE /* FIXME: p_playlist->status.i_index */ ); 800 800 } 801 801 modules/control/http/macro.c
r799b282 r673861d 339 339 else 340 340 { 341 playlist_ PlaylistAddInput( p_sys->p_playlist, p_input,342 PLAYLIST_APPEND, PLAYLIST_END);341 playlist_AddInput( p_sys->p_playlist, p_input, 342 PLAYLIST_APPEND, PLAYLIST_END, VLC_TRUE ); 343 343 msg_Dbg( p_intf, "requested mrl add: %s", mrl ); 344 344 } modules/control/http/rpn.c
raedf2f6 r673861d 851 851 else 852 852 { 853 i_id = playlist_ PlaylistAddInput( p_sys->p_playlist, p_input,854 PLAYLIST_APPEND, PLAYLIST_END);853 i_id = playlist_AddInput( p_sys->p_playlist, p_input, 854 PLAYLIST_APPEND, PLAYLIST_END, VLC_TRUE ); 855 855 msg_Dbg( p_intf, "requested mrl add: %s", mrl ); 856 856 } modules/control/rc.c
rd94f906 r673861d 1417 1417 { 1418 1418 msg_rc( "Trying to add %s to playlist.", newval.psz_string ); 1419 playlist_ PlaylistAddInput( p_playlist, p_item,1420 PLAYLIST_GO|PLAYLIST_APPEND, PLAYLIST_END);1419 playlist_AddInput( p_playlist, p_item, 1420 PLAYLIST_GO|PLAYLIST_APPEND, PLAYLIST_END, VLC_TRUE ); 1421 1421 } 1422 1422 } … … 1429 1429 { 1430 1430 msg_rc( "trying to enqueue %s to playlist", newval.psz_string ); 1431 playlist_ PlaylistAddInput( p_playlist, p_item,1432 PLAYLIST_APPEND, PLAYLIST_END);1431 playlist_AddInput( p_playlist, p_item, 1432 PLAYLIST_APPEND, PLAYLIST_END, VLC_TRUE ); 1433 1433 } 1434 1434 } modules/demux/mp4/mp4.c
r7f779f6 r673861d 416 416 0, NULL, -1 ); 417 417 input_ItemCopyOptions( p_current->p_input, p_input ); 418 playlist_AddWhereverNeeded( p_playlist, p_input, p_current, 419 p_item_in_category, VLC_FALSE, PLAYLIST_APPEND ); 418 playlist_BothAddInput( p_playlist, p_input, 419 p_item_in_category, 420 PLAYLIST_APPEND, PLAYLIST_END ); 420 421 } 421 422 } modules/demux/playlist/asx.c
r11566f0 r673861d 132 132 char *psz_backup = NULL; 133 133 vlc_bool_t b_entry = VLC_FALSE; 134 134 input_item_t *p_input; 135 135 INIT_PLAYLIST_STUFF; 136 136 … … 356 356 p_input = input_ItemNew( p_playlist, psz_string, psz_title_asx ); 357 357 input_ItemCopyOptions( p_current->p_input, p_input ); 358 playlist_AddWhereverNeeded( p_playlist, p_input, p_current, 359 p_item_in_category, (i_parent_id > 0 )? VLC_TRUE : VLC_FALSE, 360 PLAYLIST_APPEND ); 358 playlist_BothAddInput( p_playlist, p_input, 359 p_item_in_category, 360 PLAYLIST_APPEND, 361 PLAYLIST_END ); 361 362 free( psz_string ); 362 363 } … … 435 436 if( psz_moreinfo_entry ) vlc_meta_SetURL( p_entry->p_meta, psz_moreinfo_entry ); 436 437 if( psz_abstract_entry ) vlc_meta_SetDescription( p_entry->p_meta, psz_abstract_entry ); 437 438 playlist_AddWhereverNeeded( p_playlist, p_entry, p_current, 439 p_item_in_category, (i_parent_id > 0 )? VLC_TRUE : VLC_FALSE, 440 PLAYLIST_APPEND ); 438 playlist_BothAddInput( p_playlist, p_entry, 439 p_item_in_category, 440 PLAYLIST_APPEND, PLAYLIST_END); 441 441 free( psz_string ); 442 442 } modules/demux/playlist/b4s.c
r3923780 r673861d 85 85 char *psz_elname = NULL; 86 86 int i_type; 87 input_item_t *p_input; 87 88 char *psz_mrl = NULL, *psz_name = NULL, *psz_genre = NULL; 88 89 char *psz_now = NULL, *psz_listeners = NULL, *psz_bitrate = NULL; … … 266 267 msg_Err( p_playlist, "Unsupported meta bitrate" ); 267 268 268 playlist_AddWhereverNeeded( p_playlist, p_input, p_current, 269 p_item_in_category, (i_parent_id > 0 ) ? VLC_TRUE: 270 VLC_FALSE, PLAYLIST_APPEND ); 271 269 playlist_BothAddInput( p_playlist, p_input, 270 p_item_in_category, 271 PLAYLIST_APPEND, PLAYLIST_END ); 272 272 FREENULL( psz_name ); 273 273 FREENULL( psz_mrl ); modules/demux/playlist/dvb.c
r857b51f r673861d 96 96 { 97 97 char *psz_line; 98 input_item_t *p_input; 98 99 INIT_PLAYLIST_STUFF; 99 100 … … 118 119 input_ItemAddOption( p_input, ppsz_options[i] ); 119 120 } 120 playlist_AddWhereverNeeded( p_playlist, p_input, p_current, 121 p_item_in_category, 122 (i_parent_id > 0 ) ? VLC_TRUE: VLC_FALSE, 123 PLAYLIST_APPEND ); 121 playlist_BothAddInput( p_playlist, p_input, p_item_in_category, 122 PLAYLIST_APPEND, PLAYLIST_END ); 124 123 125 124 while( i_options-- ) free( ppsz_options[i_options] ); modules/demux/playlist/gvp.c
r64220f4 r673861d 63 63 playlist_item_t *p_current; 64 64 playlist_item_t *p_item_in_category; 65 int i_parent_id;66 65 }; 67 66 … … 130 129 char *psz_title = NULL; 131 130 char *psz_description = NULL; 131 input_item_t *p_input; 132 132 133 133 INIT_PLAYLIST_STUFF; … … 135 135 p_sys->p_playlist = p_playlist; 136 136 p_sys->p_current = p_current; 137 p_sys->i_parent_id = i_parent_id;138 137 p_sys->p_item_in_category = p_item_in_category; 139 138 … … 215 214 SADD_INFO( "docid", psz_docid ); 216 215 SADD_INFO( "description", psz_description ); 217 playlist_AddWhereverNeeded( p_sys->p_playlist, p_input, 218 p_sys->p_current, p_sys->p_item_in_category, 219 (p_sys->i_parent_id > 0 ) ? VLC_TRUE: VLC_FALSE, 220 PLAYLIST_APPEND ); 216 playlist_BothAddInput( p_sys->p_playlist, p_input, 217 p_sys->p_item_in_category, 218 PLAYLIST_APPEND, PLAYLIST_END ); 221 219 } 222 220 modules/demux/playlist/m3u.c
r857b51f r673861d 57 57 CHECK_PEEK( p_peek, 8 ); 58 58 59 if( POKE( p_peek, "#EXTM3U", 7 ) || POKE( p_peek, "RTSPtext", 8 ) || 60 isExtension( p_demux, ".m3u" ) || isExtension( p_demux, ".vlc" ) || 61 /* A .ram file can contain a single rtsp link */ 62 isExtension( p_demux, ".ram" ) || isExtension( p_demux, ".rm" ) || 63 isDemux( p_demux, "m3u" ) ) 64 { 65 ; 66 } 67 else 59 if(! ( POKE( p_peek, "#EXTM3U", 7 ) || POKE( p_peek, "RTSPtext", 8 ) || 60 isExtension( p_demux, ".m3u" ) || isExtension( p_demux, ".vlc" ) || 61 /* A .ram file can contain a single rtsp link */ 62 isExtension( p_demux, ".ram" ) || isExtension( p_demux, ".rm" ) || 63 isDemux( p_demux, "m3u" ) ) ) 68 64 return VLC_EGENERIC; 69 65 … … 80 76 { 81 77 demux_t *p_demux = (demux_t *)p_this; 82 83 if( p_demux->p_sys->psz_prefix ) free( p_demux->p_sys->psz_prefix ); 78 free( p_demux->p_sys->psz_prefix ); 84 79 free( p_demux->p_sys ); 85 80 } … … 95 90 int i_options = 0, i; 96 91 vlc_bool_t b_cleanup = VLC_FALSE; 92 input_item_t *p_input; 97 93 98 94 INIT_PLAYLIST_STUFF; … … 173 169 input_ItemAddInfo( p_input, _(VLC_META_INFO_CAT), 174 170 _(VLC_META_ARTIST), "%s", psz_artist ); 175 playlist_AddWhereverNeeded( p_playlist, p_input, p_current, 176 p_item_in_category, (i_parent_id > 0 )? VLC_TRUE : VLC_FALSE, 177 PLAYLIST_APPEND ); 171 playlist_BothAddInput( p_playlist, p_input, p_item_in_category, 172 PLAYLIST_APPEND, PLAYLIST_END ); 178 173 free( psz_mrl ); 179 174 } modules/demux/playlist/playlist.c
r318e9b8 r673861d 165 165 return psz_mrl; 166 166 } 167 168 void E_(AddToPlaylist)( demux_t *p_demux, playlist_t *p_playlist,169 input_item_t *p_input,170 playlist_item_t *p_item, int i_parent_id )171 {172 // Only add to parent if specific parent requested or not current173 // playlist item174 if( i_parent_id > 0 || ! (175 p_playlist->status.p_item &&176 p_playlist->status.p_item->p_input ==177 ((input_thread_t *)p_demux->p_parent)->input.p_item ) )178 {179 playlist_NodeAddInput( p_playlist, p_input, p_item,180 PLAYLIST_APPEND, PLAYLIST_END );181 }182 // Else, add to both183 else184 {185 playlist_BothAddInput( p_playlist, p_input, p_item,186 PLAYLIST_APPEND, PLAYLIST_END );187 }188 input_ItemCopyOptions( p_item->p_input, p_input );189 }190 191 192 vlc_bool_t E_(FindItem)( demux_t *p_demux, playlist_t *p_playlist,193 playlist_item_t **pp_item )194 {195 vlc_bool_t b_play = var_CreateGetBool( p_demux, "playlist-autostart" );196 197 if( b_play && p_playlist->status.p_item &&198 p_playlist->status.p_item->p_input ==199 ((input_thread_t *)p_demux->p_parent)->input.p_item )200 {201 msg_Dbg( p_playlist, "starting playlist playback" );202 *pp_item = p_playlist->status.p_item;203 b_play = VLC_TRUE;204 }205 else206 {207 input_item_t *p_current = ( (input_thread_t*)p_demux->p_parent)->208 input.p_item;209 *pp_item = playlist_LockItemGetByInput( p_playlist, p_current );210 if( !*pp_item )211 {212 msg_Dbg( p_playlist, "unable to find item in playlist");213 }214 msg_Dbg( p_playlist, "not starting playlist playback");215 p_playlist->status.i_status = PLAYLIST_STOPPED;216 b_play = VLC_FALSE;217 }218 return b_play;219 }modules/demux/playlist/playlist.h
r318e9b8 r673861d 22 22 *****************************************************************************/ 23 23 24 #include <vlc_playlist.h> 24 25 char *E_(ProcessMRL)( char *, char * ); 25 26 char *E_(FindPrefix)( demux_t * ); … … 68 69 69 70 #define INIT_PLAYLIST_STUFF \ 70 int i_parent_id; \71 vlc_bool_t b_play; \72 playlist_item_t *p_current, *p_item_in_category = NULL; \73 input_item_t *p_input; \74 71 playlist_t *p_playlist = pl_Yield( p_demux ); \ 75 i_parent_id = var_CreateGetInteger( p_demux, "parent-item" ); \ 76 if( i_parent_id > 0 ) \ 77 { \ 78 b_play = VLC_FALSE; \ 79 p_current = playlist_ItemGetById( p_playlist, i_parent_id ); \ 80 } \ 81 else \ 82 { \ 83 b_play = E_(FindItem)( p_demux, p_playlist, &p_current ); \ 84 p_item_in_category = playlist_ItemToNode( p_playlist, p_current ); \ 85 p_item_in_category->p_input->i_type = ITEM_TYPE_PLAYLIST; \ 86 } 72 vlc_bool_t b_play = var_CreateGetBool( p_demux, "playlist-autostart" ); \ 73 input_item_t *p_current_input = ( (input_thread_t*)p_demux->p_parent)-> \ 74 input.p_item; \ 75 playlist_item_t *p_current = \ 76 playlist_LockItemGetByInput( p_playlist, p_current_input ); \ 77 playlist_item_t *p_item_in_category = \ 78 playlist_ItemToNode( p_playlist, p_current ); \ 79 b_play = b_play && p_current == p_playlist->status.p_item; \ 80 if( p_item_in_category ) \ 81 p_item_in_category->p_input->i_type = ITEM_TYPE_PLAYLIST; 87 82 88 83 #define HANDLE_PLAY_AND_RELEASE \ 89 84 /* Go back and play the playlist */ \ 90 if( b_play && p_playlist->status.p_item && \ 91 p_playlist->status.p_item->i_children > 0 ) \ 92 { \ 93 playlist_Control( p_playlist, PLAYLIST_VIEWPLAY, \ 94 p_playlist->status.p_item, NULL ); \ 95 } \ 85 if( b_play && p_item_in_category && p_item_in_category->i_children > 0 ) \ 86 playlist_Control( p_playlist, PLAYLIST_VIEWPLAY, p_item_in_category, \ 87 NULL ); \ 96 88 vlc_object_release( p_playlist ); 97 modules/demux/playlist/pls.c
r857b51f r673861d 90 90 int i_new_item = 0; 91 91 int i_key_length; 92 input_item_t *p_input; 92 93 93 94 INIT_PLAYLIST_STUFF; … … 156 157 0, NULL, -1 ); 157 158 input_ItemCopyOptions( p_current->p_input, p_input ); 158 playlist_AddWhereverNeeded( p_playlist, p_input, p_current, 159 p_item_in_category, (i_parent_id > 0 ) ? 160 VLC_TRUE: VLC_FALSE, PLAYLIST_APPEND ); 159 playlist_BothAddInput( p_playlist, p_input, p_item_in_category, 160 PLAYLIST_APPEND, PLAYLIST_END ); 161 161 } 162 162 else … … 213 213 p_input = input_ItemNewExt( p_playlist, psz_mrl, psz_name,0, NULL, -1 ); 214 214 input_ItemCopyOptions( p_current->p_input, p_input ); 215 playlist_AddWhereverNeeded( p_playlist, p_input, p_current, 216 p_item_in_category, (i_parent_id > 0 ) ? 217 VLC_TRUE: VLC_FALSE, PLAYLIST_APPEND ); 215 playlist_BothAddInput( p_playlist, p_input, p_item_in_category, 216 PLAYLIST_APPEND, PLAYLIST_END ); 218 217
