[vlc-devel] commit: libvlc: add two functions ( Rémi Duraffort )

git version control git at videolan.org
Tue Dec 8 10:17:24 CET 2009


vlc | branch: master | Rémi Duraffort <ivoire at videolan.org> | Tue Dec  8 10:04:53 2009 +0100| [1bebc0ded58ba327cac38c4dd975bb4b457bd559] | committer: Rémi Duraffort 

libvlc: add two functions
* set a meta (without changing the file)
* save all meta to the file

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

 include/vlc/libvlc_media.h |   22 ++++++++++++++++++++++
 src/control/media.c        |   18 ++++++++++++++++++
 src/libvlc.sym             |    2 ++
 3 files changed, 42 insertions(+), 0 deletions(-)

diff --git a/include/vlc/libvlc_media.h b/include/vlc/libvlc_media.h
index 88857c4..2ad15c2 100644
--- a/include/vlc/libvlc_media.h
+++ b/include/vlc/libvlc_media.h
@@ -248,6 +248,28 @@ VLC_PUBLIC_API char * libvlc_media_get_meta(
                                    libvlc_meta_t e_meta );
 
 /**
+ * Set the meta of the media (this function will not save the meta, call
+ * libvlc_media_save_meta in order to save the meta)
+ *
+ * \param p_md the media descriptor
+ * \param e_meta the meta to read
+ * \param the media's meta
+ */
+VLC_PUBLIC_API void libvlc_media_set_meta( libvlc_media_t *p_md,
+                                           libvlc_meta_t e_meta,
+                                           const char *psz_value );
+
+
+/**
+ * Save the meta previously set
+ *
+ * \param p_md the media desriptor
+ * \return true if the werite was successfull
+ */
+VLC_PUBLIC_API int libvlc_media_save_meta( libvlc_media_t *p_md );
+
+
+/**
  * Get current state of media descriptor object. Possible media states
  * are defined in libvlc_structures.c ( libvlc_NothingSpecial=0,
  * libvlc_Opening, libvlc_Buffering, libvlc_Playing, libvlc_Paused,
diff --git a/src/control/media.c b/src/control/media.c
index 1a6dc68..940e420 100644
--- a/src/control/media.c
+++ b/src/control/media.c
@@ -471,6 +471,24 @@ char *libvlc_media_get_meta( libvlc_media_t *p_md, libvlc_meta_t e_meta )
 }
 
 /**************************************************************************
+ * Setter for meta information
+ **************************************************************************/
+
+void libvlc_media_set_meta( libvlc_media_t *p_md, libvlc_meta_t e_meta, const char *psz_value )
+{
+    assert( p_md );
+    input_item_SetMeta( p_md->p_input_item, libvlc_to_vlc_meta[e_meta], psz_value );
+}
+
+int libvlc_media_save_meta( libvlc_media_t *p_md )
+{
+    assert( p_md );
+    vlc_object_t *p_obj = VLC_OBJECT(libvlc_priv(
+                            p_md->p_libvlc_instance->p_libvlc_int)->p_playlist);
+    return input_item_WriteMeta( p_obj, p_md->p_input_item ) == VLC_SUCCESS;
+}
+
+/**************************************************************************
  * Getter for state information
  * Can be error, playing, buffering, NothingSpecial.
  **************************************************************************/
diff --git a/src/libvlc.sym b/src/libvlc.sym
index 7cdfded..5c2dd58 100644
--- a/src/libvlc.sym
+++ b/src/libvlc.sym
@@ -168,6 +168,8 @@ libvlc_media_player_stop
 libvlc_media_player_will_play
 libvlc_media_release
 libvlc_media_retain
+libvlc_media_save_meta
+libvlc_media_set_meta
 libvlc_media_set_state
 libvlc_media_set_user_data
 libvlc_media_subitems




More information about the vlc-devel mailing list