[vlc-commits] libvlc: add libvlc_media_parse_stop

Thomas Guillem git at videolan.org
Wed Oct 12 14:10:47 CEST 2016


vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Wed Oct 12 14:05:02 2016 +0200| [8a449a61c542092bf03e3f3d9ba1be1a6d8dbdc5] | committer: Thomas Guillem

libvlc: add libvlc_media_parse_stop

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=8a449a61c542092bf03e3f3d9ba1be1a6d8dbdc5
---

 include/vlc/libvlc_media.h | 16 ++++++++++++++++
 lib/libvlc.sym             |  1 +
 lib/media.c                |  9 +++++++--
 3 files changed, 24 insertions(+), 2 deletions(-)

diff --git a/include/vlc/libvlc_media.h b/include/vlc/libvlc_media.h
index 0734610..8fd13fe 100644
--- a/include/vlc/libvlc_media.h
+++ b/include/vlc/libvlc_media.h
@@ -648,6 +648,8 @@ LIBVLC_API libvlc_time_t
  * these flags can be combined. By default, media is parsed if it's a local
  * file.
  *
+ * \note Parsing can be aborted with libvlc_media_parse_stop().
+ *
  * \see libvlc_MediaParsedChanged
  * \see libvlc_media_get_meta
  * \see libvlc_media_tracks_get
@@ -668,6 +670,20 @@ libvlc_media_parse_with_options( libvlc_media_t *p_md,
                                  int timeout );
 
 /**
+ * Stop the parsing of the media
+ *
+ * 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
+ *
+ * \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 );
+
+/**
  * Get Parsed status for media descriptor object.
  *
  * \see libvlc_MediaParsedChanged
diff --git a/lib/libvlc.sym b/lib/libvlc.sym
index 84e7189..b994384 100644
--- a/lib/libvlc.sym
+++ b/lib/libvlc.sym
@@ -148,6 +148,7 @@ libvlc_media_new_from_input_item
 libvlc_media_parse
 libvlc_media_parse_async
 libvlc_media_parse_with_options
+libvlc_media_parse_stop
 libvlc_media_player_add_slave
 libvlc_media_player_can_pause
 libvlc_media_player_program_scrambled
diff --git a/lib/media.c b/lib/media.c
index e01beed..8e07930 100644
--- a/lib/media.c
+++ b/lib/media.c
@@ -533,8 +533,7 @@ void libvlc_media_release( libvlc_media_t *p_md )
     uninstall_input_item_observer( p_md );
 
     /* Cancel asynchronous parsing (if any) */
-    if( p_md->p_input_item )
-        libvlc_MetadataCancel( p_md->p_libvlc_instance->p_libvlc_int, p_md );
+    libvlc_MetadataCancel( p_md->p_libvlc_instance->p_libvlc_int, p_md );
 
     if( p_md->p_subitems )
         libvlc_media_list_release( p_md->p_subitems );
@@ -818,6 +817,12 @@ libvlc_media_parse_with_options( libvlc_media_t *media,
     return media_parse( media, true, parse_flag, timeout ) == VLC_SUCCESS ? 0 : -1;
 }
 
+void
+libvlc_media_parse_stop( libvlc_media_t *media )
+{
+    libvlc_MetadataCancel( media->p_libvlc_instance->p_libvlc_int, media );
+}
+
 /**************************************************************************
  * Get parsed status for media object.
  **************************************************************************/



More information about the vlc-commits mailing list