Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc
Commits
e3f0531d
Commit
e3f0531d
authored
Sep 14, 2008
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Playlist: put private data after public data
parent
8df80e5e
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
56 additions
and
63 deletions
+56
-63
include/vlc_playlist.h
include/vlc_playlist.h
+0
-6
src/input/meta.c
src/input/meta.c
+2
-2
src/playlist/control.c
src/playlist/control.c
+14
-14
src/playlist/engine.c
src/playlist/engine.c
+24
-24
src/playlist/playlist_internal.h
src/playlist/playlist_internal.h
+5
-3
src/playlist/thread.c
src/playlist/thread.c
+11
-14
No files found.
include/vlc_playlist.h
View file @
e3f0531d
...
...
@@ -153,8 +153,6 @@ struct playlist_item_t
typedef
enum
{
PLAYLIST_STOPPED
,
PLAYLIST_RUNNING
,
PLAYLIST_PAUSED
}
playlist_status_t
;
typedef
struct
playlist_private_t
playlist_private_t
;
/** Structure containing information about the playlist */
struct
playlist_t
{
...
...
@@ -224,10 +222,6 @@ struct playlist_t
when processing the request */
vlc_mutex_t
lock
;
/**< Lock to protect request */
}
request
;
/* All other data is PRIVATE. You can't access it
* outside of src/input */
playlist_private_t
*
p
;
};
/** Helper to add an item */
...
...
src/input/meta.c
View file @
e3f0531d
...
...
@@ -99,7 +99,7 @@ int input_ArtFind( playlist_t *p_playlist, input_item_t *p_item )
/* If we already checked this album in this session, skip */
if
(
psz_artist
&&
psz_album
)
{
FOREACH_ARRAY
(
playlist_album_t
album
,
p
_playlist
->
p
->
p_fetcher
->
albums
)
FOREACH_ARRAY
(
playlist_album_t
album
,
p
l_priv
(
p_playlist
)
->
p_fetcher
->
albums
)
if
(
!
strcmp
(
album
.
psz_artist
,
psz_artist
)
&&
!
strcmp
(
album
.
psz_album
,
psz_album
)
)
{
...
...
@@ -179,7 +179,7 @@ int input_ArtFind( playlist_t *p_playlist, input_item_t *p_item )
a
.
psz_album
=
psz_album
;
a
.
psz_arturl
=
input_item_GetArtURL
(
p_item
);
a
.
b_found
=
(
i_ret
==
VLC_EGENERIC
?
false
:
true
);
ARRAY_APPEND
(
p
_playlist
->
p
->
p_fetcher
->
albums
,
a
);
ARRAY_APPEND
(
p
l_priv
(
p_playlist
)
->
p_fetcher
->
albums
,
a
);
}
else
{
...
...
src/playlist/control.c
View file @
e3f0531d
...
...
@@ -189,7 +189,7 @@ static int PlaylistVAControl( playlist_t * p_playlist, int i_query, va_list args
int
playlist_PreparseEnqueue
(
playlist_t
*
p_playlist
,
input_item_t
*
p_item
)
{
playlist_preparse_t
*
p_preparse
=
&
p
_playlist
->
p
->
preparse
;
playlist_preparse_t
*
p_preparse
=
&
p
l_priv
(
p_playlist
)
->
preparse
;
vlc_gc_incref
(
p_item
);
...
...
@@ -206,7 +206,7 @@ int playlist_PreparseEnqueue( playlist_t *p_playlist,
int
playlist_PreparseEnqueueItem
(
playlist_t
*
p_playlist
,
playlist_item_t
*
p_item
)
{
playlist_preparse_t
*
p_preparse
=
&
p
_playlist
->
p
->
preparse
;
playlist_preparse_t
*
p_preparse
=
&
p
l_priv
(
p_playlist
)
->
preparse
;
vlc_object_lock
(
p_playlist
);
vlc_mutex_lock
(
&
p_preparse
->
lock
);
...
...
@@ -219,26 +219,26 @@ int playlist_PreparseEnqueueItem( playlist_t *p_playlist,
int
playlist_AskForArtEnqueue
(
playlist_t
*
p_playlist
,
input_item_t
*
p_item
)
{
vlc_object_lock
(
p_playlist
->
p
->
p_fetcher
);
if
(
!
vlc_object_alive
(
p_playlist
->
p
->
p_fetcher
)
)
playlist_fetcher_t
*
p_fetcher
=
pl_priv
(
p_playlist
)
->
p_fetcher
;
vlc_object_lock
(
p_fetcher
);
if
(
!
vlc_object_alive
(
p_fetcher
)
)
{
vlc_object_unlock
(
p_
playlist
->
p
->
p_
fetcher
);
vlc_object_unlock
(
p_fetcher
);
return
VLC_EGENERIC
;
}
vlc_gc_incref
(
p_item
);
INSERT_ELEM
(
p_playlist
->
p
->
p_fetcher
->
pp_waiting
,
p_playlist
->
p
->
p_fetcher
->
i_waiting
,
p_playlist
->
p
->
p_fetcher
->
i_waiting
,
p_item
);
vlc_object_signal_unlocked
(
p_playlist
->
p
->
p_fetcher
);
vlc_object_unlock
(
p_playlist
->
p
->
p_fetcher
);
INSERT_ELEM
(
p_fetcher
->
pp_waiting
,
p_fetcher
->
i_waiting
,
p_fetcher
->
i_waiting
,
p_item
);
vlc_object_signal_unlocked
(
p_fetcher
);
vlc_object_unlock
(
p_fetcher
);
return
VLC_SUCCESS
;
}
static
void
PreparseEnqueueItemSub
(
playlist_t
*
p_playlist
,
playlist_item_t
*
p_item
)
{
playlist_preparse_t
*
p_preparse
=
&
p
_playlist
->
p
->
preparse
;
playlist_preparse_t
*
p_preparse
=
&
p
l_priv
(
p_playlist
)
->
preparse
;
if
(
p_item
->
i_children
==
-
1
)
{
...
...
@@ -505,7 +505,7 @@ playlist_item_t * playlist_NextItem( playlist_t *p_playlist )
int
playlist_PlayItem
(
playlist_t
*
p_playlist
,
playlist_item_t
*
p_item
)
{
input_item_t
*
p_input
=
p_item
->
p_input
;
sout_instance_t
**
pp_sout
=
&
p
_playlist
->
p
->
p_sout
;
sout_instance_t
**
pp_sout
=
&
p
l_priv
(
p_playlist
)
->
p_sout
;
int
i_activity
=
var_GetInteger
(
p_playlist
,
"activity"
)
;
msg_Dbg
(
p_playlist
,
"creating new input thread"
);
...
...
@@ -534,8 +534,8 @@ int playlist_PlayItem( playlist_t *p_playlist, playlist_item_t *p_item )
}
free
(
psz_uri
);
if
(
p
_playlist
->
p
->
p_fetcher
&&
p_playlist
->
p
->
p_fetcher
->
i_art_policy
==
ALBUM_ART_WHEN_PLAYED
)
if
(
p
l_priv
(
p_playlist
)
->
p_fetcher
&&
pl_priv
(
p_playlist
)
->
p_fetcher
->
i_art_policy
==
ALBUM_ART_WHEN_PLAYED
)
{
bool
b_has_art
;
...
...
src/playlist/engine.c
View file @
e3f0531d
...
...
@@ -61,24 +61,24 @@ playlist_t * playlist_Create( vlc_object_t *p_parent )
{
static
const
char
playlist_name
[]
=
"playlist"
;
playlist_t
*
p_playlist
;
playlist_private_t
*
p
;
bool
b_save
;
/* Allocate structure */
p
_playlist
=
vlc_custom_create
(
p_parent
,
sizeof
(
*
p_playlist
),
VLC_OBJECT_GENERIC
,
playlist_name
);
if
(
!
p
_playlist
)
p
=
vlc_custom_create
(
p_parent
,
sizeof
(
*
p
),
VLC_OBJECT_GENERIC
,
playlist_name
);
if
(
!
p
)
return
NULL
;
assert
(
offsetof
(
playlist_private_t
,
public_data
)
==
0
);
p_playlist
=
&
p
->
public_data
;
TAB_INIT
(
p_playlist
->
i_sds
,
p_playlist
->
pp_sds
);
MALLOC_NULL
(
p_playlist
->
p
,
playlist_private_t
);
memset
(
p_playlist
->
p
,
0
,
sizeof
(
playlist_private_t
)
);
libvlc_priv
(
p_parent
->
p_libvlc
)
->
p_playlist
=
p_playlist
;
VariablesInit
(
p_playlist
);
/* Initialise data structures */
p_playlist
->
p
->
p_playlist
=
p_playlist
;
p_playlist
->
i_last_playlist_id
=
0
;
p_playlist
->
p_input
=
NULL
;
...
...
@@ -176,7 +176,7 @@ playlist_t * playlist_Create( vlc_object_t *p_parent )
static
void
playlist_Destructor
(
vlc_object_t
*
p_this
)
{
playlist_t
*
p_playlist
=
(
playlist_t
*
)
p_this
;
playlist_preparse_t
*
p_preparse
=
&
p
_playlist
->
p
->
preparse
;
playlist_preparse_t
*
p_preparse
=
&
p
l_priv
(
p_playlist
)
->
preparse
;
/* Destroy the item preparser */
if
(
p_preparse
->
up
)
...
...
@@ -193,9 +193,9 @@ static void playlist_Destructor( vlc_object_t * p_this )
vlc_mutex_destroy
(
&
p_preparse
->
lock
);
/* Destroy the item meta-infos fetcher */
if
(
p
_playlist
->
p
->
p_fetcher
)
if
(
p
l_priv
(
p_playlist
)
->
p_fetcher
)
{
vlc_object_release
(
p
_playlist
->
p
->
p_fetcher
);
vlc_object_release
(
p
l_priv
(
p_playlist
)
->
p_fetcher
);
}
msg_Dbg
(
p_this
,
"Destroyed"
);
}
...
...
@@ -379,7 +379,7 @@ check_input:
{
int
i_activity
;
input_thread_t
*
p_input
;
sout_instance_t
**
pp_sout
=
&
p
_playlist
->
p
->
p_sout
;
sout_instance_t
**
pp_sout
=
&
p
l_priv
(
p_playlist
)
->
p_sout
;
PL_DEBUG
(
"dead input"
);
...
...
@@ -520,7 +520,7 @@ void playlist_LastLoop( playlist_t *p_playlist )
#ifdef ENABLE_SOUT
/* close the remaining sout-keep (if there was no input atm) */
sout_instance_t
*
p_sout
=
p
_playlist
->
p
->
p_sout
;
sout_instance_t
*
p_sout
=
p
l_priv
(
p_playlist
)
->
p_sout
;
if
(
p_sout
)
sout_DeleteInstance
(
p_sout
);
#endif
...
...
@@ -530,8 +530,8 @@ void playlist_LastLoop( playlist_t *p_playlist )
playlist_ServicesDiscoveryKillAll
(
p_playlist
);
playlist_MLDump
(
p_playlist
);
vlc_object_kill
(
p
_playlist
->
p
->
p_fetcher
);
vlc_thread_join
(
p
_playlist
->
p
->
p_fetcher
);
vlc_object_kill
(
p
l_priv
(
p_playlist
)
->
p_fetcher
);
vlc_thread_join
(
p
l_priv
(
p_playlist
)
->
p_fetcher
);
PL_LOCK
;
...
...
@@ -569,8 +569,8 @@ void playlist_LastLoop( playlist_t *p_playlist )
void
*
playlist_PreparseLoop
(
void
*
data
)
{
playlist_preparse_t
*
p_preparse
=
data
;
playlist_t
*
p_playlist
=
((
playlist_private_t
*
)(((
char
*
)
p_preparse
)
-
offsetof
(
playlist_private_t
,
preparse
)))
->
p
_playlist
;
playlist_t
*
p_playlist
=
&
((
playlist_private_t
*
)(((
char
*
)
p_preparse
)
-
offsetof
(
playlist_private_t
,
preparse
)))
->
p
ublic_data
;
int
i_activity
;
for
(
;;
)
...
...
@@ -615,21 +615,21 @@ void *playlist_PreparseLoop( void *data )
*/
char
*
psz_arturl
=
input_item_GetArtURL
(
p_current
);
char
*
psz_name
=
input_item_GetName
(
p_current
);
if
(
p_playlist
->
p
->
p_fetcher
->
i_art_policy
==
ALBUM_ART_ALL
&&
(
!
psz_arturl
||
strncmp
(
psz_arturl
,
"file://"
,
7
)
)
)
playlist_fetcher_t
*
p_fetcher
=
pl_priv
(
p_playlist
)
->
p_fetcher
;
if
(
p_fetcher
->
i_art_policy
==
ALBUM_ART_ALL
&&
(
!
psz_arturl
||
strncmp
(
psz_arturl
,
"file://"
,
7
)
)
)
{
PL_DEBUG
(
"meta ok for %s, need to fetch art"
,
psz_name
);
vlc_object_lock
(
p_
playlist
->
p
->
p_
fetcher
);
if
(
vlc_object_alive
(
p_
playlist
->
p
->
p_
fetcher
)
)
vlc_object_lock
(
p_fetcher
);
if
(
vlc_object_alive
(
p_fetcher
)
)
{
INSERT_ELEM
(
p_playlist
->
p
->
p_fetcher
->
pp_waiting
,
p_playlist
->
p
->
p_fetcher
->
i_waiting
,
p_playlist
->
p
->
p_fetcher
->
i_waiting
,
p_current
);
vlc_object_signal_unlocked
(
p_playlist
->
p
->
p_fetcher
);
INSERT_ELEM
(
p_fetcher
->
pp_waiting
,
p_fetcher
->
i_waiting
,
p_fetcher
->
i_waiting
,
p_current
);
vlc_object_signal_unlocked
(
p_fetcher
);
}
else
vlc_gc_decref
(
p_current
);
vlc_object_unlock
(
p_
playlist
->
p
->
p_
fetcher
);
vlc_object_unlock
(
p_fetcher
);
}
else
{
...
...
src/playlist/playlist_internal.h
View file @
e3f0531d
...
...
@@ -58,13 +58,15 @@ typedef struct playlist_fetcher_t
DECL_ARRAY
(
playlist_album_t
)
albums
;
}
playlist_fetcher_t
;
struct
playlist_private_t
typedef
struct
playlist_private_t
{
playlist_t
*
p_playlist
;
/**< Public data */
playlist_t
public_data
;
playlist_preparse_t
preparse
;
/**< Preparser data */
playlist_fetcher_t
*
p_fetcher
;
/**< Meta and art fetcher object */
sout_instance_t
*
p_sout
;
/**< Kept sout instance */
};
}
playlist_private_t
;
#define pl_priv( pl ) ((playlist_private_t *)(pl))
/*****************************************************************************
* Prototypes
...
...
src/playlist/thread.c
View file @
e3f0531d
...
...
@@ -57,7 +57,7 @@ void __playlist_ThreadCreate( vlc_object_t *p_parent )
if
(
!
p_playlist
)
return
;
// Preparse
playlist_preparse_t
*
p_preparse
=
&
p
_playlist
->
p
->
preparse
;
playlist_preparse_t
*
p_preparse
=
&
p
l_priv
(
p_playlist
)
->
preparse
;
vlc_mutex_init
(
&
p_preparse
->
lock
);
vlc_cond_init
(
&
p_preparse
->
wait
);
p_preparse
->
i_waiting
=
0
;
...
...
@@ -74,30 +74,27 @@ void __playlist_ThreadCreate( vlc_object_t *p_parent )
// Secondary Preparse
static
const
char
fname
[]
=
"fetcher"
;
p_playlist
->
p
->
p_fetcher
=
playlist_fetcher_t
*
p_fetcher
=
pl_priv
(
p_playlist
)
->
p_fetcher
=
vlc_custom_create
(
p_playlist
,
sizeof
(
playlist_fetcher_t
),
VLC_OBJECT_GENERIC
,
fname
);
if
(
!
p_
playlist
->
p
->
p_
fetcher
)
if
(
!
p_fetcher
)
{
msg_Err
(
p_playlist
,
"unable to create secondary preparser"
);
vlc_object_release
(
p_playlist
);
return
;
}
p_playlist
->
p
->
p_fetcher
->
i_waiting
=
0
;
p_playlist
->
p
->
p_fetcher
->
pp_waiting
=
NULL
;
p_playlist
->
p
->
p_fetcher
->
i_art_policy
=
var_CreateGetInteger
(
p_playlist
,
"album-art"
);
p_fetcher
->
i_waiting
=
0
;
p_fetcher
->
pp_waiting
=
NULL
;
p_fetcher
->
i_art_policy
=
var_CreateGetInteger
(
p_playlist
,
"album-art"
);
vlc_object_set_destructor
(
p_playlist
->
p
->
p_fetcher
,
FetcherDestructor
);
vlc_object_attach
(
p_playlist
->
p
->
p_fetcher
,
p_playlist
);
if
(
vlc_thread_create
(
p_playlist
->
p
->
p_fetcher
,
"fetcher"
,
RunFetcher
,
vlc_object_set_destructor
(
p_fetcher
,
FetcherDestructor
);
vlc_object_attach
(
p_fetcher
,
p_playlist
);
if
(
vlc_thread_create
(
p_fetcher
,
"fetcher"
,
RunFetcher
,
VLC_THREAD_PRIORITY_LOW
,
false
)
)
{
msg_Err
(
p_playlist
,
"cannot spawn secondary preparse thread"
);
vlc_object_release
(
p_
playlist
->
p
->
p_
fetcher
);
vlc_object_release
(
p_fetcher
);
return
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment