gmerlin
Data Structures | Macros | Functions
Track information
Media input

Data Structures

struct  bg_audio_info_t
 Description of an audio stream. More...
 
struct  bg_video_info_t
 Description of a video stream. More...
 
struct  bg_text_info_t
 Description of a text stream. More...
 
struct  bg_overlay_info_t
 Description of an overlay stream. More...
 
struct  bg_track_info_t
 Track info. More...
 

Macros

#define BG_TRACK_SEEKABLE   (1<<0)
 Track is seekable.
 
#define BG_TRACK_PAUSABLE   (1<<1)
 Track is pausable.
 

Functions

char * bg_create_track_name (const gavl_metadata_t *m, const char *format)
 Create trackname from metadata.
 
char * bg_metadata_to_string (const gavl_metadata_t *m, int use_tabs)
 Convert metadata to a humanized string.
 
int bg_metadata_get_year (const gavl_metadata_t *m)
 Try to get the year from the metadata.
 
void bg_xml_2_metadata (xmlDocPtr xml_doc, xmlNodePtr xml_metadata, gavl_metadata_t *ret)
 Convert a libxml2 node into a metadata struct.
 
void bg_metadata_2_xml (xmlNodePtr xml_metadata, gavl_metadata_t *ret)
 Convert a metadata struct into a libxml2 node.
 
bg_parameter_info_tbg_metadata_get_parameters (gavl_metadata_t *m)
 Get parameters for editing metadata.
 
bg_parameter_info_tbg_metadata_get_parameters_common (gavl_metadata_t *m)
 Get parameters for editing metadata.
 
void bg_metadata_set_parameter (void *data, const char *name, const bg_parameter_value_t *v)
 Change metadata by setting parameters.
 
void bg_chapter_list_set_default_names (gavl_chapter_list_t *list)
 Set default chapter names.
 
void bg_chapter_list_2_xml (gavl_chapter_list_t *list, xmlNodePtr xml_list)
 Convert a chapter list into a libxml2 node.
 
gavl_chapter_list_t * bg_xml_2_chapter_list (xmlDocPtr xml_doc, xmlNodePtr xml_list)
 Convert libxml2 node into a chapter list.
 
void bg_chapter_list_save (gavl_chapter_list_t *list, const char *filename)
 Save a chapter list to a file.
 
gavl_chapter_list_t * bg_chapter_list_load (const char *filename)
 Load a chapter list from a file.
 
void bg_track_info_free (bg_track_info_t *info)
 Free all allocated memory in a track info.
 
void bg_set_track_name_default (bg_track_info_t *info, const char *location)
 Set the track name from the filename/URL.
 
char * bg_get_track_name_default (const char *location, int track, int num_tracks)
 Get a track name from the filename/URL.
 
gavl_time_t bg_track_info_get_duration (const bg_track_info_t *info)
 Get the duration of a track.
 

Detailed Description

These structures describe media tracks with their streams. They are returned by the input plugin.

Macro Definition Documentation

#define BG_TRACK_SEEKABLE   (1<<0)

Track is seekable.

#define BG_TRACK_PAUSABLE   (1<<1)

Track is pausable.

Function Documentation

char* bg_create_track_name ( const gavl_metadata_t *  m,
const char *  format 
)

Create trackname from metadata.

Parameters
mMetadata
formatFormat string
Returns
A newly allocated track name or NULL

The format string can contain arbitrary characters and the following placeholders

  • p: Artist
  • a: Album
  • g: Genre
  • t: Track name
  • c: Comment
  • y: Year
  • %<d>n: Track number with <d> digits

If the string corresponding to a placeholder is NULL, the whole function is aborted and NULL is returned.

char* bg_metadata_to_string ( const gavl_metadata_t *  m,
int  use_tabs 
)

Convert metadata to a humanized string.

Parameters
mMetadata
use_tabsIndicate, that tabs (\t) should be used in the output
Returns
A newly allocated string
int bg_metadata_get_year ( const gavl_metadata_t *  m)

Try to get the year from the metadata.

Parameters
mMetadata
Returns
The year as int

The date string can be in multiple formats. This function tries to extract the year and return it as int.

