mirror of https://code.videolan.org/videolan/vlc
Merge branch 'v4-custom-meta' into 'master'
libvlc: add libvlc_media_get_custom_meta See merge request videolan/vlc!3024
This commit is contained in:
commit
66bdb04944
|
@ -463,6 +463,17 @@ LIBVLC_API libvlc_media_t *libvlc_media_duplicate( libvlc_media_t *p_md );
|
|||
LIBVLC_API char *libvlc_media_get_meta( libvlc_media_t *p_md,
|
||||
libvlc_meta_t e_meta );
|
||||
|
||||
|
||||
/**
|
||||
* Read the custom meta of the media
|
||||
*
|
||||
* \param p_md the media descriptor
|
||||
* \param psz_key custom meta key
|
||||
* \return the media's custom meta
|
||||
*/
|
||||
LIBVLC_API char *libvlc_media_get_custom_meta( libvlc_media_t *p_md,
|
||||
const char *psz_key );
|
||||
|
||||
/**
|
||||
* Set the meta of the media (this function will not save the meta, call
|
||||
* libvlc_media_save_meta in order to save the meta)
|
||||
|
|
21
lib/media.c
21
lib/media.c
|
@ -558,6 +558,27 @@ char *libvlc_media_get_meta( libvlc_media_t *p_md, libvlc_meta_t e_meta )
|
|||
return psz_meta;
|
||||
}
|
||||
|
||||
// Getter for custom meta information
|
||||
char *libvlc_media_get_custom_meta( libvlc_media_t *p_md, const char *psz_key )
|
||||
{
|
||||
assert( p_md );
|
||||
|
||||
input_item_t *item = p_md->p_input_item;
|
||||
|
||||
vlc_mutex_lock( &item->lock );
|
||||
if ( psz_key != NULL && item != NULL && item->p_meta != NULL)
|
||||
{
|
||||
const char *psz_meta = vlc_meta_GetExtra(item->p_meta, psz_key );
|
||||
if ( psz_meta != NULL )
|
||||
{
|
||||
vlc_mutex_unlock( &item->lock );
|
||||
return strdup( psz_meta );
|
||||
}
|
||||
}
|
||||
vlc_mutex_unlock( &item->lock );
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// Set the meta of the media
|
||||
void libvlc_media_set_meta( libvlc_media_t *p_md, libvlc_meta_t e_meta, const char *psz_value )
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue