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 (17)
......@@ -28,101 +28,6 @@
extern "C" {
# endif
/**
* \ingroup libvlc_media
* @{
*/
/**
* Parse a media.
*
* This fetches (local) art, meta data and tracks information.
* The method is synchronous.
*
* \deprecated This function could block indefinitely.
* Use libvlc_media_parse_with_options() instead
*
* \see libvlc_media_parse_with_options
* \see libvlc_media_get_meta
*
* \param p_md media descriptor object
*/
LIBVLC_DEPRECATED LIBVLC_API void
libvlc_media_parse( libvlc_media_t *p_md );
/**
* Parse a media.
*
* This fetches (local) art, meta data and tracks information.
* The method is the asynchronous of libvlc_media_parse().
*
* To track when this is over you can listen to libvlc_MediaParsedChanged
* event. However if the media was already parsed you will not receive this
* event.
*
* \deprecated You can't be sure to receive the libvlc_MediaParsedChanged
* event (you can wait indefinitely for this event).
* Use libvlc_media_parse_with_options() instead
*
* \see libvlc_media_parse
* \see libvlc_MediaParsedChanged
* \see libvlc_media_get_meta
*
* \param p_md media descriptor object
*/
LIBVLC_DEPRECATED LIBVLC_API void
libvlc_media_parse_async( libvlc_media_t *p_md );
/**
* Return true is the media descriptor object is parsed
*
* \deprecated This can return true in case of failure.
* Use libvlc_media_get_parsed_status() instead
*
* \see libvlc_MediaParsedChanged
*
* \param p_md media descriptor object
* \retval true media object has been parsed
* \retval false otherwise
*/
LIBVLC_DEPRECATED LIBVLC_API bool
libvlc_media_is_parsed( libvlc_media_t *p_md );
/**
* Get media descriptor's elementary streams description
*
* Note, you need to call libvlc_media_parse_with_options() or play the media
* at least once before calling this function.
* Not doing this will result in an empty array.
*
* \version LibVLC 2.1.0 and later.
* \see libvlc_media_parse_with_options
*
* \param p_md media descriptor object
* \param tracks address to store an allocated array of Elementary Streams
* descriptions (must be freed with libvlc_media_tracks_release
by the caller) [OUT]
*
* \return the number of Elementary Streams (zero on error)
*/
LIBVLC_DEPRECATED LIBVLC_API
unsigned libvlc_media_tracks_get( libvlc_media_t *p_md,
libvlc_media_track_t ***tracks );
/**
* Release media descriptor's elementary streams description array
*
* \version LibVLC 2.1.0 and later.
*
* \param p_tracks tracks info array to release
* \param i_count number of elements in the array
*/
LIBVLC_DEPRECATED LIBVLC_API
void libvlc_media_tracks_release( libvlc_media_track_t **p_tracks,
unsigned i_count );
/** @}*/
/**
* \ingroup libvlc_media_player
* @{
......
......@@ -65,7 +65,7 @@ enum libvlc_event_e {
libvlc_MediaDurationChanged,
/**
* Parsing state of a \link #libvlc_media_t media item\endlink changed
* \see libvlc_media_parse_with_options(),
* \see libvlc_media_parse_request(),
* libvlc_media_get_parsed_status(),
* libvlc_media_parse_stop()
*/
......
......@@ -140,9 +140,7 @@ typedef enum libvlc_media_type_t {
} libvlc_media_type_t;
/**
* Parse flags used by libvlc_media_parse_with_options()
*
* \see libvlc_media_parse_with_options
* Parse flags used by libvlc_media_parse_request()
*/
typedef enum libvlc_media_parse_flag_t
{
......@@ -171,15 +169,14 @@ typedef enum libvlc_media_parse_flag_t
} libvlc_media_parse_flag_t;
/**
* Parse status used sent by libvlc_media_parse_with_options() or returned by
* Parse status used sent by libvlc_media_parse_request() or returned by
* libvlc_media_get_parsed_status()
*
* \see libvlc_media_parse_with_options
* \see libvlc_media_get_parsed_status
*/
typedef enum libvlc_media_parsed_status_t
{
libvlc_media_parsed_status_skipped = 1,
libvlc_media_parsed_status_none,
libvlc_media_parsed_status_pending,
libvlc_media_parsed_status_skipped,
libvlc_media_parsed_status_failed,
libvlc_media_parsed_status_timeout,
libvlc_media_parsed_status_done,
......@@ -461,11 +458,10 @@ LIBVLC_API libvlc_media_t *libvlc_media_duplicate( libvlc_media_t *p_md );
/**
* Read the meta of the media.
*
* Note, you need to call libvlc_media_parse_with_options() or play the media
* Note, you need to call libvlc_media_parse_request() or play the media
* at least once before calling this function.
* If the media has not yet been parsed this will return NULL.
*
* \see libvlc_media_parse_with_options
* \see libvlc_MediaMetaChanged
*
* \param p_md the media descriptor
......@@ -535,12 +531,10 @@ LIBVLC_API libvlc_event_manager_t *
/**
* Get duration (in ms) of media descriptor object item.
*
* Note, you need to call libvlc_media_parse_with_options() or play the media
* Note, you need to call libvlc_media_parse_request() or play the media
* at least once before calling this function.
* Not doing this will result in an undefined result.
*
* \see libvlc_media_parse_with_options
*
* \param p_md media descriptor object
* \return duration of media item or -1 on error
*/
......@@ -552,7 +546,7 @@ LIBVLC_API libvlc_time_t
*
* \note 'stat' values are currently only parsed by directory accesses. This
* mean that only sub medias of a directory media, parsed with
* libvlc_media_parse_with_options() can have valid 'stat' properties.
* libvlc_media_parse_request() can have valid 'stat' properties.
* \version LibVLC 4.0.0 and later.
*
* \param p_md media descriptor object
......@@ -584,18 +578,19 @@ LIBVLC_API int
* \see libvlc_media_get_parsed_status
* \see libvlc_media_parse_flag_t
*
* \param inst LibVLC instance that is to parse the media
* \param p_md media descriptor object
* \param parse_flag parse options:
* \param timeout maximum time allowed to preparse the media. If -1, the
* default "preparse-timeout" option will be used as a timeout. If 0, it will
* wait indefinitely. If > 0, the timeout will be used (in milliseconds).
* \return -1 in case of error, 0 otherwise
* \version LibVLC 3.0.0 or later
* \version LibVLC 4.0.0 or later
*/
LIBVLC_API int
libvlc_media_parse_with_options( libvlc_media_t *p_md,
libvlc_media_parse_flag_t parse_flag,
int timeout );
libvlc_media_parse_request( libvlc_instance_t *inst, libvlc_media_t *p_md,
libvlc_media_parse_flag_t parse_flag,
int timeout );
/**
* Stop the parsing of the media
......@@ -603,20 +598,21 @@ libvlc_media_parse_with_options( libvlc_media_t *p_md,
* When the media parsing is stopped, the libvlc_MediaParsedChanged event will
* be sent with the libvlc_media_parsed_status_timeout status.
*
* \see libvlc_media_parse_with_options
* \see libvlc_media_parse_request()
*
* \param inst LibVLC instance that is to cease or give up parsing the media
* \param p_md media descriptor object
* \version LibVLC 3.0.0 or later
*/
LIBVLC_API void
libvlc_media_parse_stop( libvlc_media_t *p_md );
libvlc_media_parse_stop( libvlc_instance_t *inst, libvlc_media_t *p_md );
/**
* Get Parsed status for media descriptor object.
*
* \see libvlc_MediaParsedChanged
* \see libvlc_media_parsed_status_t
* \see libvlc_media_parse_with_options
* \see libvlc_media_parse_request()
*
* \param p_md media descriptor object
* \return a value of the libvlc_media_parsed_status_t enum
......@@ -652,11 +648,10 @@ LIBVLC_API void *libvlc_media_get_user_data( libvlc_media_t *p_md );
*
* \version LibVLC 4.0.0 and later.
*
* \note You need to call libvlc_media_parse_with_options() or play the media
* \note You need to call libvlc_media_parse_request() or play the media
* at least once before calling this function. Not doing this will result in
* an empty list.
*
* \see libvlc_media_parse_with_options
* \see libvlc_media_tracklist_count
* \see libvlc_media_tracklist_at
*
......@@ -673,13 +668,12 @@ libvlc_media_get_tracklist( libvlc_media_t *p_md, libvlc_track_type_t type );
/**
* Get codec description from media elementary stream
*
* Note, you need to call libvlc_media_parse_with_options() or play the media
* Note, you need to call libvlc_media_parse_request() or play the media
* at least once before calling this function.
*
* \version LibVLC 3.0.0 and later.
*
* \see libvlc_media_track_t
* \see libvlc_media_parse_with_options
*
* \param i_type i_type from libvlc_media_track_t
* \param i_codec i_codec or i_original_fourcc from libvlc_media_track_t
......@@ -819,7 +813,7 @@ libvlc_media_thumbnail_request_destroy( libvlc_media_thumbnail_request_t *p_req
* track (like a .srt) or an additional audio track (like a .ac3).
*
* \note This function must be called before the media is parsed (via
* libvlc_media_parse_with_options()) or before the media is played (via
* libvlc_media_parse_request()) or before the media is played (via
* libvlc_media_player_play())
*
* \version LibVLC 3.0.0 and later.
......
......@@ -1341,7 +1341,7 @@ LIBVLC_API void libvlc_media_player_set_video_title_display( libvlc_media_player
*
* \version LibVLC 4.0.0 and later.
*
* \note You need to call libvlc_media_parse_with_options() or play the media
* \note You need to call libvlc_media_parse_request() or play the media
* at least once before calling this function. Not doing this will result in
* an empty list.
*
......
......@@ -78,7 +78,6 @@ libvlc_media_get_stats
libvlc_media_get_tracklist
libvlc_media_get_type
libvlc_media_get_user_data
libvlc_media_is_parsed
libvlc_media_get_parsed_status
libvlc_media_thumbnail_request_by_time
libvlc_media_thumbnail_request_by_pos
......@@ -127,9 +126,7 @@ libvlc_media_new_fd
libvlc_media_new_location
libvlc_media_new_path
libvlc_media_new_as_node
libvlc_media_parse
libvlc_media_parse_async
libvlc_media_parse_with_options
libvlc_media_parse_request
libvlc_media_parse_stop
libvlc_media_player_add_slave
libvlc_media_player_can_pause
......@@ -206,8 +203,6 @@ libvlc_media_slaves_release
libvlc_media_set_meta
libvlc_media_set_user_data
libvlc_media_subitems
libvlc_media_tracks_get
libvlc_media_tracks_release
libvlc_new
libvlc_playlist_play
libvlc_release
......
......@@ -366,25 +366,8 @@ static void send_parsed_changed( libvlc_media_t *p_md,
{
libvlc_event_t event;
vlc_mutex_lock( &p_md->parsed_lock );
if( p_md->parsed_status == new_status )
{
vlc_mutex_unlock( &p_md->parsed_lock );
if (atomic_exchange(&p_md->parsed_status, new_status) == new_status)
return;
}
/* Legacy: notify libvlc_media_parse */
if( !p_md->is_parsed )
{
p_md->is_parsed = true;
vlc_cond_broadcast( &p_md->parsed_cond );
}
p_md->parsed_status = new_status;
if( p_md->parsed_status != libvlc_media_parsed_status_done )
p_md->has_asked_preparse = false;
vlc_mutex_unlock( &p_md->parsed_lock );
/* Construct the event */
event.type = libvlc_MediaParsedChanged;
......@@ -508,8 +491,6 @@ libvlc_media_t * libvlc_media_new_from_input_item(
p_md->p_input_item = p_input_item;
vlc_atomic_rc_init(&p_md->rc);
vlc_cond_init(&p_md->parsed_cond);
vlc_mutex_init(&p_md->parsed_lock);
vlc_mutex_init(&p_md->subitems_lock);
atomic_init(&p_md->worker_count, 0);
......@@ -517,6 +498,7 @@ libvlc_media_t * libvlc_media_new_from_input_item(
* It can give a bunch of item to read. */
p_md->p_subitems = NULL;
p_md->p_input_item->libvlc_owner = p_md;
atomic_init(&p_md->parsed_status, libvlc_media_parsed_status_none);
libvlc_event_manager_init( &p_md->event_manager, p_md );
......@@ -654,9 +636,6 @@ void libvlc_media_release( libvlc_media_t *p_md )
uninstall_input_item_observer( p_md );
/* Cancel asynchronous parsing (if any) */
libvlc_MetadataCancel( p_md->p_libvlc_instance->p_libvlc_int, p_md );
/* Wait for all async tasks to stop. */
while ((ref = atomic_load_explicit(&p_md->worker_count,
memory_order_acquire)) > 0)
......@@ -856,122 +835,67 @@ static const input_preparser_callbacks_t input_preparser_callbacks = {
.on_subtree_added = input_item_subtree_added,
};
static int media_parse(libvlc_media_t *media, bool b_async,
libvlc_media_parse_flag_t parse_flag, int timeout)
int libvlc_media_parse_request(libvlc_instance_t *inst, libvlc_media_t *media,
libvlc_media_parse_flag_t parse_flag,
int timeout)
{
bool needed;
libvlc_media_parsed_status_t expected = libvlc_media_parsed_status_none;
vlc_mutex_lock(&media->parsed_lock);
needed = !media->has_asked_preparse;
media->has_asked_preparse = true;
if (needed)
{
media->is_parsed = false;
media->parsed_status = 0;
}
vlc_mutex_unlock(&media->parsed_lock);
while (!atomic_compare_exchange_weak(&media->parsed_status, &expected,
libvlc_media_parsed_status_pending))
if (expected == libvlc_media_parsed_status_pending
|| expected == libvlc_media_parsed_status_done)
return -1;
if (needed)
libvlc_int_t *libvlc = inst->p_libvlc_int;
input_item_t *item = media->p_input_item;
input_item_meta_request_option_t parse_scope = META_REQUEST_OPTION_SCOPE_LOCAL;
int ret;
unsigned int ref = atomic_load_explicit(&media->worker_count,
memory_order_relaxed);
do
{
libvlc_int_t *libvlc = media->p_libvlc_instance->p_libvlc_int;
input_item_t *item = media->p_input_item;
input_item_meta_request_option_t parse_scope = META_REQUEST_OPTION_SCOPE_LOCAL;
int ret;
unsigned int ref = atomic_load_explicit(&media->worker_count,
memory_order_relaxed);
do
{
if (unlikely(ref == UINT_MAX))
return -EOVERFLOW;
}
while (!atomic_compare_exchange_weak_explicit(&media->worker_count,
&ref, ref + 1,
memory_order_relaxed,
memory_order_relaxed));
if (parse_flag & libvlc_media_parse_network)
parse_scope |= META_REQUEST_OPTION_SCOPE_NETWORK;
if (parse_flag & libvlc_media_fetch_local)
parse_scope |= META_REQUEST_OPTION_FETCH_LOCAL;
if (parse_flag & libvlc_media_fetch_network)
parse_scope |= META_REQUEST_OPTION_FETCH_NETWORK;
if (parse_flag & libvlc_media_do_interact)
parse_scope |= META_REQUEST_OPTION_DO_INTERACT;
ret = libvlc_MetadataRequest(libvlc, item, parse_scope,
&input_preparser_callbacks, media,
timeout, media);
if (ret != VLC_SUCCESS)
{
atomic_fetch_sub_explicit(&media->worker_count, 1,
memory_order_relaxed);
return ret;
}
if (unlikely(ref == UINT_MAX))
return -1;
}
else
return VLC_EGENERIC;
if (!b_async)
while (!atomic_compare_exchange_weak_explicit(&media->worker_count,
&ref, ref + 1,
memory_order_relaxed,
memory_order_relaxed));
if (parse_flag & libvlc_media_parse_network)
parse_scope |= META_REQUEST_OPTION_SCOPE_NETWORK;
if (parse_flag & libvlc_media_fetch_local)
parse_scope |= META_REQUEST_OPTION_FETCH_LOCAL;
if (parse_flag & libvlc_media_fetch_network)
parse_scope |= META_REQUEST_OPTION_FETCH_NETWORK;
if (parse_flag & libvlc_media_do_interact)
parse_scope |= META_REQUEST_OPTION_DO_INTERACT;
ret = libvlc_MetadataRequest(libvlc, item, parse_scope,
&input_preparser_callbacks, media,
timeout, media);
if (ret != VLC_SUCCESS)
{
vlc_mutex_lock(&media->parsed_lock);
while (!media->is_parsed)
vlc_cond_wait(&media->parsed_cond, &media->parsed_lock);
vlc_mutex_unlock(&media->parsed_lock);
atomic_fetch_sub_explicit(&media->worker_count, 1,
memory_order_relaxed);
return -1;
}
return VLC_SUCCESS;
}
// Parse the media and wait
void
libvlc_media_parse(libvlc_media_t *media)
{
media_parse( media, false, libvlc_media_fetch_local, -1 );
}
// Parse the media but do not wait
void
libvlc_media_parse_async(libvlc_media_t *media)
{
media_parse( media, true, libvlc_media_fetch_local, -1 );
}
// Parse the media asynchronously with options
int
libvlc_media_parse_with_options( libvlc_media_t *media,
libvlc_media_parse_flag_t parse_flag,
int timeout )
{
return media_parse( media, true, parse_flag, timeout ) == VLC_SUCCESS ? 0 : -1;
return 0;
}
// Stop parsing of the media
void
libvlc_media_parse_stop( libvlc_media_t *media )
libvlc_media_parse_stop(libvlc_instance_t *inst, libvlc_media_t *media)
{
libvlc_MetadataCancel( media->p_libvlc_instance->p_libvlc_int, media );
}
// Get parsed status for media object (deprecated)
bool libvlc_media_is_parsed(libvlc_media_t *media)
{
bool parsed;
vlc_mutex_lock(&media->parsed_lock);
parsed = media->is_parsed;
vlc_mutex_unlock(&media->parsed_lock);
return parsed;
libvlc_MetadataCancel(inst->p_libvlc_int, media);
}
// Get Parsed status for media descriptor object
libvlc_media_parsed_status_t
libvlc_media_get_parsed_status(libvlc_media_t *media)
{
libvlc_media_parsed_status_t status;
vlc_mutex_lock(&media->parsed_lock);
status = media->parsed_status;
vlc_mutex_unlock(&media->parsed_lock);
return status;
return atomic_load(&media->parsed_status);
}
// Sets media descriptor's user_data
......@@ -990,47 +914,6 @@ libvlc_media_get_user_data( libvlc_media_t * p_md )
return p_md->p_user_data;
}
// Get media descriptor's elementary streams description
unsigned
libvlc_media_tracks_get( libvlc_media_t *p_md, libvlc_media_track_t *** pp_es )
{
assert( p_md );
input_item_t *p_input_item = p_md->p_input_item;
vlc_mutex_lock( &p_input_item->lock );
const int i_es = p_input_item->i_es;
*pp_es = (i_es > 0) ? calloc( i_es, sizeof(**pp_es) ) : NULL;
if( !*pp_es ) /* no ES, or OOM */
{
vlc_mutex_unlock( &p_input_item->lock );
return 0;
}
/* Fill array */
for( int i = 0; i < i_es; i++ )
{
libvlc_media_trackpriv_t *p_trackpriv = calloc( 1, sizeof(*p_trackpriv) );
if ( !p_trackpriv )
{
libvlc_media_tracks_release( *pp_es, i_es );
*pp_es = NULL;
vlc_mutex_unlock( &p_input_item->lock );
return 0;
}
libvlc_media_track_t *p_mes = &p_trackpriv->t;
(*pp_es)[i] = p_mes;
const es_format_t *p_es = p_input_item->es[i];
libvlc_media_trackpriv_from_es( p_trackpriv, p_es );
}
vlc_mutex_unlock( &p_input_item->lock );
return i_es;
}
libvlc_media_tracklist_t *
libvlc_media_get_tracklist( libvlc_media_t *p_md, libvlc_track_type_t type )
{
......@@ -1056,19 +939,6 @@ libvlc_media_get_codec_description( libvlc_track_type_t i_type,
i_codec );
}
// Release media descriptor's elementary streams description array
void libvlc_media_tracks_release( libvlc_media_track_t **p_tracks, unsigned i_count )
{
for( unsigned i = 0; i < i_count; ++i )
{
if ( !p_tracks[i] )
continue;
libvlc_media_track_clean( p_tracks[i] );
free( p_tracks[i] );
}
free( p_tracks );
}
// Get the media type of the media descriptor object
libvlc_media_type_t libvlc_media_get_type( libvlc_media_t *p_md )
{
......
......@@ -43,8 +43,6 @@ struct libvlc_media_t
VLC_FORWARD_DECLARE_OBJECT(libvlc_media_list_t*) p_subitems; /* A media descriptor can have Sub items. This is the only dependency we really have on media_list */
void *p_user_data;
vlc_cond_t parsed_cond;
vlc_mutex_t parsed_lock;
vlc_mutex_t subitems_lock;
/* Idle protection to prevent the media from being released during
......@@ -52,9 +50,7 @@ struct libvlc_media_t
* be blocking until no async code is using the media anymore. */
atomic_uint worker_count;
libvlc_media_parsed_status_t parsed_status;
bool is_parsed;
bool has_asked_preparse;
_Atomic libvlc_media_parsed_status_t parsed_status;
};
/* Media Descriptor */
......@@ -114,7 +110,4 @@ libvlc_media_tracklist_t *
libvlc_media_tracklist_from_player( vlc_player_t *player,
libvlc_track_type_t type );
void
libvlc_media_track_clean( libvlc_media_track_t *track );
#endif
......@@ -123,8 +123,7 @@ libvlc_media_trackpriv_new( void )
return trackpriv;
}
void
libvlc_media_track_clean( libvlc_media_track_t *track )
static void libvlc_media_track_clean( libvlc_media_track_t *track )
{
free( track->psz_language );
free( track->psz_description );
......
......@@ -126,7 +126,7 @@ static void test_media_preparsed(libvlc_instance_t *vlc, const char *path,
libvlc_event_attach (em, libvlc_MediaParsedChanged, media_parse_ended, &sem);
// Parse the media. This is synchronous.
int i_ret = libvlc_media_parse_with_options(media, parse_flags, -1);
int i_ret = libvlc_media_parse_request(vlc, media, parse_flags, -1);
assert(i_ret == 0);
// Wait for preparsed event
......@@ -257,7 +257,8 @@ static void subitem_added(const libvlc_event_t *event, void *user_data)
#undef FILE_SEPARATOR
}
static void test_media_subitems_media(libvlc_media_t *media, bool play,
static void test_media_subitems_media(libvlc_instance_t *vlc,
libvlc_media_t *media, bool play,
bool b_items_expected)
{
libvlc_media_add_option(media, ":ignore-filetypes= ");
......@@ -272,7 +273,7 @@ static void test_media_subitems_media(libvlc_media_t *media, bool play,
if (play)
{
/* XXX: libvlc_media_parse_with_options won't work with fd, since it
/* XXX: libvlc_media_parse won't work with fd, since it
* won't be preparsed because fd:// is an unknown type, so play the
* file to force parsing. */
libvlc_event_attach (em, libvlc_MediaSubItemTreeAdded, subitem_parse_ended, &sem);
......@@ -287,7 +288,8 @@ static void test_media_subitems_media(libvlc_media_t *media, bool play,
{
libvlc_event_attach (em, libvlc_MediaParsedChanged, subitem_parse_ended, &sem);
int i_ret = libvlc_media_parse_with_options(media, libvlc_media_parse_local, -1);
int i_ret = libvlc_media_parse_request(vlc, media,
libvlc_media_parse_local, -1);
assert(i_ret == 0);
vlc_sem_wait (&sem);
}
......@@ -311,7 +313,7 @@ static void test_media_subitems(libvlc_instance_t *vlc)
test_log ("Testing media_subitems: path: '%s'\n", subitems_path);
media = libvlc_media_new_path (vlc, subitems_path);
assert (media != NULL);
test_media_subitems_media (media, false, true);
test_media_subitems_media(vlc, media, false, true);
libvlc_media_release (media);
char *subitems_realpath = realpath (subitems_path, NULL);
......@@ -324,7 +326,7 @@ static void test_media_subitems(libvlc_instance_t *vlc)
test_log ("Testing media_subitems: location: '%s'\n", location);
media = libvlc_media_new_location (vlc, location);
assert (media != NULL);
test_media_subitems_media (media, false, true);
test_media_subitems_media(vlc, media, false, true);
free (location);
libvlc_media_release (media);
}
......@@ -337,7 +339,7 @@ static void test_media_subitems(libvlc_instance_t *vlc)
assert (fd >= 0);
media = libvlc_media_new_fd (vlc, fd);
assert (media != NULL);
test_media_subitems_media (media, true, true);
test_media_subitems_media(vlc, media, true, true);
libvlc_media_release (media);
vlc_close (fd);
#else
......@@ -347,7 +349,7 @@ static void test_media_subitems(libvlc_instance_t *vlc)
test_log ("Testing media_subitems failure\n");
media = libvlc_media_new_location (vlc, "wrongfile://test");
assert (media != NULL);
test_media_subitems_media (media, false, false);
test_media_subitems_media(vlc, media, false, false);
libvlc_media_release (media);
}
......
......@@ -28,8 +28,8 @@ libvlc_media_parse_finished_event(const libvlc_event_t *p_ev, void *p_data)
}
static inline void
libvlc_media_parse_sync(libvlc_media_t *p_m, libvlc_media_parse_flag_t parse_flag,
int timeout)
libvlc_media_parse_sync(libvlc_instance_t *vlc, libvlc_media_t *p_m,
libvlc_media_parse_flag_t parse_flag, int timeout)
{
vlc_sem_t sem;
vlc_sem_init(&sem, 0);
......@@ -38,7 +38,7 @@ libvlc_media_parse_sync(libvlc_media_t *p_m, libvlc_media_parse_flag_t parse_fla
libvlc_event_attach(p_em, libvlc_MediaParsedChanged,
libvlc_media_parse_finished_event, &sem);
int i_ret = libvlc_media_parse_with_options(p_m, parse_flag, timeout);
int i_ret = libvlc_media_parse_request(vlc, p_m, parse_flag, timeout);
assert(i_ret == 0);
vlc_sem_wait (&sem);
......
......@@ -40,7 +40,7 @@ static void test_meta (const char ** argv, int argc)
media = libvlc_media_new_path (vlc, SRCDIR "/samples/meta.mp3");
assert( media );
libvlc_media_parse_sync (media, libvlc_media_parse_local, -1);
libvlc_media_parse_sync(vlc, media, libvlc_media_parse_local, -1);
artist = libvlc_media_get_meta (media, libvlc_meta_Artist);
......
......@@ -84,7 +84,7 @@ test_media_has_slaves_from_parent(libvlc_instance_t *p_vlc,
assert(p_m != NULL);
printf("Parse media dir to get subitems\n");
libvlc_media_parse_sync(p_m, libvlc_media_parse_local, -1);
libvlc_media_parse_sync(p_vlc, p_m, libvlc_media_parse_local, -1);
char *psz_main_media_mrl = path_to_mrl(p_vlc, psz_main_media);
assert(psz_main_media_mrl != NULL);
......