Changeset 82921f3c8dae23178b64089b22502bb8f528e7e6
- Timestamp:
- 05/07/08 21:26:56
(4 months ago)
- Author:
- Rémi Denis-Courmont <rem@videolan.org>
- git-committer:
- Rémi Denis-Courmont <rem@videolan.org> 1210188416 +0300
- git-parent:
[3c74d129dd3d8a4bd11a4696f13af83103fe20fb]
- git-author:
- Rémi Denis-Courmont <rem@videolan.org> 1210188416 +0300
- Message:
Remove p_playlist from p_libvlc
Plugins are already using pl_Yield to get the playlist, as they should.
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| rd6a7e48 |
r82921f3 |
|
| 1 | 1 | /***************************************************************************** |
|---|
| 2 | 2 | * main.h: access to all program variables |
|---|
| 3 | | * Declaration and extern access to global program object. |
|---|
| | 3 | * Declaration and extern access to LibVLC instance object. |
|---|
| 4 | 4 | ***************************************************************************** |
|---|
| 5 | | * Copyright (C) 1999, 2000, 2001, 2002 the VideoLAN team |
|---|
| 6 | | * $Id$ |
|---|
| | 5 | * Copyright (C) 1999, 2000, 2001, 2002, 2008 the VideoLAN team |
|---|
| 7 | 6 | * |
|---|
| 8 | 7 | * Authors: Vincent Seguin <seguin@via.ecp.fr> |
|---|
| … | … | |
| 41 | 40 | char * psz_homedir; ///< user's home directory |
|---|
| 42 | 41 | |
|---|
| 43 | | playlist_t *p_playlist; ///< playlist object |
|---|
| 44 | | |
|---|
| 45 | 42 | global_stats_t *p_stats; ///< Global statistics |
|---|
| 46 | 43 | |
|---|
| rd3d7766 |
r82921f3 |
|
| 413 | 413 | |
|---|
| 414 | 414 | /** Tell the number of items in the current playing context */ |
|---|
| 415 | | #define playlist_CurrentSize( obj ) obj->p_libvlc->p_playlist->current.i_size |
|---|
| | 415 | #define playlist_CurrentSize( pl ) pl->current.i_size |
|---|
| 416 | 416 | |
|---|
| 417 | 417 | /** Ask the playlist to do some work */ |
|---|
| r449fd28 |
r82921f3 |
|
| 121 | 121 | 0, name, /* Add path to it !!! */ |
|---|
| 122 | 122 | 1, "no info", |
|---|
| 123 | | 2, playlist_CurrentSize(p_intf), /* Hidden index. */ |
|---|
| | 123 | 2, playlist_CurrentSize(p_playlist), /* Hidden index. */ |
|---|
| 124 | 124 | -1 ); |
|---|
| 125 | 125 | |
|---|
| … | … | |
| 164 | 164 | #endif |
|---|
| 165 | 165 | vlc_mutex_lock( &p_playlist->object_lock ); |
|---|
| 166 | | for( i_dummy = 0; i_dummy < playlist_CurrentSize(p_intf) ; i_dummy++ ) |
|---|
| | 166 | for( i_dummy = 0; i_dummy < playlist_CurrentSize(p_playlist) ; i_dummy++ ) |
|---|
| 167 | 167 | { |
|---|
| 168 | 168 | playlist_item_t *p_item = playlist_ItemGetById( p_playlist, i_dummy, true ); |
|---|
| … | … | |
| 385 | 385 | { |
|---|
| 386 | 386 | vlc_mutex_lock( &p_playlist->object_lock ); |
|---|
| 387 | | if (playlist_CurrentSize(p_intf)) |
|---|
| | 387 | if (playlist_CurrentSize(p_playlist)) |
|---|
| 388 | 388 | { |
|---|
| 389 | 389 | vlc_mutex_unlock( &p_playlist->object_lock ); |
|---|
| … | … | |
| 930 | 930 | } |
|---|
| 931 | 931 | |
|---|
| 932 | | for(item = playlist_CurrentSize(p_intf) - 1; item >= 0 ;item-- ) |
|---|
| | 932 | for(item = playlist_CurrentSize(p_playlist) - 1; item >= 0 ;item-- ) |
|---|
| 933 | 933 | { |
|---|
| 934 | 934 | msg_Err( p_playlist, "fix pda delete" ); |
|---|
| r449fd28 |
r82921f3 |
|
| 23 | 23 | |
|---|
| 24 | 24 | #include "libvlc_internal.h" |
|---|
| 25 | | |
|---|
| | 25 | #include "libvlc.h" |
|---|
| 26 | 26 | #include <vlc/libvlc.h> |
|---|
| 27 | 27 | #include <vlc_input.h> |
|---|
| … | … | |
| 216 | 216 | { |
|---|
| 217 | 217 | playlist_PreparseEnqueue( |
|---|
| 218 | | p_md->p_libvlc_instance->p_libvlc_int->p_playlist, |
|---|
| | 218 | libvlc_priv (p_md->p_libvlc_instance->p_libvlc_int)->p_playlist, |
|---|
| 219 | 219 | p_md->p_input_item ); |
|---|
| 220 | 220 | p_md->b_preparsed = true; |
|---|
| … | … | |
| 431 | 431 | { |
|---|
| 432 | 432 | playlist_AskForArtEnqueue( |
|---|
| 433 | | p_md->p_libvlc_instance->p_libvlc_int->p_playlist, |
|---|
| | 433 | libvlc_priv(p_md->p_libvlc_instance->p_libvlc_int)->p_playlist, |
|---|
| 434 | 434 | p_md->p_input_item ); |
|---|
| 435 | 435 | } |
|---|
| r449fd28 |
r82921f3 |
|
| 31 | 31 | #include "../playlist/playlist_internal.h" |
|---|
| 32 | 32 | |
|---|
| 33 | | #define PL p_instance->p_libvlc_int->p_playlist |
|---|
| | 33 | #define PL (libvlc_priv (p_instance->p_libvlc_int)->p_playlist) |
|---|
| 34 | 34 | |
|---|
| 35 | 35 | static inline int playlist_was_locked( libvlc_instance_t *p_instance ) |
|---|
| rd3d7766 |
r82921f3 |
|
| 554 | 554 | /* We have finished */ |
|---|
| 555 | 555 | p_input->b_eof = true; |
|---|
| 556 | | playlist_Signal( p_input->p_libvlc->p_playlist ); |
|---|
| | 556 | playlist_Signal( libvlc_priv (p_input->p_libvlc)->p_playlist ); |
|---|
| 557 | 557 | } |
|---|
| 558 | 558 | |
|---|
| … | … | |
| 2111 | 2111 | access_Control( p_input->p->input.p_access,ACCESS_GET_META, p_meta ); |
|---|
| 2112 | 2112 | InputUpdateMeta( p_input, p_meta ); |
|---|
| 2113 | | var_SetInteger( p_input->p_libvlc->p_playlist, "item-change", p_input->p->input.p_item->i_id ); |
|---|
| | 2113 | var_SetInteger( libvlc_priv (p_input->p_libvlc)->p_playlist, |
|---|
| | 2114 | "item-change", p_input->p->input.p_item->i_id ); |
|---|
| 2114 | 2115 | p_access->info.i_update &= ~INPUT_UPDATE_META; |
|---|
| 2115 | 2116 | } |
|---|
| … | … | |
| 2154 | 2155 | { |
|---|
| 2155 | 2156 | pl_Yield( p_input ); |
|---|
| 2156 | | var_SetInteger( p_input->p_libvlc->p_playlist, "item-change", |
|---|
| 2157 | | p_input->p->input.p_item->i_id ); |
|---|
| | 2157 | var_SetInteger( libvlc_priv (p_input->p_libvlc)->p_playlist, |
|---|
| | 2158 | "item-change", p_input->p->input.p_item->i_id ); |
|---|
| 2158 | 2159 | pl_Release( p_input ); |
|---|
| 2159 | 2160 | } |
|---|
| rb16fe48 |
r82921f3 |
|
| 180 | 180 | |
|---|
| 181 | 181 | priv = libvlc_priv (p_libvlc); |
|---|
| 182 | | p_libvlc->p_playlist = NULL; |
|---|
| | 182 | priv->p_playlist = NULL; |
|---|
| 183 | 183 | priv->p_interaction = NULL; |
|---|
| 184 | 184 | priv->p_vlm = NULL; |
|---|
| … | … | |
| 737 | 737 | /* Initialize playlist and get commandline files */ |
|---|
| 738 | 738 | playlist_ThreadCreate( p_libvlc ); |
|---|
| 739 | | if( !p_libvlc->p_playlist ) |
|---|
| | 739 | if( !priv->p_playlist ) |
|---|
| 740 | 740 | { |
|---|
| 741 | 741 | msg_Err( p_libvlc, "playlist initialization failed" ); |
|---|
| … | … | |
| 747 | 747 | return VLC_EGENERIC; |
|---|
| 748 | 748 | } |
|---|
| 749 | | p_playlist = p_libvlc->p_playlist; |
|---|
| | 749 | p_playlist = priv->p_playlist; |
|---|
| 750 | 750 | |
|---|
| 751 | 751 | psz_modules = config_GetPsz( p_playlist, "services-discovery" ); |
|---|
| … | … | |
| 940 | 940 | /* Free playlist */ |
|---|
| 941 | 941 | msg_Dbg( p_libvlc, "removing playlist" ); |
|---|
| 942 | | playlist_ThreadDestroy( p_libvlc->p_playlist ); |
|---|
| | 942 | playlist_ThreadDestroy( priv->p_playlist ); |
|---|
| 943 | 943 | |
|---|
| 944 | 944 | /* Free video outputs */ |
|---|
| … | … | |
| 1139 | 1139 | /* Interface doesn't handle play on start so do it ourselves */ |
|---|
| 1140 | 1140 | if( !p_intf->b_play && b_play ) |
|---|
| 1141 | | playlist_Play( p_libvlc->p_playlist ); |
|---|
| | 1141 | playlist_Play( libvlc_priv(p_libvlc)->p_playlist ); |
|---|
| 1142 | 1142 | |
|---|
| 1143 | 1143 | /* Try to run the interface */ |
|---|
| r449fd28 |
r82921f3 |
|
| 297 | 297 | #define LIBVLC_PLAYLIST_FUNC \ |
|---|
| 298 | 298 | libvlc_int_t *p_libvlc = vlc_current_object( i_object );\ |
|---|
| 299 | | if( !p_libvlc || !p_libvlc->p_playlist ) return VLC_ENOOBJ; \ |
|---|
| 300 | | vlc_object_yield( p_libvlc->p_playlist ); |
|---|
| | 299 | if( !p_libvlc ) return VLC_ENOOBJ; \ |
|---|
| | 300 | playlist_t *p_playlist = pl_Yield( p_libvlc ); \ |
|---|
| | 301 | if( !p_playlist ) return VLC_ENOOBJ |
|---|
| 301 | 302 | |
|---|
| 302 | 303 | #define LIBVLC_PLAYLIST_FUNC_END \ |
|---|
| 303 | | vlc_object_release( p_libvlc->p_playlist ); \ |
|---|
| | 304 | pl_Release( p_libvlc ); \ |
|---|
| 304 | 305 | if( i_object ) vlc_object_release( p_libvlc ); |
|---|
| 305 | 306 | |
|---|
| … | … | |
| 316 | 317 | int i_err; |
|---|
| 317 | 318 | LIBVLC_PLAYLIST_FUNC; |
|---|
| 318 | | i_err = playlist_AddExt( p_libvlc->p_playlist, psz_target, |
|---|
| | 319 | i_err = playlist_AddExt( p_playlist, psz_target, |
|---|
| 319 | 320 | NULL, i_mode, i_pos, -1, |
|---|
| 320 | 321 | ppsz_options, i_options, true, false ); |
|---|
| … | … | |
| 329 | 330 | { |
|---|
| 330 | 331 | LIBVLC_PLAYLIST_FUNC; |
|---|
| 331 | | playlist_Play( p_libvlc->p_playlist ); |
|---|
| | 332 | playlist_Play( p_playlist ); |
|---|
| 332 | 333 | LIBVLC_PLAYLIST_FUNC_END; |
|---|
| 333 | 334 | return VLC_SUCCESS; |
|---|
| … | … | |
| 340 | 341 | { |
|---|
| 341 | 342 | LIBVLC_PLAYLIST_FUNC; |
|---|
| 342 | | playlist_Pause( p_libvlc->p_playlist ); |
|---|
| | 343 | playlist_Pause( p_playlist ); |
|---|
| 343 | 344 | LIBVLC_PLAYLIST_FUNC_END; |
|---|
| 344 | 345 | return VLC_SUCCESS; |
|---|
| … | … | |
| 351 | 352 | { |
|---|
| 352 | 353 | LIBVLC_PLAYLIST_FUNC; |
|---|
| 353 | | playlist_Stop( p_libvlc->p_playlist ); |
|---|
| | 354 | playlist_Stop( p_playlist ); |
|---|
| 354 | 355 | LIBVLC_PLAYLIST_FUNC_END; |
|---|
| 355 | 356 | return VLC_SUCCESS; |
|---|
| … | … | |
| 364 | 365 | |
|---|
| 365 | 366 | LIBVLC_PLAYLIST_FUNC; |
|---|
| 366 | | if( p_libvlc->p_playlist->p_input ) |
|---|
| | 367 | if( p_playlist->p_input ) |
|---|
| 367 | 368 | { |
|---|
| 368 | 369 | vlc_value_t val; |
|---|
| 369 | | var_Get( p_libvlc->p_playlist->p_input, "state", &val ); |
|---|
| | 370 | var_Get( p_playlist->p_input, "state", &val ); |
|---|
| 370 | 371 | b_playing = ( val.i_int == PLAYING_S ); |
|---|
| 371 | 372 | } |
|---|
| 372 | 373 | else |
|---|
| 373 | 374 | { |
|---|
| 374 | | b_playing = playlist_IsPlaying( p_libvlc->p_playlist ); |
|---|
| | 375 | b_playing = playlist_IsPlaying( p_playlist ); |
|---|
| 375 | 376 | } |
|---|
| 376 | 377 | LIBVLC_PLAYLIST_FUNC_END; |
|---|
| … | … | |
| 673 | 674 | int i_size; |
|---|
| 674 | 675 | LIBVLC_PLAYLIST_FUNC; |
|---|
| 675 | | i_size = p_libvlc->p_playlist->items.i_size; |
|---|
| | 676 | i_size = p_playlist->items.i_size; |
|---|
| 676 | 677 | LIBVLC_PLAYLIST_FUNC_END; |
|---|
| 677 | 678 | return i_size; |
|---|
| … | … | |
| 686 | 687 | { |
|---|
| 687 | 688 | LIBVLC_PLAYLIST_FUNC; |
|---|
| 688 | | playlist_Next( p_libvlc->p_playlist ); |
|---|
| | 689 | playlist_Next( p_playlist ); |
|---|
| 689 | 690 | LIBVLC_PLAYLIST_FUNC_END; |
|---|
| 690 | 691 | return VLC_SUCCESS; |
|---|
| … | … | |
| 699 | 700 | { |
|---|
| 700 | 701 | LIBVLC_PLAYLIST_FUNC; |
|---|
| 701 | | playlist_Prev( p_libvlc->p_playlist ); |
|---|
| | 702 | playlist_Prev( p_playlist ); |
|---|
| 702 | 703 | LIBVLC_PLAYLIST_FUNC_END; |
|---|
| 703 | 704 | return VLC_SUCCESS; |
|---|
| … | … | |
| 710 | 711 | { |
|---|
| 711 | 712 | LIBVLC_PLAYLIST_FUNC; |
|---|
| 712 | | playlist_Clear( p_libvlc->p_playlist, true ); |
|---|
| | 713 | playlist_Clear( p_playlist, true ); |
|---|
| 713 | 714 | LIBVLC_PLAYLIST_FUNC_END; |
|---|
| 714 | 715 | return VLC_SUCCESS; |
|---|
| r6dad9cd |
r82921f3 |
|
| 233 | 233 | |
|---|
| 234 | 234 | module_t *p_memcpy_module; ///< Fast memcpy plugin used |
|---|
| 235 | | vlm_t *p_vlm; ///< VLM if created from libvlc-common.c |
|---|
| | 235 | playlist_t *p_playlist; //< the playlist singleton |
|---|
| | 236 | vlm_t *p_vlm; ///< the VLM singleton (or NULL) |
|---|
| 236 | 237 | vlc_object_t *p_interaction; ///< interface interaction object |
|---|
| 237 | 238 | httpd_t *p_httpd; ///< HTTP daemon (src/network/httpd.c) |
|---|
| rb8a4cd3 |
r82921f3 |
|
| 315 | 315 | |
|---|
| 316 | 316 | /* Add files to the playlist */ |
|---|
| 317 | | p_playlist = (playlist_t *)vlc_object_find( p_this, |
|---|
| 318 | | VLC_OBJECT_PLAYLIST, |
|---|
| 319 | | FIND_ANYWHERE ); |
|---|
| | 317 | p_playlist = pl_Yield( p_this ); |
|---|
| 320 | 318 | if( !p_playlist ) return 0; |
|---|
| 321 | 319 | |
|---|
| r82a358a |
r82921f3 |
|
| 44 | 44 | playlist_t *__pl_Yield( vlc_object_t *p_this ) |
|---|
| 45 | 45 | { |
|---|
| 46 | | playlist_t *pl = p_this->p_libvlc->p_playlist; |
|---|
| | 46 | playlist_t *pl = libvlc_priv (p_this->p_libvlc)->p_playlist; |
|---|
| 47 | 47 | assert( pl != NULL ); |
|---|
| 48 | 48 | vlc_object_yield( pl ); |
|---|
| … | … | |
| 52 | 52 | void __pl_Release( vlc_object_t *p_this ) |
|---|
| 53 | 53 | { |
|---|
| 54 | | playlist_t *pl = p_this->p_libvlc->p_playlist; |
|---|
| | 54 | playlist_t *pl = libvlc_priv (p_this->p_libvlc)->p_playlist; |
|---|
| 55 | 55 | assert( pl != NULL ); |
|---|
| 56 | 56 | vlc_object_release( pl ); |
|---|
| r82a358a |
r82921f3 |
|
| 75 | 75 | TAB_INIT( p_playlist->i_sds, p_playlist->pp_sds ); |
|---|
| 76 | 76 | |
|---|
| 77 | | p_parent->p_libvlc->p_playlist = p_playlist; |
|---|
| | 77 | libvlc_priv(p_parent->p_libvlc)->p_playlist = p_playlist; |
|---|
| 78 | 78 | |
|---|
| 79 | 79 | VariablesInit( p_playlist ); |
|---|