1
mirror of https://code.videolan.org/videolan/vlc synced 2024-08-27 04:21:53 +02:00

libvlc: add two functions

* set a meta (without changing the file)
* save all meta to the file
This commit is contained in:
Rémi Duraffort 2009-12-08 10:04:53 +01:00
parent 55fb4b5359
commit 1bebc0ded5
3 changed files with 42 additions and 0 deletions

View 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,

View 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.

View 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