void bg_xml_2_metadata ( xmlDocPtr  xml_doc,
xmlNodePtr  xml_metadata,
gavl_metadata_t *  ret 
)

Convert a libxml2 node into a metadata struct.

Parameters
xml_docPointer to the xml document
xml_metadataPointer to the xml node containing the metadata
retMetadata container, where the info will be stored

See the libxml2 documentation for more infos

void bg_metadata_2_xml ( xmlNodePtr  xml_metadata,
gavl_metadata_t *  ret 
)

Convert a metadata struct into a libxml2 node.

Parameters
retMetadata
xml_metadataPointer to the xml node for the metadata

See the libxml2 documentation for more infos

bg_parameter_info_t* bg_metadata_get_parameters ( gavl_metadata_t *  m)

Get parameters for editing metadata.

Parameters
mMetadata
Returns
A NULL-terminated array of parameter descriptions

Using this function and bg_metadata_set_parameter lets you set metadata with the usual configuration methods. The default values of the returned descriptions are set from the Metadata.

Call bg_parameter_info_destroy_array to free the returned array

bg_parameter_info_t* bg_metadata_get_parameters_common ( gavl_metadata_t *  m)

Get parameters for editing metadata.

Parameters
mMetadata
Returns
A NULL-terminated array of parameter descriptions

This function works exactly like bg_metadata_get_parameters but it returns only the parameters suitable for mass tagging. Using this function and bg_metadata_set_parameter lets you set metadata with the usual configuration methods. The default values of the returned descriptions are set from the Metadata.

Call bg_parameter_info_destroy_array to free the returned array

void bg_metadata_set_parameter ( void *  data,
const char *  name,
const bg_parameter_value_t v 
)

Change metadata by setting parameters.

Parameters
dataMetadata casted to void
nameName of the parameter
vValue
void bg_chapter_list_set_default_names ( gavl_chapter_list_t *  list)

Set default chapter names.

Parameters
listA chapter list

If no names for the chapters are avaiable, this function will set them to "Chapter 1", "Chapter 2" etc.

void bg_chapter_list_2_xml ( gavl_chapter_list_t *  list,
xmlNodePtr  xml_list 
)

Convert a chapter list into a libxml2 node.

Parameters
listChapter list
xml_listPointer to the xml node for the chapter list

See the libxml2 documentation for more infos

gavl_chapter_list_t* bg_xml_2_chapter_list ( xmlDocPtr  xml_doc,
xmlNodePtr  xml_list 
)

Convert libxml2 node into a chapter list.

Parameters
xml_docPointer to the xml document
xml_listPointer to the xml node for chapter list
Returns
The chapter list from the xml node

See the libxml2 documentation for more infos

void bg_chapter_list_save ( gavl_chapter_list_t *  list,
const char *  filename 
)

Save a chapter list to a file.

Parameters
listA chapter list
filenameWhere to save the list
gavl_chapter_list_t* bg_chapter_list_load ( const char *  filename)

Load a chapter list from a file.

Parameters
filenameFrom where to load the list
Returns
A newly created chapter list or NULL
void bg_track_info_free ( bg_track_info_t info)

Free all allocated memory in a track info.

Parameters
infoTrack info

This one can be called by plugins to free all allocated memory contained in a track info. Note, that you have to free() the structure itself after.

void bg_set_track_name_default ( bg_track_info_t info,
const char *  location 
)

Set the track name from the filename/URL.

Parameters
infoTrack info
locationfilename or URL

This is used for cases, where the input plugin didn't set a track name, and the name cannot (or shouldn't) be set from the metadata. If location is an URL, the whole URL will be copied into the name field. If location is a local filename, the path and extension will be removed.

char* bg_get_track_name_default ( const char *  location,
int  track,
int  num_tracks 
)

Get a track name from the filename/URL.

Parameters
locationfilename or URL
Returns
A newly allocated track name which must be freed by the caller
Parameters
trackTrack index
num_tracksTotal number of tracks of the location

If location is an URL, the whole URL will be copied into the name field. If location is a local filename, the path and extension will be removed.

gavl_time_t bg_track_info_get_duration ( const bg_track_info_t info)

Get the duration of a track.

Parameters
infoA track info
Returns
The approximate duration or GAVL_TIME_UNDEFINED