Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • videolan/vlc
  • chouquette/vlc
  • bakiewicz.marek122/vlc
  • devnexen/vlc
  • rohanrajpal/vlc
  • blurrrb/vlc
  • gsoc/gsoc2019/darkapex/vlc
  • b1ue/vlc
  • fkuehne/vlc
  • magsoft/vlc
  • chub/vlc
  • cramiro9/vlc
  • robUx4/vlc
  • rom1v/vlc
  • akshayaky/vlc
  • tmk907/vlc
  • akymaster/vlc
  • govind.sharma/vlc
  • psilokos/vlc
  • xjbeta/vlc
  • jahan/vlc
  • 1480c1/vlc
  • amanchande/vlc
  • aaqib/vlc
  • rist/vlc
  • apol/vlc
  • mindfreeze/vlc
  • alexandre-janniaux/vlc
  • sandsmark/vlc
  • jagannatharjun/vlc
  • gsoc/gsoc2020/matiaslgonzalez/vlc
  • gsoc/gsoc2020/jagannatharjun/vlc
  • mstorsjo/vlc
  • gsoc/gsoc2020/vedenta/vlc
  • gsoc/gsoc2020/arnav-ishaan/vlc
  • gsoc/gsoc2020/andreduong/vlc
  • fuzun/vlc
  • gsoc/gsoc2020/vatsin/vlc
  • gsoc/gsoc2020/sagid/vlc
  • yaron/vlc
  • Phoenix/vlc
  • Garf/vlc
  • ePiratWorkarounds/vlc
  • tguillem/vlc
  • jnqnfe/vlc
  • mdc/vlc
  • Vedaa/vlc
  • rasa/vlc
  • quink/vlc
  • yealo/vlc
  • aleksey_ak/vlc
  • ePirat/vlc
  • ilya.yanok/vlc
  • asenat/vlc
  • m/vlc
  • bunjee/vlc
  • BLumia/vlc
  • sagudev/vlc
  • hamedmonji30/vlc
  • nullgemm/vlc
  • DivyamAhuja/vlc
  • thesamesam/vlc
  • dag7/vlc
  • snehil101/vlc
  • haasn/vlc
  • jbk/vlc
  • ValZapod/vlc
  • mfkl/vlc
  • WangChuan/vlc
  • core1024/vlc
  • GhostVaibhav/vlc
  • dfuhrmann/vlc
  • davide.prade/vlc
  • tmatth/vlc
  • Courmisch/vlc
  • zouya/vlc
  • hpi/vlc
  • EwoutH/vlc
  • aleung27/vlc
  • hengwu0/vlc
  • saladin/vlc
  • ashuio/vlc
  • richselwood/vlc
  • verma16Ayush/vlc
  • chemicalflash/vlc
  • PoignardAzur/vlc
  • huangjieNT/vlc
  • Blake-Haydon/vlc
  • AnuthaDev/vlc
  • gsoc/gsoc2021/mpd/vlc
  • nicolas_lequec/vlc
  • sambassaly/vlc
  • thresh/vlc
  • bonniegong/vlc
  • myaashish/vlc
  • stavros.vagionitis/vlc
  • ileoo/vlc
  • louis-santucci/vlc
  • cchristiansen/vlc
  • sabyasachi07/vlc
  • AbduAmeen/vlc
  • ashishb0410/vlc
  • urbanhusky/vlc
  • davidepietrasanta/vlc
  • riksleutelstad/vlc
  • jeremyVignelles/vlc
  • komh/vlc
  • iamjithinjohn/vlc
  • JohannesKauffmann/vlc2
  • kunglao/vlc
  • natzberg/vlc
  • jill/vlc
  • cwendling/vlc
  • adufou/vlc
  • ErwanAirone/vlc
  • HasinduDilshan10/vlc
  • vagrantc/vlc
  • rafiv/macos-bigsur-icon
  • Aymeriic/vlc
  • saranshg20/vlc
  • metzlove24/vlc
  • linkfanel/vlc
  • Ds886/vlc
  • metehan-arslan/vlc
  • Skantes/vlc
  • kgsandundananjaya96/vlc
  • mitchcapper/vlc
  • advaitgupta/vlc
  • StefanBruens/vlc
  • ratajs/vlc
  • T.M.F.B.3761/vlc
  • m222059/vlc
  • casemerrick/vlc
  • joshuaword2alt/vlc
  • sjwaddy/vlc
  • dima/vlc
  • Ybalrid/vlc
  • umxprime/vlc
  • eschmidt/vlc
  • vannieuwenhuysenmichelle/vlc
  • badcf00d/vlc
  • wesinator/vlc
  • louis/vlc
  • xqq/vlc
  • EmperorYP7/vlc
  • NicoLiam/vlc
  • loveleen/vlc
  • rofferom/vlc
  • rbultje/vlc
  • TheUnamed/vlc
  • pratiksharma341/vlc
  • Saurab17/vlc
  • purist.coder/vlc
  • Shuicheng/vlc
  • mdrrubel292/vlc
  • silverbleu00/vlc
  • metif12/vlc
  • asher-m/vlc
  • jeffk/vlc
  • Brandonbr1/vlc
  • beautyyuyanli/vlc
  • rego21/vlc
  • muyangren907/vlc
  • collectionbylawrencejason/vlc
  • evelez/vlc
  • GSMgeeth/vlc
  • Oneric/vlc
  • TJ5/vlc
  • XuanTung95/vlc
  • darrenjenny21/vlc
  • Trenly/vlc
  • RockyTDR/vlc
  • mjakubowski/vlc
  • caprica/vlc
  • ForteFrankie/vlc
  • seannamiller19/vlc
  • junlon2006/vlc
  • kiwiren6666/vlc
  • iuseiphonexs/vlc
  • fenngtun/vlc
  • Rajdutt999/vlc
  • typx/vlc
  • leon.vitanos/vlc
  • robertogarci0938/vlc
  • gsoc/gsoc2022/luc65r/vlc-mpd
  • skeller/vlc
  • MCJack123/vlc
  • luc65r/vlc-mpd
  • popov895/vlc
  • claucambra/vlc
  • brad/vlc
  • matthewmurua88/vlc
  • Tomas8874/vlc
  • philenotfound/vlc
  • makita-do3/vlc
  • LZXCorp/vlc
  • mar0x/vlc
  • senojetkennedy0102/vlc
  • shaneb243/vlc
  • ahmadbader/vlc
  • rajduttcse26/vlc-audio-filters
  • Juniorzito8415/vlc
  • achernyakov/vlc
  • lucasjetgroup/vlc
  • pupdoggy666/vlc
  • gmde9363/vlc
  • alexnwayne/vlc
  • bahareebrahimi781/vlc
  • hamad633666/vlc
  • umghof3112/vlc
  • joe0199771874/vlc
  • Octocats66666666/vlc
  • jjm_223/vlc
  • btech10110.19/vlc
  • sunnykfc028/vlc-audio-filters
  • loic/vlc
  • nguyenminhducmx1/vlc
  • JanekKrueger/vlc
  • bstubbington2/vlc
  • rcombs/vlc
  • Ordissimo/vlc
  • king7532/vlc
  • noobsauce101/vlc
  • schong0525/vlc
  • myQwil/vlc
  • apisbg91/vlc
  • geeboy0101017/vlc
  • kim.faughey/vlc
  • nurupo/vlc
  • yyusea/vlc
  • 0711235879.khco/vlc
  • ialo/vlc
  • iloveyeye2/vlc
  • gdtdftdqtd/vlc
  • leandroconsiglio/vlc
  • AndyHTML2012/vlc
  • ncz/vlc
  • lucenticus/vlc
  • knr1931/vlc
  • kjoonlee/vlc
  • chandrakant100/vlc-qt
  • johge42/vlc
  • polter/vlc
  • hexchain/vlc
  • Tushwrld/vlc
  • mztea928/vlc
  • jbelloncastro/vlc
  • alvinhochun/vlc
  • ghostpiratecrow/vlc
  • ujjwaltwitx/vlc
  • alexsonarin06/vlc
  • adrianbon76/vlc
  • altsod/vlc
  • damien.lucas44/vlc
  • dmytrivtaisa/vlc
  • utk202/vlc
  • aaxhrj/vlc
  • thomas.hermes/vlc
  • structurenewworldorder/vlc
  • slomo/vlc
  • wantlamy/vlc
  • musc.o3cminc/vlc
  • thebarshablog/vlc
  • kerrick/vlc
  • kratos142518/vlc
  • leogps/vlc
  • vacantron/vlc
  • luna_koly/vlc
  • Ratio2/vlc
  • anuoshemohammad/vlc
  • apsun/vlc
  • aaa1115910/vlc
  • alimotmoyo/vlc
  • Ambossmann/vlc
  • Sam-LearnsToCode/vlc
  • Chilledheart/vlc
  • Labnann/vlc
  • ktcoooot1/vlc
  • mohit-marathe/vlc
  • johnddx/vlc
  • manstabuk/vlc
  • Omar-ahmed314/vlc
  • vineethkm/vlc
  • 9Enemi86/vlc
  • radoslav.m.panteleev/vlc
  • ashishami2002/vlc
  • Corbax/vlc
  • firnasahmed/vlc
  • pelayarmalam4/vlc
  • c0ff330k/vlc
  • shikhindahikar/vlc
  • l342723951/vlc
  • christianschwandner/vlc
  • douniwan5788/vlc
  • 7damian7/vlc
  • ferdnyc/vlc
  • f.ales1/vlc
  • pandagby/vlc
  • BaaBaa/vlc
  • jewe37/vlc
  • w00drow/vlc
  • russelltg/vlc
  • ironicallygod/vlc
  • soumyaDghosh/vlc
  • linzihao1999/vlc
  • deyayush6/vlc
  • mibi88/vlc
  • newabdallah10/vlc
  • jhorbincolombia/vlc
  • rimvihaqueshupto/vlc
  • andrewkhon98/vlc
  • fab78/vlc
  • lapaz17/vlc
  • amanna13/vlc
  • mdakram28/vlc
  • 07jw1980/vlc
  • sohamgupta/vlc
  • Eson-Jia1/vlc
  • Sumou/vlc
  • vikram-kangotra/vlc
  • chalice191/vlc
  • olivercalder/vlc
  • aaasg4001/vlc
  • zipdox/vlc
  • kwizart/vlc
  • Dragon-S/vlc
  • jdemeule/vlc
  • gabriel_lt/vlc
  • locutusofborg/vlc
  • sammirata/vlc-librist
  • another/vlc
  • Benjamin_Loison/vlc
  • ahmedmoselhi/vlc
  • petergaal/vlc
  • huynhsontung/vlc
  • dariusmihut/vlc
  • tvermaashutosh/vlc
  • buti/vlc
  • Niram7777/vlc
  • rohan-here/vlc
  • balaji-sivasakthi/vlc
  • rlindner81/vlc
  • Kakadus/vlc
  • djain/vlc
  • ABBurmeister/vlc
  • craighuggins/vlc
  • orbea/vlc
  • maxos/vlc
  • aakarshmj/vlc
  • kblaschke/vlc
  • ankitm/vlc
  • advait-0/vlc
  • mohak2003/vlc
  • yselkowitz/vlc
  • AZM999/vlc-azm
  • andrey.turkin/vlc
  • Disha-Baghel/vlc
  • nowrep/vlc
  • Apeng/vlc
  • Choucroute_melba/vlc
  • autra/vlc
  • eclipseo/vlc
  • fhuber/vlc
  • olafhering/vlc
  • sdasda7777/vlc
  • 1div0/vlc
  • skosnits/vlc-extended-playlist-support
  • dnicolson/vlc
  • Timshel/vlc
  • octopols/vlc
  • MangalK/vlc
  • nima64/vlc
  • misawai/vlc
  • Alexander-Wilms/vlc
  • Maxime2/vlc-fork-for-visualizer
  • ww/vlc
  • jeske/vlc
  • sgross-emlix/vlc
  • morenonatural/vlc
  • freakingLovesVLC/vlc
  • borisgolovnev/vlc
  • mpromonet/vlc
  • diogo.simao-marques/vlc
  • masstock/vlc
  • pratikpatel8982/vlc
  • hugok79/vlc
  • longervision/vlc
  • abhiudaysurya/vlc
  • rishabhgarg/vlc
  • tumic/vlc
  • cart/vlc
  • shubham442/vlc
  • Aditya692005/vlc
  • sammirata/vlc4
  • syrykh/vlc
  • Vvorcun/macos-new-icon
  • AyaanshC/vlc
  • nasso/vlc
  • Quark/vlc
  • sebastinas/vlc
  • rhstone/vlc
  • talregev/vlc
  • Managor/vlc
403 results
Show changes
Commits on Source (7)
......@@ -464,6 +464,16 @@ typedef struct input_item_parser_cbs_t
size_t count, void *userdata);
} input_item_parser_cbs_t;
/**
* input item parser configuration struct
*/
struct input_item_parser_cfg {
/** Callbacks to be notified of the end of the parsing, can't be NULL */
const input_item_parser_cbs_t *cbs;
/** Opaque data used by parser callbacks */
void *cbs_data;
};
/**
* Parse an item asynchronously
*
......@@ -471,17 +481,16 @@ typedef struct input_item_parser_cbs_t
* input_item_parser_id_Interrupt() before receiving the on_ended() event in
* order to interrupt it.
*
* @param item the item to parse
* @param parent the parent obj
* @param cbs callbacks to be notified of the end of the parsing
* @param userdata opaque data used by parser callbacks
* @param item the item to parse
* @param cfg pointer to a configuration struct, can't be NULL
*
* @return a parser instance or NULL in case of error, the parser needs to be
* released with input_item_parser_id_Release()
*/
VLC_API input_item_parser_id_t *
input_item_Parse(input_item_t *item, vlc_object_t *parent,
const input_item_parser_cbs_t *cbs, void *userdata) VLC_USED;
input_item_Parse(vlc_object_t *parent, input_item_t *item,
const struct input_item_parser_cfg *cfg) VLC_USED;
/**
* Interrupts & cancels the parsing
......
......@@ -520,10 +520,12 @@ static const struct vlc_metadata_cbs preparseCallbacks = {
- (void)parseInputItem
{
_p_parserID = input_item_Parse(_vlcInputItem,
VLC_OBJECT(getIntf()),
&parserCallbacks,
(__bridge void *) self);
const struct input_item_parser_cfg cfg = {
.cbs = &parserCallbacks,
.cbs_data = (__bridge void *) self,
};
_p_parserID = input_item_Parse(VLC_OBJECT(getIntf()), _vlcInputItem, &cfg);
}
- (void)cancelParsing
......
......@@ -227,16 +227,20 @@ medialibrary::parser::Status MetadataExtractor::run( medialibrary::parser::IItem
if ( ctx.inputItem == nullptr )
return medialibrary::parser::Status::Fatal;
const input_item_parser_cbs_t cbs = {
static const input_item_parser_cbs_t cbs = {
&MetadataExtractor::onParserEnded,
&MetadataExtractor::onParserSubtreeAdded,
&MetadataExtractor::onAttachmentsAdded,
};
const struct input_item_parser_cfg cfg= {
.cbs = &cbs,
.cbs_data = std::addressof( ctx ),
};
m_currentCtx = &ctx;
ctx.inputItem->i_preparse_depth = 1;
ctx.inputParser = {
input_item_Parse( ctx.inputItem.get(), m_obj, &cbs,
std::addressof( ctx ) ),
input_item_Parse( m_obj, ctx.inputItem.get(), &cfg ),
&input_item_parser_id_Release
};
if ( ctx.inputParser == nullptr )
......
......@@ -170,7 +170,12 @@ static bool request_metadata_sync( libvlc_int_t *libvlc, input_item_t *media,
nullptr,
};
auto inputParser = vlc::wrap_cptr( input_item_Parse( media, VLC_OBJECT( libvlc ), &cbs, &req ),
const struct input_item_parser_cfg cfg= {
.cbs = &cbs,
.cbs_data = &req,
};
auto inputParser = vlc::wrap_cptr( input_item_Parse( VLC_OBJECT( libvlc ), media, &cfg ),
&input_item_parser_id_Release );
if ( inputParser == nullptr )
......
......@@ -2276,7 +2276,7 @@ vlc_input_decoder_Create( vlc_object_t *p_parent, const es_format_t *fmt, const
.clock = clock,
.resource = p_resource,
.sout = NULL,
.input_type = INPUT_TYPE_NONE,
.input_type = INPUT_TYPE_PLAYBACK,
.cbs = NULL, .cbs_data = NULL,
};
return decoder_New( p_parent, &cfg );
......
......@@ -803,7 +803,7 @@ static int EsOutSetRecord(es_out_sys_t *p_sys, bool b_record, const char *dir_pa
.clock = NULL,
.resource = input_priv(p_input)->p_resource,
.sout = p_sys->p_sout_record,
.input_type = INPUT_TYPE_NONE,
.input_type = INPUT_TYPE_PLAYBACK,
.cc_decoder = p_sys->cc_decoder,
.cbs = &decoder_cbs,
.cbs_data = p_es,
......@@ -2331,7 +2331,7 @@ static void EsOutCreateDecoder(es_out_sys_t *p_sys, es_out_id_t *p_es)
.clock = NULL,
.resource = priv->p_resource,
.sout = p_sys->p_sout_record,
.input_type = INPUT_TYPE_NONE,
.input_type = INPUT_TYPE_PLAYBACK,
.cc_decoder = p_sys->cc_decoder,
.cbs = &decoder_cbs,
.cbs_data = p_es,
......
......@@ -31,8 +31,8 @@ static inline void input_SendEvent(input_thread_t *p_input,
const struct vlc_input_event *event)
{
input_thread_private_t *priv = input_priv(p_input);
if(priv->events_cb)
priv->events_cb(p_input, event, priv->events_data);
if (priv->cbs != NULL && priv->cbs->on_event != NULL)
priv->cbs->on_event(p_input, event, priv->cbs_data);
}
/*****************************************************************************
......
......@@ -207,12 +207,11 @@ input_item_t *input_GetItem( input_thread_t *p_input )
}
#undef input_Create
input_thread_t *input_Create( vlc_object_t *p_parent,
input_thread_events_cb events_cb, void *events_data,
input_item_t *p_item, enum input_type type,
input_resource_t *p_resource,
vlc_renderer_item_t *p_renderer )
input_thread_t * input_Create( vlc_object_t *p_parent, input_item_t *p_item,
const struct vlc_input_thread_cfg *cfg )
{
assert(cfg != NULL);
/* Allocate descriptor */
input_thread_private_t *priv;
......@@ -231,7 +230,7 @@ input_thread_t *input_Create( vlc_object_t *p_parent,
char * psz_name = input_item_GetName( p_item );
const char *type_str;
switch (type)
switch (cfg->type)
{
case INPUT_TYPE_PREPARSING:
type_str = "preparsing ";
......@@ -240,7 +239,7 @@ input_thread_t *input_Create( vlc_object_t *p_parent,
type_str = "thumbnailing ";
break;
default:
type_str = "";
type_str = "playback";
break;
}
msg_Dbg( p_input, "Creating an input for %s'%s'", type_str, psz_name);
......@@ -250,9 +249,9 @@ input_thread_t *input_Create( vlc_object_t *p_parent,
input_item_ApplyOptions( VLC_OBJECT(p_input), p_item );
/* Init Common fields */
priv->events_cb = events_cb;
priv->events_data = events_data;
priv->type = type;
priv->cbs = cfg->cbs;
priv->cbs_data = cfg->cbs_data;
priv->type = cfg->type;
priv->i_start = 0;
priv->i_stop = 0;
priv->i_title_offset = input_priv(p_input)->i_seekpoint_offset = 0;
......@@ -264,8 +263,8 @@ input_thread_t *input_Create( vlc_object_t *p_parent,
TAB_INIT( priv->i_attachment, priv->attachment );
priv->p_sout = NULL;
priv->b_out_pace_control = priv->type == INPUT_TYPE_THUMBNAILING;
priv->p_renderer = p_renderer && priv->type != INPUT_TYPE_PREPARSING ?
vlc_renderer_item_hold( p_renderer ) : NULL;
priv->p_renderer = cfg->renderer && priv->type == INPUT_TYPE_PLAYBACK ?
vlc_renderer_item_hold( cfg->renderer ) : NULL;
priv->viewpoint_changed = false;
/* Fetch the viewpoint from the mediaplayer or the playlist if any */
......@@ -286,8 +285,7 @@ input_thread_t *input_Create( vlc_object_t *p_parent,
/* setup the preparse depth of the item
* if we are preparsing, use the i_preparse_depth of the parent item */
if( priv->type == INPUT_TYPE_PREPARSING
|| priv->type == INPUT_TYPE_THUMBNAILING )
if( priv->type != INPUT_TYPE_PLAYBACK )
{
p_input->obj.logger = NULL;
p_input->obj.no_interact = true;
......@@ -327,8 +325,8 @@ input_thread_t *input_Create( vlc_object_t *p_parent,
priv->slave = NULL;
/* */
if( p_resource )
priv->p_resource = input_resource_Hold( p_resource );
if( cfg->resource )
priv->p_resource = input_resource_Hold( cfg->resource );
else
priv->p_resource = input_resource_New( VLC_OBJECT( p_input ) );
input_resource_SetInput( priv->p_resource, p_input );
......@@ -350,7 +348,7 @@ input_thread_t *input_Create( vlc_object_t *p_parent,
input_item_SetESNowPlaying( p_item, NULL );
/* */
if( priv->type != INPUT_TYPE_PREPARSING && var_InheritBool( p_input, "stats" ) )
if( priv->type == INPUT_TYPE_PLAYBACK && var_InheritBool( p_input, "stats" ) )
priv->stats = input_stats_Create();
else
priv->stats = NULL;
......@@ -759,7 +757,7 @@ static int InitSout( input_thread_t * p_input )
{
input_thread_private_t *priv = input_priv(p_input);
if( priv->type == INPUT_TYPE_PREPARSING )
if( priv->type != INPUT_TYPE_PLAYBACK )
return VLC_SUCCESS;
/* Find a usable sout and attach it to p_input */
......@@ -845,7 +843,7 @@ static void InitTitle( input_thread_t * p_input, bool had_titles )
input_thread_private_t *priv = input_priv(p_input);
input_source_t *p_master = priv->master;
if( priv->type == INPUT_TYPE_PREPARSING )
if( priv->type != INPUT_TYPE_PLAYBACK )
return;
vlc_mutex_lock( &priv->p_item->lock );
......@@ -1361,7 +1359,7 @@ static int Init( input_thread_t * p_input )
}
}
if( priv->type != INPUT_TYPE_PREPARSING && priv->p_sout )
if( priv->type == INPUT_TYPE_PLAYBACK && priv->p_sout )
{
priv->b_out_pace_control = sout_StreamIsSynchronous(priv->p_sout);
msg_Dbg( p_input, "starting in %ssync mode",
......@@ -2529,9 +2527,9 @@ static demux_t *InputDemuxNew( input_thread_t *p_input, es_out_t *p_es_out,
vlc_object_t *obj = VLC_OBJECT(p_input);
/* create the underlying access stream */
bool preparsing = priv->type == INPUT_TYPE_PREPARSING;
stream_t *p_stream = stream_AccessNew( obj, p_input, p_es_out,
priv->type == INPUT_TYPE_PREPARSING,
url );
preparsing, url );
if( p_stream == NULL )
return NULL;
......@@ -2566,7 +2564,7 @@ static demux_t *InputDemuxNew( input_thread_t *p_input, es_out_t *p_es_out,
/* create a regular demux with the access stream created */
demux_t *demux = demux_NewAdvanced( obj, p_input, psz_demux, url, p_stream,
p_es_out, priv->type == INPUT_TYPE_PREPARSING );
p_es_out, preparsing );
if( demux != NULL )
return demux;
......@@ -2783,7 +2781,7 @@ static int InputSourceInit( input_source_t *in, input_thread_t *p_input,
/* get attachment
* FIXME improve for preparsing: move it after GET_META and check psz_arturl */
if( input_priv(p_input)->type != INPUT_TYPE_PREPARSING )
if( input_priv(p_input)->type == INPUT_TYPE_PLAYBACK )
{
if( demux_Control( in->p_demux, DEMUX_GET_TITLE_INFO,
&in->title, &in->i_title,
......
......@@ -49,7 +49,7 @@ typedef struct input_thread_t
*****************************************************************************/
enum input_type {
INPUT_TYPE_NONE,
INPUT_TYPE_PLAYBACK,
INPUT_TYPE_PREPARSING,
INPUT_TYPE_THUMBNAILING,
};
......@@ -321,10 +321,20 @@ struct vlc_input_event
};
};
typedef void (*input_thread_events_cb)( input_thread_t *input,
const struct vlc_input_event *event,
void *userdata);
struct vlc_input_thread_callbacks
{
void (*on_event)(input_thread_t *input, const struct vlc_input_event *event,
void *userdata);
};
struct vlc_input_thread_cfg
{
enum input_type type;
input_resource_t *resource;
vlc_renderer_item_t *renderer;
const struct vlc_input_thread_callbacks *cbs;
void *cbs_data;
};
/**
* Create a new input_thread_t.
*
......@@ -332,19 +342,13 @@ typedef void (*input_thread_events_cb)( input_thread_t *input,
* adding callback on the variables/events you want to monitor.
*
* \param p_parent a vlc_object
* \param events_cb the events virtual table
* \param events_data an opaque given to the events callbacks (\p events_cb)
* \param p_item an input item
* \param type the type of task the input is created for (thumbnailing, playback, ...)
* \param p_resource an optional input ressource
* \param p_renderer an optional renderer object to render the input to
* \param cfg pointer to a configuration struct, mandatory
* \return a pointer to the spawned input thread
*/
input_thread_t * input_Create( vlc_object_t *p_parent,
input_thread_events_cb events_cb, void *events_data,
input_item_t *, enum input_type type,
input_resource_t *, vlc_renderer_item_t* p_renderer ) VLC_USED;
#define input_Create(a,b,c,d,e,f,g) input_Create(VLC_OBJECT(a),b,c,d,e,f,g)
input_thread_t * input_Create( vlc_object_t *p_parent, input_item_t *item,
const struct vlc_input_thread_cfg *cfg ) VLC_USED;
#define input_Create(a,b,c) input_Create(VLC_OBJECT(a),b,c)
int input_Start( input_thread_t * );
......@@ -433,8 +437,8 @@ typedef struct input_thread_private_t
{
struct input_thread_t input;
input_thread_events_cb events_cb;
void *events_data;
const struct vlc_input_thread_callbacks *cbs;
void *cbs_data;
enum input_type type;
......
......@@ -88,19 +88,28 @@ input_item_parser_InputEvent(input_thread_t *input,
}
input_item_parser_id_t *
input_item_Parse(input_item_t *item, vlc_object_t *obj,
const input_item_parser_cbs_t *cbs, void *userdata)
input_item_Parse(vlc_object_t *obj, input_item_t *item,
const struct input_item_parser_cfg *cfg)
{
assert(cbs && cbs->on_ended);
assert(cfg != NULL && cfg->cbs != NULL && cfg->cbs->on_ended);
input_item_parser_id_t *parser = malloc(sizeof(*parser));
if (!parser)
return NULL;
parser->state = INIT_S;
parser->cbs = cbs;
parser->userdata = userdata;
parser->input = input_Create(obj, input_item_parser_InputEvent, parser,
item, INPUT_TYPE_PREPARSING, NULL, NULL);
parser->cbs = cfg->cbs;
parser->userdata = cfg->cbs_data;
static const struct vlc_input_thread_callbacks input_cbs = {
.on_event = input_item_parser_InputEvent,
};
const struct vlc_input_thread_cfg input_cfg = {
.type = INPUT_TYPE_PREPARSING,
.cbs = &input_cbs,
.cbs_data = parser,
};
parser->input = input_Create(obj, item, &input_cfg );
if (!parser->input || input_Start(parser->input))
{
if (parser->input)
......
......@@ -73,7 +73,7 @@ vlc_input_decoder_Create(vlc_object_t *parent, const es_format_t *fmt, const cha
.clock = clock,
.resource = p_resource,
.sout = NULL,
.input_type = INPUT_TYPE_NONE,
.input_type = INPUT_TYPE_PLAYBACK,
.cbs = NULL, .cbs_data = NULL,
};
return vlc_input_decoder_New(parent, &cfg);
......@@ -367,7 +367,7 @@ int main(void)
input_source_t *source = InputSourceNew();
struct vlc_input_es_out *out =
input_EsOutNew(input, source, 1.f, INPUT_TYPE_NONE);
input_EsOutNew(input, source, 1.f, INPUT_TYPE_PLAYBACK);
assert(out != NULL);
es_out_SetMode(out, ES_OUT_MODE_AUTO);
......
......@@ -170,9 +170,18 @@ RunnableRun(void *userdata)
vlc_tick_t now = vlc_tick_now();
static const struct vlc_input_thread_callbacks cbs = {
.on_event = on_thumbnailer_input_event,
};
const struct vlc_input_thread_cfg cfg = {
.type = INPUT_TYPE_THUMBNAILING,
.cbs = &cbs,
.cbs_data = task,
};
input_thread_t* input =
input_Create( thumbnailer->parent, on_thumbnailer_input_event, task,
task->item, INPUT_TYPE_THUMBNAILING, NULL, NULL );
input_Create( thumbnailer->parent, task->item, &cfg );
if (!input)
goto error;
......
......@@ -1136,9 +1136,19 @@ vlc_player_input_New(vlc_player_t *player, input_item_t *item)
input->ml.pos = -1.f;
input->ml.has_audio_tracks = input->ml.has_video_tracks = false;
input->thread = input_Create(player, input_thread_Events, input, item,
INPUT_TYPE_NONE, player->resource,
player->renderer);
static const struct vlc_input_thread_callbacks cbs = {
.on_event = input_thread_Events,
};
const struct vlc_input_thread_cfg cfg = {
.type = INPUT_TYPE_PLAYBACK,
.resource = player->resource,
.renderer = player->renderer,
.cbs = &cbs,
.cbs_data = input,
};
input->thread = input_Create(player, item, &cfg);
if (!input->thread)
{
free(input);
......
......@@ -221,7 +221,11 @@ Parse(struct task *task, vlc_tick_t deadline)
};
vlc_object_t *obj = task->preparser->owner;
task->parser = input_item_Parse(task->item, obj, &cbs, task);
const struct input_item_parser_cfg cfg = {
.cbs = &cbs,
.cbs_data = task,
};
task->parser = input_item_Parse(obj, task->item, &cfg);
if (!task->parser)
{
atomic_store_explicit(&task->preparse_status, ITEM_PREPARSE_FAILED,
......