]> git.sesse.net Git - vlc/commitdiff
libvlc: add two functions
authorRémi Duraffort <ivoire@videolan.org>
Tue, 8 Dec 2009 09:04:53 +0000 (10:04 +0100)
committerRémi Duraffort <ivoire@videolan.org>
Tue, 8 Dec 2009 09:04:53 +0000 (10:04 +0100)
* set a meta (without changing the file)
* save all meta to the file

include/vlc/libvlc_media.h
src/control/media.c
src/libvlc.sym

index 88857c41a07c65336884c8d77f957bb0cab793fe..2ad15c27bcf8a5af7e94e23cfda53d19706f7fa6 100644 (file)
@@ -247,6 +247,28 @@ VLC_PUBLIC_API char * libvlc_media_get_meta(
                                    libvlc_media_t *p_meta_desc,
                                    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,
index 1a6dc686d228eb683ba189cd87cb8b5ee98ed74a..940e420a1338c5a9105179e254a66f7b71955510 100644 (file)
@@ -470,6 +470,24 @@ char *libvlc_media_get_meta( libvlc_media_t *p_md, libvlc_meta_t e_meta )
     return psz_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.
index 7cdfdedfff7c1303140517c0103fe83d7533ec39..5c2dd581e32104eb595250082810936e9e028714 100644 (file)
@@ -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