Commit 1bebc0de authored by Rémi Duraffort's avatar Rémi Duraffort

libvlc: add two functions

* set a meta (without changing the file)
* save all meta to the file
parent 55fb4b53
......@@ -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,
......
......@@ -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.
......
......@@ -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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment