Browse Source

libvlc: Add meta extras related API

pull/162/head
Hank Anderson 3 years ago
committed by Felix Paul Kühne
parent
commit
dfe555a96c
  1. 48
      include/vlc/libvlc_media.h
  2. 4
      lib/libvlc.sym
  3. 33
      lib/media.c

48
include/vlc/libvlc_media.h

@ -474,6 +474,54 @@ LIBVLC_API void libvlc_media_set_meta( libvlc_media_t *p_md,
libvlc_meta_t e_meta,
const char *psz_value );
/**
* Read the meta extra of the media.
*
* If the media has not yet been parsed this will return NULL.
*
* \see libvlc_media_parse
* \see libvlc_media_parse_with_options
*
* \param p_md the media descriptor
* \param psz_name the meta extra to read (nonnullable)
* \return the media's meta extra or NULL
*/
LIBVLC_API char *libvlc_media_get_meta_extra( libvlc_media_t *p_md,
const char *psz_name );
/**
* 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 psz_name the meta extra to write (nonnullable)
* \param psz_value the media's meta extra (nullable)
* Removed from meta extra if set to NULL
*/
LIBVLC_API void libvlc_media_set_meta_extra( libvlc_media_t *p_md,
const char *psz_name,
const char *psz_value );
/**
* Read the meta extra names of the media.
*
* \param p_md the media descriptor
* \param pppsz_names the media's meta extra name array
* you can access the elements using the return value (count)
* must be released with libvlc_media_meta_extra_names_release()
* \return the meta extra count
*/
LIBVLC_API unsigned libvlc_media_get_meta_extra_names( libvlc_media_t *p_md,
char ***pppsz_names );
/**
* Release a media meta extra names
*
* \param ppsz_names meta extra names array to release
* \param i_count number of elements in the array
*/
LIBVLC_API void libvlc_media_meta_extra_names_release( char **ppsz_names,
unsigned i_count );
/**
* Save the meta previously set

4
lib/libvlc.sym

@ -209,6 +209,10 @@ libvlc_media_slaves_release
libvlc_media_set_meta
libvlc_media_set_user_data
libvlc_media_subitems
libvlc_media_get_meta_extra
libvlc_media_set_meta_extra
libvlc_media_get_meta_extra_names
libvlc_media_meta_extra_names_release
libvlc_new
libvlc_playlist_play
libvlc_release

33
lib/media.c

@ -695,6 +695,39 @@ void libvlc_media_set_meta( libvlc_media_t *p_md, libvlc_meta_t e_meta, const ch
input_item_SetMeta( p_md->p_input_item, libvlc_to_vlc_meta[e_meta], psz_value );
}
// Getter for meta extra information
char *libvlc_media_get_meta_extra( libvlc_media_t *p_md, const char *psz_name )
{
assert( p_md );
return input_item_GetMetaExtra( p_md->p_input_item, psz_name );
}
// Set the meta extra of the media
void libvlc_media_set_meta_extra( libvlc_media_t *p_md, const char *psz_name, const char *psz_value)
{
assert( p_md );
input_item_SetMetaExtra( p_md->p_input_item, psz_name, psz_value );
}
// Getter for meta extra names
unsigned libvlc_media_get_meta_extra_names( libvlc_media_t *p_md, char ***pppsz_names )
{
assert( p_md && pppsz_names );
return input_item_GetMetaExtraNames( p_md->p_input_item, pppsz_names );
}
// Release a media meta extra names
void libvlc_media_meta_extra_names_release( char **ppsz_names, unsigned i_count )
{
if( i_count > 0 )
{
assert( ppsz_names );
for ( unsigned i = 0; i < i_count; i++ )
free( ppsz_names[i] );
}
free( ppsz_names );
}
// Save the meta previously set
int libvlc_media_save_meta( libvlc_instance_t *inst, libvlc_media_t *p_md )
{

Loading…
Cancel
Save