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
  • abdsaber000/vlc
  • falbrechtskirchinger/vlc
  • b.sullender/vlc
  • hulxv/vlc
  • zyad-ayad/vlc
  • gremlinflat/vlc
  • Pratham24D/vlc
  • hmaarrfk/vlc
  • imxieyi/vlc
  • alexandru_babacea/vlc
  • jeromeb/vlc
  • kartix1504/vlc-project
  • aloisw/vlc
  • woodruffw/vlc
  • Shivam7/vlc
  • elmokh/vlc
  • AhmedHamed3699/vlc
  • eigenvoid/vlc
  • shocknovaa/vlc
  • r8420/vlc
  • BY01R/vlc-gsoc
  • jiez/vlc
  • lmlice/vlc
  • zsiec/vlc
  • devin.heitmueller/vlc
  • fuzun/vlc-flatpak-playground
  • matmaul/vlc
  • Astrom/vlc
431 results
Show changes
Commits on Source (9)
  • Ayush Dey's avatar
    input: add priority based metadata merging · cb4c8128
    Ayush Dey authored and Steve Lhomme's avatar Steve Lhomme committed
    The vlc_meta_t struct now uses an array of struct vlc_meta_value objects to store
    metadata values along with their associated priorities (VLC_META_PRIORITY_BASIC,
    VLC_META_PRIORITY_PLAYLIST, VLC_META_PRIORITY_INBAND).
    Modified the vlc_meta_Merge function to support priority-based metadata merging.
    Metadata values and extra tags in the destination (dst) are only overwritten by
    source (src) values if the source's priority is greater than or equal to the
    destination's priority.
    Refs #4143
    cb4c8128
  • Ayush Dey's avatar
    input: add functions to set metadata with priority · 118925e3
    Ayush Dey authored and Steve Lhomme's avatar Steve Lhomme committed
    Rename `vlc_meta_Set` to `vlc_meta_SetWithPriority` and `vlc_meta_SetExtra` to
    `vlc_meta_SetExtraWithPriority`. These functions now accept an additional `priority`
    argument to set the metadata priority for a given key.
    
    Add two macros, `vlc_meta_Set` and `vlc_meta_SetExtra`, which call their respective
    functions with `VLC_META_PRIORITY_BASIC` as the default priority.
    Refs #4143
    118925e3
  • Ayush Dey's avatar
    lua: modify TRY_META macro to call vlc_meta_SetWithPriority · fd442e5a
    Ayush Dey authored and Steve Lhomme's avatar Steve Lhomme committed
    In TRY_META macro, replace input_item_Set##b() with vlc_meta_SetWithPriority().
    Rename the TrackNum field to TrackNumber and ArtURL to ArtworkURL for
    consistency with the vlc_meta_type_t enumeration.
    Refs #4143
    fd442e5a
  • Ayush Dey's avatar
    lua: add trusted metadata property · 192ae78b
    Ayush Dey authored and Steve Lhomme's avatar Steve Lhomme committed
    Add function `file_is_playlist` to parse the `trusted` property
    of a file. This function will be used to upgrade the metadata
    priority from `VLC_META_PRIORITY_BASIC` to `VLC_META_PRIORITY_PLAYLIST`
    for files marked as trusted. Set the `trusted` property of CUE files
    as they require playlist metadata priority.
    Refs #4143
    192ae78b
  • Ayush Dey's avatar
    lua: set metadata priority based on `trusted` property · a4c26155
    Ayush Dey authored and Steve Lhomme's avatar Steve Lhomme committed
    Check for value of parsed `trusted` property. If the trusted
    property is true, the metadata priority is elevated to VLC_META_PRIORITY_PLAYLIST.
    If trusted is false, the metadata priority defaults to VLC_META_PRIORITY_BASIC.
    
    Refs #4143
    a4c26155
  • Ayush Dey's avatar
    input: split StartTitle function into StartTitle and SetStopStart · 015a65ac
    Ayush Dey authored and Steve Lhomme's avatar Steve Lhomme committed
    This commit splits the StartTitle function and introduces the SetStopStart
    function, which is responsible for assigning the 'start-time' and 'stop-time'
    values of the track to the `priv->i_start` and `priv->i_stop` variables.
    Refs #4143
    015a65ac
  • Ayush Dey's avatar
    input: call SetStopStart() for all input threads · 1adfce74
    Ayush Dey authored and Steve Lhomme's avatar Steve Lhomme committed
    Move the SetStopStart function to ensure it is called for all input threads, especially
    during preparsing. It ensures that the correct timings are used before the duration of
    the input_item_t is set. Previously, 'start-time' and 'stop-time' values were not parsed
    during preparation, leading to priv->i_start and priv->i_stop defaulting to 0.
    Refs #4143
    1adfce74
  • Ayush Dey's avatar
    input: add input_SetItemDuration function · c86e464f
    Ayush Dey authored and Steve Lhomme's avatar Steve Lhomme committed
    Add input_SetItemDuration wrapper function to use the 'start-time' and
    'stop-time' values to calculate the track duration.
    Refs #4143
    c86e464f
  • Ayush Dey's avatar
    input: replace input_item_SetDuration calls with input_SetItemDuration · bf5b6d59
    Ayush Dey authored and Steve Lhomme's avatar Steve Lhomme committed
    Fixes #4143
    
    In a `vlc_meta_t` object, each metadata key is associated with a priority:
    VLC_META_PRIORITY_BASIC, VLC_META_PRIORITY_PLAYLIST, or VLC_META_PRIORITY_INBAND.
    During metadata merging, keys with higher or equal priority can override those
    with lower priority. When parsing playlist metadata from a CUE file, keys are now
    assigned a priority of VLC_META_PRIORITY_PLAYLIST. This change prevents subsequent
    audio files, which have VLC_META_PRIORITY_BASIC, from overriding the playlist metadata.
    
    Additionally, this commit ensures that the duration of individual tracks is calculated
    using the 'start-time' and 'stop-time' options. This prevents the total track duration
    from overriding the individual track durations in the playlist.
    bf5b6d59
