VLC  3.0.15
preparser.h
Go to the documentation of this file.
1 /*****************************************************************************
2  * playlist_preparser.h:
3  *****************************************************************************
4  * Copyright (C) 1999-2008 VLC authors and VideoLAN
5  * $Id: 48862bdfb0d12c0daa8f75151c55a4dacda7db47 $
6  *
7  * Authors: Samuel Hocevar <sam@zoy.org>
8  * ClĂ©ment Stenac <zorglub@videolan.org>
9  *
10  * This program is free software; you can redistribute it and/or modify it
11  * under the terms of the GNU Lesser General Public License as published by
12  * the Free Software Foundation; either version 2.1 of the License, or
13  * (at your option) any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  * GNU Lesser General Public License for more details.
19  *
20  * You should have received a copy of the GNU Lesser General Public License
21  * along with this program; if not, write to the Free Software Foundation,
22  * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
23  *****************************************************************************/
24 
25 #ifndef _PLAYLIST_PREPARSER_H
26 #define _PLAYLIST_PREPARSER_H 1
27 
28 #include <vlc_input_item.h>
29 /**
30  * Preparser opaque structure.
31  *
32  * The preparser object will retrieve the meta data of any given input item in
33  * an asynchronous way.
34  * It will also issue art fetching requests.
35  */
37 
38 /**
39  * This function creates the preparser object and thread.
40  */
42 
43 /**
44  * This function enqueues the provided item to be preparsed.
45  *
46  * The input item is retained until the preparsing is done or until the
47  * preparser object is deleted.
48  * Listen to vlc_InputItemPreparseEnded event to get notified when item is
49  * preparsed.
50  *
51  * @param timeout maximum time allowed to preparse the item. If -1, the default
52  * "preparse-timeout" option will be used as a timeout. If 0, it will wait
53  * indefinitely. If > 0, the timeout will be used (in milliseconds).
54  * @param id unique id provided by the caller. This is can be used to cancel
55  * the request with playlist_preparser_Cancel()
56  */
59  int timeout, void *id );
60 
63 
64 /**
65  * This function cancel all preparsing requests for a given id
66  *
67  * @param id unique id given to playlist_preparser_Push()
68  */
70 
71 /**
72  * This function destroys the preparser object and thread.
73  *
74  * All pending input items will be released.
75  */
77 
78 /**
79  * This function deactivates the preparser
80  *
81  * All pending requests will be removed, and it will block until the currently
82  * running entity has finished (if any).
83  */
85 
86 #endif
87 
playlist_preparser_Cancel
void playlist_preparser_Cancel(playlist_preparser_t *, void *id)
This function cancel all preparsing requests for a given id.
Definition: preparser.c:188
playlist_preparser_fetcher_Push
void playlist_preparser_fetcher_Push(playlist_preparser_t *, input_item_t *, input_item_meta_request_option_t)
Definition: preparser.c:181
playlist_preparser_Deactivate
void playlist_preparser_Deactivate(playlist_preparser_t *)
This function deactivates the preparser.
Definition: preparser.c:193
background_worker_New
struct background_worker * background_worker_New(void *owner, struct background_worker_config *conf)
Create a background-worker.
Definition: background_worker.c:184
playlist_fetcher_Push
int playlist_fetcher_Push(playlist_fetcher_t *fetcher, input_item_t *item, input_item_meta_request_option_t options, int preparse_status)
This function enqueues the provided item to be art fetched.
Definition: fetcher.c:450
playlist_preparser_t::worker
struct background_worker * worker
Definition: preparser.c:55
playlist_preparser_Cancel
void playlist_preparser_Cancel(playlist_preparser_t *preparser, void *id)
This function cancel all preparsing requests for a given id.
Definition: preparser.c:188
background_worker_RequestProbe
void background_worker_RequestProbe(struct background_worker *worker)
Request the background-worker to probe the current task.
Definition: background_worker.c:250
background_worker.h
META_REQUEST_OPTION_SCOPE_NETWORK
Definition: vlc_input_item.h:366
background_worker_Cancel
void background_worker_Cancel(struct background_worker *worker, void *id)
Remove entities from the background-worker.
Definition: background_worker.c:245
ITEM_TYPE_PLAYLIST
Definition: vlc_input_item.h:115
fetcher.h
vlc_input_item.h
InputItemHold
static void InputItemHold(void *item)
Definition: preparser.c:118
vlc_common.h
input_Close
void input_Close(input_thread_t *p_input)
Close an input.
Definition: input.c:221
input_CreatePreparser
input_thread_t * input_CreatePreparser(vlc_object_t *parent, input_item_t *item)
Creates an item preparser.
Definition: input.c:159
var_InheritInteger
#define var_InheritInteger(o, n)
Definition: vlc_variables.h:612
input_item_t
Describes an input and is used to spawn input_thread_t objects.
Definition: vlc_input_item.h:58
ITEM_TYPE_FILE
Definition: vlc_input_item.h:110
playlist_preparser_Push
void playlist_preparser_Push(playlist_preparser_t *preparser, input_item_t *item, input_item_meta_request_option_t i_options, int timeout, void *id)
This function enqueues the provided item to be preparsed.
Definition: preparser.c:152
input_item_t::lock
vlc_mutex_t lock
Lock for the item.
Definition: vlc_input_item.h:93
playlist_preparser_t
Definition: preparser.c:33
playlist_preparser_t::deactivated
atomic_bool deactivated
Definition: preparser.c:56
VLC_EGENERIC
#define VLC_EGENERIC
Unspecified error.
Definition: vlc_common.h:350
PreparserCloseInput
static void PreparserCloseInput(void *preparser_, void *input_)
Definition: preparser.c:83
playlist_preparser_New
playlist_preparser_t * playlist_preparser_New(vlc_object_t *)
This function creates the preparser object and thread.
Definition: preparser.c:120
input_item_SetPreparsed
void input_item_SetPreparsed(input_item_t *p_i, bool b_preparsed)
Definition: item.c:75
background_worker_config
Definition: background_worker.h:21
vlc_value_t::i_int
int64_t i_int
Definition: vlc_common.h:327
var_DelCallback
#define var_DelCallback(a, b, c, d)
Definition: vlc_variables.h:165
playlist_preparser_Deactivate
void playlist_preparser_Deactivate(playlist_preparser_t *preparser)
This function deactivates the preparser.
Definition: preparser.c:193
ITEM_PREPARSE_FAILED
Definition: vlc_input_item.h:375
playlist_preparser_fetcher_Push
void playlist_preparser_fetcher_Push(playlist_preparser_t *preparser, input_item_t *item, input_item_meta_request_option_t options)
Definition: preparser.c:181
msg_Warn
#define msg_Warn(p_this,...)
Definition: vlc_messages.h:84
playlist_fetcher_t
Definition: fetcher.c:43
background_worker_config::default_timeout
mtime_t default_timeout
Default timeout for completing a task.
Definition: background_worker.h:44
i_type
int i_type
Definition: httpd.c:1250
background_worker
Definition: background_worker.c:37
ERROR_S
Definition: vlc_input.h:287
input_item_SignalPreparseEnded
void input_item_SignalPreparseEnded(input_item_t *p_i, int new_status)
Definition: item.c:68
ITEM_PREPARSE_DONE
Definition: vlc_input_item.h:377
InputEvent
static int InputEvent(vlc_object_t *obj, const char *varname, vlc_value_t old, vlc_value_t cur, void *worker)
Definition: preparser.c:41
background_worker_Push
int background_worker_Push(struct background_worker *worker, void *entity, void *id, int timeout)
Push an entity into the background-worker.
Definition: background_worker.c:208
input_thread_private_t::p_item
input_item_t * p_item
Definition: input_internal.h:135
playlist_preparser_t::fetcher
playlist_fetcher_t * fetcher
Definition: preparser.c:54
INPUT_EVENT_DEAD
Definition: vlc_input.h:327
input_item_meta_request_option_t
input_item_meta_request_option_t
Definition: vlc_input_item.h:362
PreparserProbeInput
static int PreparserProbeInput(void *preparser_, void *input_)
Definition: preparser.c:76
ITEM_TYPE_DIRECTORY
Definition: vlc_input_item.h:111
input_item_Release
void input_item_Release(input_item_t *p_item)
Releases an input item, i.e.
Definition: item.c:477
playlist_preparser_Push
void playlist_preparser_Push(playlist_preparser_t *, input_item_t *, input_item_meta_request_option_t, int timeout, void *id)
This function enqueues the provided item to be preparsed.
Definition: preparser.c:152
likely
#define likely(p)
Definition: vlc_common.h:113
vlc_object_t
The main vlc_object_t structure.
Definition: vlc_objects.h:39
background_worker_Delete
void background_worker_Delete(struct background_worker *worker)
Delete a background-worker.
Definition: background_worker.c:258
VLC_UNUSED
#define VLC_UNUSED(x)
Definition: vlc_common.h:912
PreparserOpenInput
static int PreparserOpenInput(void *preparser_, void *item_, void **out)
Definition: preparser.c:52
input_interface.h
VLC_SUCCESS
#define VLC_SUCCESS
No error.
Definition: vlc_common.h:349
input_priv
static input_thread_private_t * input_priv(input_thread_t *input)
Definition: input_internal.h:179
ITEM_TYPE_NODE
Definition: vlc_input_item.h:116
input_item_t::b_net
bool b_net
Net: always true for TYPE_STREAM, it depends for others types.
Definition: vlc_input_item.h:96
ITEM_PREPARSE_TIMEOUT
Definition: vlc_input_item.h:376
ITEM_PREPARSE_SKIPPED
Definition: vlc_input_item.h:374
playlist_fetcher_New
playlist_fetcher_t * playlist_fetcher_New(vlc_object_t *owner)
This function creates the fetcher object and thread.
Definition: fetcher.c:416
vlc_mutex_unlock
void vlc_mutex_unlock(vlc_mutex_t *p_mutex)
Releases a mutex.
Definition: thread.c:138
unlikely
#define unlikely(p)
Definition: vlc_common.h:114
var_AddCallback
#define var_AddCallback(a, b, c, d)
Definition: vlc_variables.h:164
playlist_fetcher_Delete
void playlist_fetcher_Delete(playlist_fetcher_t *fetcher)
This function destroys the fetcher object and thread.
Definition: fetcher.c:472
playlist_preparser_Delete
void playlist_preparser_Delete(playlist_preparser_t *)
This function destroys the preparser object and thread.
Definition: preparser.c:199
input_GetState
static input_state_e input_GetState(input_thread_t *p_input)
It will return the current state of the input.
Definition: vlc_input.h:543
END_S
Definition: vlc_input.h:286
playlist_preparser_Delete
void playlist_preparser_Delete(playlist_preparser_t *preparser)
This function destroys the preparser object and thread.
Definition: preparser.c:199
input_Start
int input_Start(input_thread_t *p_input)
Start a input_thread_t created by input_Create.
Definition: input.c:172
InputItemRelease
static void InputItemRelease(void *item)
Definition: preparser.c:117
input_thread_t
Main structure representing an input thread.
Definition: vlc_input.h:221
playlist_preparser_t::owner
vlc_object_t * owner
Definition: preparser.c:53
input_item_Hold
input_item_t * input_item_Hold(input_item_t *p_item)
Holds an input item, i.e.
Definition: item.c:469
playlist_preparser_New
playlist_preparser_t * playlist_preparser_New(vlc_object_t *parent)
This function creates the preparser object and thread.
Definition: preparser.c:120
input_internal.h
vlc_value_t
VLC value structure.
Definition: vlc_common.h:325
preparser.h
vlc_mutex_lock
void vlc_mutex_lock(vlc_mutex_t *p_mutex)
Acquires a mutex.
Definition: thread.c:123
input_item_t::i_type
uint8_t i_type
Type (file, disc, ...
Definition: vlc_input_item.h:95
input_Stop
void input_Stop(input_thread_t *p_input)
Request a running input thread to stop and die.
Definition: input.c:198