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
bad878b5
Commit
bad878b5
authored
Aug 31, 2008
by
Pierre d'Herbemont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
playlist: Fetcher and parser are playlist private.
parent
54166d1b
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
74 additions
and
64 deletions
+74
-64
include/vlc_playlist.h
include/vlc_playlist.h
+6
-2
src/input/meta.c
src/input/meta.c
+2
-2
src/playlist/control.c
src/playlist/control.c
+25
-25
src/playlist/engine.c
src/playlist/engine.c
+16
-16
src/playlist/playlist_internal.h
src/playlist/playlist_internal.h
+6
-0
src/playlist/thread.c
src/playlist/thread.c
+19
-19
No files found.
include/vlc_playlist.h
View file @
bad878b5
...
@@ -153,6 +153,8 @@ struct playlist_item_t
...
@@ -153,6 +153,8 @@ struct playlist_item_t
typedef
enum
typedef
enum
{
PLAYLIST_STOPPED
,
PLAYLIST_RUNNING
,
PLAYLIST_PAUSED
}
playlist_status_t
;
{
PLAYLIST_STOPPED
,
PLAYLIST_RUNNING
,
PLAYLIST_PAUSED
}
playlist_status_t
;
typedef
struct
playlist_private_t
playlist_private_t
;
/** Structure containing information about the playlist */
/** Structure containing information about the playlist */
struct
playlist_t
struct
playlist_t
{
{
...
@@ -200,8 +202,6 @@ struct playlist_t
...
@@ -200,8 +202,6 @@ struct playlist_t
int
i_order
;
/**< Last ordering applied to the playlist */
int
i_order
;
/**< Last ordering applied to the playlist */
mtime_t
gc_date
;
mtime_t
gc_date
;
bool
b_cant_sleep
;
bool
b_cant_sleep
;
playlist_preparse_t
*
p_preparse
;
/**< Preparser object */
playlist_fetcher_t
*
p_fetcher
;
/**< Meta and art fetcher object */
struct
{
struct
{
/* Current status. These fields are readonly, only the playlist
/* Current status. These fields are readonly, only the playlist
...
@@ -224,6 +224,10 @@ struct playlist_t
...
@@ -224,6 +224,10 @@ struct playlist_t
when processing the request */
when processing the request */
vlc_mutex_t
lock
;
/**< Lock to protect request */
vlc_mutex_t
lock
;
/**< Lock to protect request */
}
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 */
/** Helper to add an item */
...
...
src/input/meta.c
View file @
bad878b5
...
@@ -99,7 +99,7 @@ int input_ArtFind( playlist_t *p_playlist, input_item_t *p_item )
...
@@ -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 we already checked this album in this session, skip */
if
(
psz_artist
&&
psz_album
)
if
(
psz_artist
&&
psz_album
)
{
{
FOREACH_ARRAY
(
playlist_album_t
album
,
p_playlist
->
p_fetcher
->
albums
)
FOREACH_ARRAY
(
playlist_album_t
album
,
p_playlist
->
p
->
p
_fetcher
->
albums
)
if
(
!
strcmp
(
album
.
psz_artist
,
psz_artist
)
&&
if
(
!
strcmp
(
album
.
psz_artist
,
psz_artist
)
&&
!
strcmp
(
album
.
psz_album
,
psz_album
)
)
!
strcmp
(
album
.
psz_album
,
psz_album
)
)
{
{
...
@@ -179,7 +179,7 @@ int input_ArtFind( playlist_t *p_playlist, input_item_t *p_item )
...
@@ -179,7 +179,7 @@ int input_ArtFind( playlist_t *p_playlist, input_item_t *p_item )
a
.
psz_album
=
psz_album
;
a
.
psz_album
=
psz_album
;
a
.
psz_arturl
=
input_item_GetArtURL
(
p_item
);
a
.
psz_arturl
=
input_item_GetArtURL
(
p_item
);
a
.
b_found
=
(
i_ret
==
VLC_EGENERIC
?
false
:
true
);
a
.
b_found
=
(
i_ret
==
VLC_EGENERIC
?
false
:
true
);
ARRAY_APPEND
(
p_playlist
->
p_fetcher
->
albums
,
a
);
ARRAY_APPEND
(
p_playlist
->
p
->
p
_fetcher
->
albums
,
a
);
}
}
else
else
{
{
...
...
src/playlist/control.c
View file @
bad878b5
...
@@ -190,19 +190,19 @@ static int PlaylistVAControl( playlist_t * p_playlist, int i_query, va_list args
...
@@ -190,19 +190,19 @@ static int PlaylistVAControl( playlist_t * p_playlist, int i_query, va_list args
int
playlist_PreparseEnqueue
(
playlist_t
*
p_playlist
,
int
playlist_PreparseEnqueue
(
playlist_t
*
p_playlist
,
input_item_t
*
p_item
)
input_item_t
*
p_item
)
{
{
vlc_object_lock
(
p_playlist
->
p_preparse
);
vlc_object_lock
(
p_playlist
->
p
->
p
_preparse
);
if
(
!
vlc_object_alive
(
p_playlist
->
p_preparse
)
)
if
(
!
vlc_object_alive
(
p_playlist
->
p
->
p
_preparse
)
)
{
{
vlc_object_unlock
(
p_playlist
->
p_preparse
);
vlc_object_unlock
(
p_playlist
->
p
->
p
_preparse
);
return
VLC_EGENERIC
;
return
VLC_EGENERIC
;
}
}
vlc_gc_incref
(
p_item
);
vlc_gc_incref
(
p_item
);
INSERT_ELEM
(
p_playlist
->
p_preparse
->
pp_waiting
,
INSERT_ELEM
(
p_playlist
->
p
->
p
_preparse
->
pp_waiting
,
p_playlist
->
p_preparse
->
i_waiting
,
p_playlist
->
p
->
p
_preparse
->
i_waiting
,
p_playlist
->
p_preparse
->
i_waiting
,
p_playlist
->
p
->
p
_preparse
->
i_waiting
,
p_item
);
p_item
);
vlc_object_signal_unlocked
(
p_playlist
->
p_preparse
);
vlc_object_signal_unlocked
(
p_playlist
->
p
->
p
_preparse
);
vlc_object_unlock
(
p_playlist
->
p_preparse
);
vlc_object_unlock
(
p_playlist
->
p
->
p
_preparse
);
return
VLC_SUCCESS
;
return
VLC_SUCCESS
;
}
}
...
@@ -212,15 +212,15 @@ int playlist_PreparseEnqueueItem( playlist_t *p_playlist,
...
@@ -212,15 +212,15 @@ int playlist_PreparseEnqueueItem( playlist_t *p_playlist,
playlist_item_t
*
p_item
)
playlist_item_t
*
p_item
)
{
{
vlc_object_lock
(
p_playlist
);
vlc_object_lock
(
p_playlist
);
vlc_object_lock
(
p_playlist
->
p_preparse
);
vlc_object_lock
(
p_playlist
->
p
->
p
_preparse
);
if
(
!
vlc_object_alive
(
p_playlist
->
p_preparse
)
)
if
(
!
vlc_object_alive
(
p_playlist
->
p
->
p
_preparse
)
)
{
{
vlc_object_unlock
(
p_playlist
->
p_preparse
);
vlc_object_unlock
(
p_playlist
->
p
->
p
_preparse
);
vlc_object_unlock
(
p_playlist
);
vlc_object_unlock
(
p_playlist
);
return
VLC_EGENERIC
;
return
VLC_EGENERIC
;
}
}
PreparseEnqueueItemSub
(
p_playlist
,
p_item
);
PreparseEnqueueItemSub
(
p_playlist
,
p_item
);
vlc_object_unlock
(
p_playlist
->
p_preparse
);
vlc_object_unlock
(
p_playlist
->
p
->
p
_preparse
);
vlc_object_unlock
(
p_playlist
);
vlc_object_unlock
(
p_playlist
);
return
VLC_SUCCESS
;
return
VLC_SUCCESS
;
}
}
...
@@ -228,19 +228,19 @@ int playlist_PreparseEnqueueItem( playlist_t *p_playlist,
...
@@ -228,19 +228,19 @@ int playlist_PreparseEnqueueItem( playlist_t *p_playlist,
int
playlist_AskForArtEnqueue
(
playlist_t
*
p_playlist
,
int
playlist_AskForArtEnqueue
(
playlist_t
*
p_playlist
,
input_item_t
*
p_item
)
input_item_t
*
p_item
)
{
{
vlc_object_lock
(
p_playlist
->
p_fetcher
);
vlc_object_lock
(
p_playlist
->
p
->
p
_fetcher
);
if
(
!
vlc_object_alive
(
p_playlist
->
p_fetcher
)
)
if
(
!
vlc_object_alive
(
p_playlist
->
p
->
p
_fetcher
)
)
{
{
vlc_object_unlock
(
p_playlist
->
p_fetcher
);
vlc_object_unlock
(
p_playlist
->
p
->
p
_fetcher
);
return
VLC_EGENERIC
;
return
VLC_EGENERIC
;
}
}
vlc_gc_incref
(
p_item
);
vlc_gc_incref
(
p_item
);
INSERT_ELEM
(
p_playlist
->
p_fetcher
->
pp_waiting
,
INSERT_ELEM
(
p_playlist
->
p
->
p
_fetcher
->
pp_waiting
,
p_playlist
->
p_fetcher
->
i_waiting
,
p_playlist
->
p
->
p
_fetcher
->
i_waiting
,
p_playlist
->
p_fetcher
->
i_waiting
,
p_item
);
p_playlist
->
p
->
p
_fetcher
->
i_waiting
,
p_item
);
vlc_object_signal_unlocked
(
p_playlist
->
p_fetcher
);
vlc_object_signal_unlocked
(
p_playlist
->
p
->
p
_fetcher
);
vlc_object_unlock
(
p_playlist
->
p_fetcher
);
vlc_object_unlock
(
p_playlist
->
p
->
p
_fetcher
);
return
VLC_SUCCESS
;
return
VLC_SUCCESS
;
}
}
...
@@ -251,9 +251,9 @@ static void PreparseEnqueueItemSub( playlist_t *p_playlist,
...
@@ -251,9 +251,9 @@ static void PreparseEnqueueItemSub( playlist_t *p_playlist,
if
(
p_item
->
i_children
==
-
1
)
if
(
p_item
->
i_children
==
-
1
)
{
{
vlc_gc_incref
(
p_item
->
p_input
);
vlc_gc_incref
(
p_item
->
p_input
);
INSERT_ELEM
(
p_playlist
->
p_preparse
->
pp_waiting
,
INSERT_ELEM
(
p_playlist
->
p
->
p
_preparse
->
pp_waiting
,
p_playlist
->
p_preparse
->
i_waiting
,
p_playlist
->
p
->
p
_preparse
->
i_waiting
,
p_playlist
->
p_preparse
->
i_waiting
,
p_playlist
->
p
->
p
_preparse
->
i_waiting
,
p_item
->
p_input
);
p_item
->
p_input
);
}
}
else
else
...
@@ -540,8 +540,8 @@ int playlist_PlayItem( playlist_t *p_playlist, playlist_item_t *p_item )
...
@@ -540,8 +540,8 @@ int playlist_PlayItem( playlist_t *p_playlist, playlist_item_t *p_item )
}
}
free
(
psz_uri
);
free
(
psz_uri
);
if
(
p_playlist
->
p_fetcher
&&
if
(
p_playlist
->
p
->
p
_fetcher
&&
p_playlist
->
p_fetcher
->
i_art_policy
==
ALBUM_ART_WHEN_PLAYED
)
p_playlist
->
p
->
p
_fetcher
->
i_art_policy
==
ALBUM_ART_WHEN_PLAYED
)
{
{
bool
b_has_art
;
bool
b_has_art
;
...
...
src/playlist/engine.c
View file @
bad878b5
...
@@ -174,14 +174,14 @@ static void playlist_Destructor( vlc_object_t * p_this )
...
@@ -174,14 +174,14 @@ static void playlist_Destructor( vlc_object_t * p_this )
{
{
playlist_t
*
p_playlist
=
(
playlist_t
*
)
p_this
;
playlist_t
*
p_playlist
=
(
playlist_t
*
)
p_this
;
if
(
p_playlist
->
p_preparse
)
if
(
p_playlist
->
p
->
p
_preparse
)
{
{
vlc_object_release
(
p_playlist
->
p_preparse
);
vlc_object_release
(
p_playlist
->
p
->
p
_preparse
);
}
}
if
(
p_playlist
->
p_fetcher
)
if
(
p_playlist
->
p
->
p
_fetcher
)
{
{
vlc_object_release
(
p_playlist
->
p_fetcher
);
vlc_object_release
(
p_playlist
->
p
->
p
_fetcher
);
}
}
msg_Dbg
(
p_this
,
"Destroyed"
);
msg_Dbg
(
p_this
,
"Destroyed"
);
}
}
...
@@ -517,10 +517,10 @@ void playlist_LastLoop( playlist_t *p_playlist )
...
@@ -517,10 +517,10 @@ void playlist_LastLoop( playlist_t *p_playlist )
playlist_ServicesDiscoveryKillAll
(
p_playlist
);
playlist_ServicesDiscoveryKillAll
(
p_playlist
);
playlist_MLDump
(
p_playlist
);
playlist_MLDump
(
p_playlist
);
vlc_object_kill
(
p_playlist
->
p_preparse
);
vlc_object_kill
(
p_playlist
->
p
->
p
_preparse
);
vlc_thread_join
(
p_playlist
->
p_preparse
);
vlc_thread_join
(
p_playlist
->
p
->
p
_preparse
);
vlc_object_kill
(
p_playlist
->
p_fetcher
);
vlc_object_kill
(
p_playlist
->
p
->
p
_fetcher
);
vlc_thread_join
(
p_playlist
->
p_fetcher
);
vlc_thread_join
(
p_playlist
->
p
->
p
_fetcher
);
PL_LOCK
;
PL_LOCK
;
...
@@ -603,21 +603,21 @@ void playlist_PreparseLoop( playlist_preparse_t *p_obj )
...
@@ -603,21 +603,21 @@ void playlist_PreparseLoop( playlist_preparse_t *p_obj )
*/
*/
char
*
psz_arturl
=
input_item_GetArtURL
(
p_current
);
char
*
psz_arturl
=
input_item_GetArtURL
(
p_current
);
char
*
psz_name
=
input_item_GetName
(
p_current
);
char
*
psz_name
=
input_item_GetName
(
p_current
);
if
(
p_playlist
->
p_fetcher
->
i_art_policy
==
ALBUM_ART_ALL
&&
if
(
p_playlist
->
p
->
p
_fetcher
->
i_art_policy
==
ALBUM_ART_ALL
&&
(
!
psz_arturl
||
strncmp
(
psz_arturl
,
"file://"
,
7
)
)
)
(
!
psz_arturl
||
strncmp
(
psz_arturl
,
"file://"
,
7
)
)
)
{
{
PL_DEBUG
(
"meta ok for %s, need to fetch art"
,
psz_name
);
PL_DEBUG
(
"meta ok for %s, need to fetch art"
,
psz_name
);
vlc_object_lock
(
p_playlist
->
p_fetcher
);
vlc_object_lock
(
p_playlist
->
p
->
p
_fetcher
);
if
(
vlc_object_alive
(
p_playlist
->
p_fetcher
)
)
if
(
vlc_object_alive
(
p_playlist
->
p
->
p
_fetcher
)
)
{
{
INSERT_ELEM
(
p_playlist
->
p_fetcher
->
pp_waiting
,
INSERT_ELEM
(
p_playlist
->
p
->
p
_fetcher
->
pp_waiting
,
p_playlist
->
p_fetcher
->
i_waiting
,
p_playlist
->
p
->
p
_fetcher
->
i_waiting
,
p_playlist
->
p_fetcher
->
i_waiting
,
p_current
);
p_playlist
->
p
->
p
_fetcher
->
i_waiting
,
p_current
);
vlc_object_signal_unlocked
(
p_playlist
->
p_fetcher
);
vlc_object_signal_unlocked
(
p_playlist
->
p
->
p
_fetcher
);
}
}
else
else
vlc_gc_decref
(
p_current
);
vlc_gc_decref
(
p_current
);
vlc_object_unlock
(
p_playlist
->
p_fetcher
);
vlc_object_unlock
(
p_playlist
->
p
->
p
_fetcher
);
}
}
else
else
{
{
...
...
src/playlist/playlist_internal.h
View file @
bad878b5
...
@@ -37,6 +37,12 @@
...
@@ -37,6 +37,12 @@
#include "input/input_internal.h"
#include "input/input_internal.h"
#include <assert.h>
#include <assert.h>
struct
playlist_private_t
{
playlist_preparse_t
*
p_preparse
;
/**< Preparser object */
playlist_fetcher_t
*
p_fetcher
;
/**< Meta and art fetcher object */
};
struct
playlist_preparse_t
struct
playlist_preparse_t
{
{
VLC_COMMON_MEMBERS
VLC_COMMON_MEMBERS
...
...
src/playlist/thread.c
View file @
bad878b5
...
@@ -60,57 +60,57 @@ void __playlist_ThreadCreate( vlc_object_t *p_parent )
...
@@ -60,57 +60,57 @@ void __playlist_ThreadCreate( vlc_object_t *p_parent )
// Preparse
// Preparse
static
const
char
ppname
[]
=
"preparser"
;
static
const
char
ppname
[]
=
"preparser"
;
p_playlist
->
p_preparse
=
p_playlist
->
p
->
p
_preparse
=
vlc_custom_create
(
p_playlist
,
sizeof
(
playlist_preparse_t
),
vlc_custom_create
(
p_playlist
,
sizeof
(
playlist_preparse_t
),
VLC_OBJECT_GENERIC
,
ppname
);
VLC_OBJECT_GENERIC
,
ppname
);
if
(
!
p_playlist
->
p_preparse
)
if
(
!
p_playlist
->
p
->
p
_preparse
)
{
{
msg_Err
(
p_playlist
,
"unable to create preparser"
);
msg_Err
(
p_playlist
,
"unable to create preparser"
);
vlc_object_release
(
p_playlist
);
vlc_object_release
(
p_playlist
);
return
;
return
;
}
}
p_playlist
->
p_preparse
->
psz_object_name
=
strdup
(
"preparser"
);
p_playlist
->
p
->
p
_preparse
->
psz_object_name
=
strdup
(
"preparser"
);
p_playlist
->
p_preparse
->
i_waiting
=
0
;
p_playlist
->
p
->
p
_preparse
->
i_waiting
=
0
;
p_playlist
->
p_preparse
->
pp_waiting
=
NULL
;
p_playlist
->
p
->
p
_preparse
->
pp_waiting
=
NULL
;
vlc_object_set_destructor
(
p_playlist
->
p_preparse
,
PreparseDestructor
);
vlc_object_set_destructor
(
p_playlist
->
p
->
p
_preparse
,
PreparseDestructor
);
vlc_object_attach
(
p_playlist
->
p_preparse
,
p_playlist
);
vlc_object_attach
(
p_playlist
->
p
->
p
_preparse
,
p_playlist
);
if
(
vlc_thread_create
(
p_playlist
->
p_preparse
,
"preparser"
,
if
(
vlc_thread_create
(
p_playlist
->
p
->
p
_preparse
,
"preparser"
,
RunPreparse
,
VLC_THREAD_PRIORITY_LOW
,
true
)
)
RunPreparse
,
VLC_THREAD_PRIORITY_LOW
,
true
)
)
{
{
msg_Err
(
p_playlist
,
"cannot spawn preparse thread"
);
msg_Err
(
p_playlist
,
"cannot spawn preparse thread"
);
vlc_object_release
(
p_playlist
->
p_preparse
);
vlc_object_release
(
p_playlist
->
p
->
p
_preparse
);
return
;
return
;
}
}
// Secondary Preparse
// Secondary Preparse
static
const
char
fname
[]
=
"fetcher"
;
static
const
char
fname
[]
=
"fetcher"
;
p_playlist
->
p_fetcher
=
p_playlist
->
p
->
p
_fetcher
=
vlc_custom_create
(
p_playlist
,
sizeof
(
playlist_fetcher_t
),
vlc_custom_create
(
p_playlist
,
sizeof
(
playlist_fetcher_t
),
VLC_OBJECT_GENERIC
,
fname
);
VLC_OBJECT_GENERIC
,
fname
);
if
(
!
p_playlist
->
p_fetcher
)
if
(
!
p_playlist
->
p
->
p
_fetcher
)
{
{
msg_Err
(
p_playlist
,
"unable to create secondary preparser"
);
msg_Err
(
p_playlist
,
"unable to create secondary preparser"
);
vlc_object_release
(
p_playlist
);
vlc_object_release
(
p_playlist
);
return
;
return
;
}
}
p_playlist
->
p_fetcher
->
psz_object_name
=
strdup
(
"fetcher"
);
p_playlist
->
p
->
p
_fetcher
->
psz_object_name
=
strdup
(
"fetcher"
);
p_playlist
->
p_fetcher
->
i_waiting
=
0
;
p_playlist
->
p
->
p
_fetcher
->
i_waiting
=
0
;
p_playlist
->
p_fetcher
->
pp_waiting
=
NULL
;
p_playlist
->
p
->
p
_fetcher
->
pp_waiting
=
NULL
;
p_playlist
->
p_fetcher
->
i_art_policy
=
var_CreateGetInteger
(
p_playlist
,
p_playlist
->
p
->
p
_fetcher
->
i_art_policy
=
var_CreateGetInteger
(
p_playlist
,
"album-art"
);
"album-art"
);
vlc_object_set_destructor
(
p_playlist
->
p_fetcher
,
FetcherDestructor
);
vlc_object_set_destructor
(
p_playlist
->
p
->
p
_fetcher
,
FetcherDestructor
);
vlc_object_attach
(
p_playlist
->
p_fetcher
,
p_playlist
);
vlc_object_attach
(
p_playlist
->
p
->
p
_fetcher
,
p_playlist
);
if
(
vlc_thread_create
(
p_playlist
->
p_fetcher
,
if
(
vlc_thread_create
(
p_playlist
->
p
->
p
_fetcher
,
"fetcher"
,
"fetcher"
,
RunFetcher
,
RunFetcher
,
VLC_THREAD_PRIORITY_LOW
,
true
)
)
VLC_THREAD_PRIORITY_LOW
,
true
)
)
{
{
msg_Err
(
p_playlist
,
"cannot spawn secondary preparse thread"
);
msg_Err
(
p_playlist
,
"cannot spawn secondary preparse thread"
);
vlc_object_release
(
p_playlist
->
p_fetcher
);
vlc_object_release
(
p_playlist
->
p
->
p
_fetcher
);
return
;
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