......@@ -62,6 +62,13 @@ typedef enum vlc_meta_type_t
#define VLC_META_TYPE_COUNT 27
typedef enum
{
VLC_META_PRIORITY_BASIC,
VLC_META_PRIORITY_PLAYLIST,
VLC_META_PRIORITY_INBAND
} vlc_meta_priority_t;
#define ITEM_PREPARSED 1
#define ITEM_ART_FETCHED 2
#define ITEM_ART_NOTFOUND 4
......@@ -73,7 +80,7 @@ struct vlc_meta_t;
VLC_API vlc_meta_t * vlc_meta_New( void ) VLC_USED;
VLC_API void vlc_meta_Delete( vlc_meta_t *m );
VLC_API void vlc_meta_Set( vlc_meta_t *p_meta, vlc_meta_type_t meta_type, const char *psz_val );
VLC_API void vlc_meta_SetWithPriority( vlc_meta_t *p_meta, vlc_meta_type_t meta_type, const char *psz_val, vlc_meta_priority_t priority );
VLC_API const char * vlc_meta_Get( const vlc_meta_t *p_meta, vlc_meta_type_t meta_type );
/**
......@@ -83,8 +90,9 @@ VLC_API const char * vlc_meta_Get( const vlc_meta_t *p_meta, vlc_meta_type_t met
* \param psz_name meta extra name (nonnullable)
* \param psz_value meta extra value (nullable)
* Removed from meta extra if set to NULL
* \param priority metadata priority (in terms of vlc_meta_priority_t)
*/
VLC_API void vlc_meta_SetExtra( vlc_meta_t *m, const char *psz_name, const char *psz_value );
VLC_API void vlc_meta_SetExtraWithPriority( vlc_meta_t *m, const char *psz_name, const char *psz_value, vlc_meta_priority_t priority );
VLC_API const char * vlc_meta_GetExtra( const vlc_meta_t *m, const char *psz_name );
VLC_API unsigned vlc_meta_GetExtraCount( const vlc_meta_t *m );
......@@ -115,6 +123,9 @@ typedef struct meta_export_t
VLC_API int input_item_WriteMeta(vlc_object_t *, input_item_t *);
#define vlc_meta_Set( meta, meta_type, b ) vlc_meta_SetWithPriority( meta, meta_type, b, VLC_META_PRIORITY_BASIC )
#define vlc_meta_SetExtra( meta, psz_name, psz_value ) vlc_meta_SetExtraWithPriority( meta, psz_name, psz_value, VLC_META_PRIORITY_BASIC )
/* Setters for meta.
* Warning: Make sure to use the input_item meta setters (defined in vlc_input_item.h)
* instead of those one. */
......
......@@ -95,6 +95,18 @@ static int file_compare( const char **a, const char **b )
return strcmp( *a, *b );
}
/* Function to parse the trusted property of a file */
static bool file_is_playlist( lua_State *L )
{
bool trusted = false;
lua_getfield(L, -1, "trusted");
if( !lua_isnil(L, -1) && lua_isboolean(L, -1) )
trusted = lua_toboolean(L, -1);
lua_pop( L, 1 );
return trusted;
}
static char **vlclua_dir_list_append( char **restrict list, char *basedir,
const char *luadirname )
{
......@@ -246,6 +258,8 @@ char *vlclua_find_file( const char *psz_luadirname, const char *psz_name )
void vlclua_read_meta_data( vlc_object_t *p_this, lua_State *L,
input_item_t *p_input )
{
vlc_meta_priority_t priority = file_is_playlist( L )? VLC_META_PRIORITY_PLAYLIST:
VLC_META_PRIORITY_BASIC;
#define TRY_META( a, b ) \
lua_getfield( L, -1, a ); \
if( lua_isstring( L, -1 ) && \
......@@ -254,16 +268,20 @@ void vlclua_read_meta_data( vlc_object_t *p_this, lua_State *L,
char *psz_value = strdup( lua_tostring( L, -1 ) ); \
EnsureUTF8( psz_value ); \
msg_Dbg( p_this, #b ": %s", psz_value ); \
input_item_Set ## b ( p_input, psz_value ); \
vlc_meta_SetWithPriority( p_input->p_meta, \
vlc_meta_ ## b, \
psz_value, \
priority ); \
free( psz_value ); \
} \
lua_pop( L, 1 ); /* pop a */
vlc_mutex_lock( &p_input->lock );
TRY_META( "title", Title );
TRY_META( "artist", Artist );
TRY_META( "genre", Genre );
TRY_META( "copyright", Copyright );
TRY_META( "album", Album );
TRY_META( "tracknum", TrackNum );
TRY_META( "tracknum", TrackNumber );
TRY_META( "description", Description );
TRY_META( "rating", Rating );
TRY_META( "date", Date );
......@@ -273,13 +291,14 @@ void vlclua_read_meta_data( vlc_object_t *p_this, lua_State *L,
TRY_META( "nowplaying", NowPlaying );
TRY_META( "publisher", Publisher );
TRY_META( "encodedby", EncodedBy );
TRY_META( "arturl", ArtURL );
TRY_META( "arturl", ArtworkURL );
TRY_META( "trackid", TrackID );
TRY_META( "director", Director );
TRY_META( "season", Season );
TRY_META( "episode", Episode );
TRY_META( "show_name", ShowName );
TRY_META( "actors", Actors );
vlc_mutex_unlock( &p_input->lock );
}
#undef vlclua_read_custom_meta_data
......@@ -311,7 +330,9 @@ void vlclua_read_custom_meta_data( vlc_object_t *p_this, lua_State *L,
const char *psz_key = lua_tostring( L, -2 );
const char *psz_value = lua_tostring( L, -1 );
vlc_meta_SetExtra( p_input->p_meta, psz_key, psz_value );
vlc_meta_priority_t priority = file_is_playlist( L )? VLC_META_PRIORITY_PLAYLIST:
VLC_META_PRIORITY_BASIC;
vlc_meta_SetExtraWithPriority( p_input->p_meta, psz_key, psz_value, priority );
lua_pop( L, 1 ); /* pop "value" */
}
......
......@@ -74,6 +74,7 @@ function cue_track( global, track )
t.date = track.date or global.date
t.description = global.comment
t.tracknum = track.num
t.trusted = true
t.options = { ":start-time=" .. track.index01}
return t
......
......@@ -897,6 +897,11 @@ static void StartTitle( input_thread_t * p_input )
priv->master->i_seekpoint_offset;
if( val.i_int > 0 /* TODO: check upper boundary */ )
input_ControlPushHelper( p_input, INPUT_CONTROL_SET_SEEKPOINT, &val );
}
static void SetStopStart( input_thread_t * p_input )
{
input_thread_private_t *priv = input_priv(p_input);
/* Start/stop/run time */
priv->i_start = llroundl(CLOCK_FREQ *
......@@ -1335,6 +1340,7 @@ static int Init( input_thread_t * p_input )
InitTitle( p_input, false );
SetStopStart( p_input );
/* Load master infos */
InputSourceStatistics( master, priv->p_item, priv->p_es_out );
......@@ -3477,3 +3483,16 @@ bool input_CanPaceControl(input_thread_t *input)
input_thread_private_t *priv = input_priv(input);
return priv->master->b_can_pace_control;
}
void input_SetItemDuration(input_thread_t *input, vlc_tick_t duration)
{
input_thread_private_t *priv = input_priv(input);
input_item_t *item = input_GetItem(input);
if( priv->i_stop == 0 ) /* consider `duration` as stop time, if stop-time not set */
duration -= priv->i_start;
else /* calculate duration based on start-time and stop-time */
duration = priv->i_stop - priv->i_start;
input_item_SetDuration(item, duration);
}
\ No newline at end of file
......@@ -639,6 +639,17 @@ input_attachment_t *input_GetAttachment(input_thread_t *input, const char *name)
bool input_CanPaceControl(input_thread_t *input);
/**
* Set the duration of the input item.
*
* This function sets the duration of the input item associated with the input thread.
* It uses the 'start-time' and 'stop-time' values to calculate the track duration.
*
* @param input The input thread object.
* @param duration The duration to be set, in vlc_tick_t units.
*/
void input_SetItemDuration(input_thread_t *input, vlc_tick_t duration);
/* Bound pts_delay */
#define INPUT_PTS_DELAY_MAX VLC_TICK_FROM_SEC(60)
......
......@@ -36,9 +36,15 @@
#include "../preparser/art.h"
#include <vlc_charset.h>
struct vlc_meta_value
{
vlc_meta_priority_t priority;
char *value;
};
struct vlc_meta_t
{
char * ppsz_meta[VLC_META_TYPE_COUNT];
struct vlc_meta_value meta[VLC_META_TYPE_COUNT];
vlc_dictionary_t extra_tags;
......@@ -99,23 +105,41 @@ vlc_meta_t *vlc_meta_New( void )
vlc_meta_t *m = (vlc_meta_t*)malloc( sizeof(*m) );
if( !m )
return NULL;
memset( m->ppsz_meta, 0, sizeof(m->ppsz_meta) );
for( int i = 0; i < VLC_META_TYPE_COUNT ; i++ )
{
m->meta[i].value = NULL;
m->meta[i].priority = VLC_META_PRIORITY_BASIC;
}
m->i_status = 0;
vlc_dictionary_init( &m->extra_tags, 0 );
return m;
}
/* Free a dictionary key allocated by strdup() in vlc_meta_SetExtra() */
/* Allocate and insert the new value in the dictionary key `psz_name` */
static void vlc_meta_InsertExtra( vlc_meta_t *m, const char *psz_name, const char *psz_value, vlc_meta_priority_t priority )
{
struct vlc_meta_value *meta_value = malloc( sizeof(*meta_value) );
if( meta_value )
{
meta_value->value = strdup(psz_value);
meta_value->priority = priority;
vlc_dictionary_insert( &m->extra_tags, psz_name, meta_value );
}
}
/* Free a dictionary key allocated by strdup() in vlc_meta_SetExtraWithPriority() */
static void vlc_meta_FreeExtraKey( void *p_data, void *p_obj )
{
VLC_UNUSED( p_obj );
free( p_data );
struct vlc_meta_value *meta_value = p_data;
free( meta_value->value );
free( meta_value );
}
void vlc_meta_Delete( vlc_meta_t *m )
{
for( int i = 0; i < VLC_META_TYPE_COUNT ; i++ )
free( m->ppsz_meta[i] );
free( m->meta[i].value );
vlc_dictionary_clear( &m->extra_tags, vlc_meta_FreeExtraKey, NULL );
free( m );
}
......@@ -126,32 +150,36 @@ void vlc_meta_Delete( vlc_meta_t *m )
* FIXME - Why don't we merge those two?
*/
void vlc_meta_Set( vlc_meta_t *p_meta, vlc_meta_type_t meta_type, const char *psz_val )
void vlc_meta_SetWithPriority( vlc_meta_t *p_meta, vlc_meta_type_t meta_type, const char *psz_val, vlc_meta_priority_t priority )
{
free( p_meta->ppsz_meta[meta_type] );
free( p_meta->meta[meta_type].value );
assert( psz_val == NULL || IsUTF8( psz_val ) );
p_meta->ppsz_meta[meta_type] = psz_val ? strdup( psz_val ) : NULL;
p_meta->meta[meta_type].value = psz_val ? strdup( psz_val ) : NULL;
p_meta->meta[meta_type].priority = priority;
}
const char *vlc_meta_Get( const vlc_meta_t *p_meta, vlc_meta_type_t meta_type )
{
return p_meta->ppsz_meta[meta_type];
return p_meta->meta[meta_type].value;
}
void vlc_meta_SetExtra( vlc_meta_t *m, const char *psz_name, const char *psz_value )
void vlc_meta_SetExtraWithPriority( vlc_meta_t *m, const char *psz_name, const char *psz_value, vlc_meta_priority_t priority )
{
assert( psz_name );
char *psz_oldvalue = (char *)vlc_dictionary_value_for_key( &m->extra_tags, psz_name );
if( psz_oldvalue != kVLCDictionaryNotFound )
struct vlc_meta_value *old_meta_value = vlc_dictionary_value_for_key( &m->extra_tags, psz_name );
if( old_meta_value != kVLCDictionaryNotFound )
vlc_dictionary_remove_value_for_key( &m->extra_tags, psz_name,
vlc_meta_FreeExtraKey, NULL );
if ( psz_value )
vlc_dictionary_insert( &m->extra_tags, psz_name, strdup(psz_value) );
vlc_meta_InsertExtra( m, psz_name, psz_value, priority );
}
const char * vlc_meta_GetExtra( const vlc_meta_t *m, const char *psz_name )
{
return (char *)vlc_dictionary_value_for_key(&m->extra_tags, psz_name);
struct vlc_meta_value *meta_value = vlc_dictionary_value_for_key(&m->extra_tags, psz_name);
if( !meta_value )
return NULL;
return meta_value->value;
}
unsigned vlc_meta_GetExtraCount( const vlc_meta_t *m )
......@@ -188,10 +216,13 @@ void vlc_meta_Merge( vlc_meta_t *dst, const vlc_meta_t *src )
for( int i = 0; i < VLC_META_TYPE_COUNT; i++ )
{
if( src->ppsz_meta[i] )
/* overwrite metadata only when priority of src is
greater than or equal to the priority of dst */
if( src->meta[i].value && src->meta[i].priority >= dst->meta[i].priority )
{
free( dst->ppsz_meta[i] );
dst->ppsz_meta[i] = strdup( src->ppsz_meta[i] );
free( dst->meta[i].value );
dst->meta[i].value = strdup( src->meta[i].value );
dst->meta[i].priority = src->meta[i].priority;
}
}
......@@ -200,10 +231,20 @@ void vlc_meta_Merge( vlc_meta_t *dst, const vlc_meta_t *src )
for( int i = 0; ppsz_all_keys && ppsz_all_keys[i]; i++ )
{
/* Always try to remove the previous value */
vlc_dictionary_remove_value_for_key( &dst->extra_tags, ppsz_all_keys[i], vlc_meta_FreeExtraKey, NULL );
struct vlc_meta_value *dst_meta_value = vlc_dictionary_value_for_key( &dst->extra_tags, ppsz_all_keys[i] );
struct vlc_meta_value *src_meta_value = vlc_dictionary_value_for_key( &src->extra_tags, ppsz_all_keys[i] );
if( dst_meta_value )
{
/* overwrite metadata only when priority of src is
greater than or equal to the priority of dst */
if( src_meta_value->priority < dst_meta_value->priority )
continue;
vlc_dictionary_remove_value_for_key( &dst->extra_tags, ppsz_all_keys[i], vlc_meta_FreeExtraKey, NULL );
}
vlc_meta_InsertExtra( dst, ppsz_all_keys[i], src_meta_value->value, src_meta_value->priority );
void *p_value = vlc_dictionary_value_for_key( &src->extra_tags, ppsz_all_keys[i] );
vlc_dictionary_insert( &dst->extra_tags, ppsz_all_keys[i], strdup( (const char*)p_value ) );
free( ppsz_all_keys[i] );
}
free( ppsz_all_keys );
......
......@@ -56,7 +56,7 @@ input_item_parser_InputEvent(input_thread_t *input,
switch (event->type)
{
case INPUT_EVENT_TIMES:
input_item_SetDuration(input_GetItem(input), event->times.length);
input_SetItemDuration(input, event->times.length);
break;
case INPUT_EVENT_STATE:
parser->state = event->state.value;
......
......@@ -668,7 +668,7 @@ vlc_killed
vlc_join
vlc_thread_set_name
vlc_list_children
vlc_meta_SetExtra
vlc_meta_SetExtraWithPriority
vlc_meta_CopyExtraNames
vlc_meta_Delete
vlc_meta_Get
......@@ -677,7 +677,7 @@ vlc_meta_GetExtraCount
vlc_meta_GetStatus
vlc_meta_Merge
vlc_meta_New
vlc_meta_Set
vlc_meta_SetWithPriority
vlc_meta_SetStatus
vlc_meta_TypeToLocalizedString
vlc_meta_TypeToString
......
......@@ -933,7 +933,7 @@ input_thread_Events(input_thread_t *input_thread,
if (input->length != event->times.length)
{
input->length = event->times.length;
input_item_SetDuration(input_GetItem(input->thread), event->times.length);
input_SetItemDuration(input->thread, event->times.length);
vlc_player_SendEvent(player, on_length_changed, input->length);
changed = true;
}
......