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_subtitle_info_t
 Description of a subtitle stream. More...
struct  bg_metadata_extended_t
 Metadata extensions. More...
struct  bg_metadata_t
 Description of metadata. More...
struct  bg_chapter_list_t
 Chapter list. More...
struct  bg_track_info_t
 Track info. More...

Defines

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

Functions

void bg_metadata_free (bg_metadata_t *m)
 Free all strings in a metadata structure.
void bg_metadata_copy (bg_metadata_t *dst, const bg_metadata_t *src)
 Copy metadata.
char * bg_create_track_name (const bg_metadata_t *m, const char *format)
 Create trackname from metadata.
char * bg_metadata_to_string (const bg_metadata_t *m, int use_tabs)
 Convert metadata to a humanized string.
int bg_metadata_get_year (const bg_metadata_t *m)
 Try to get the year from the metadata.
void bg_metadata_append_ext (bg_metadata_t *m, const char *key, const char *value)
 Append extended metadata.
void bg_xml_2_metadata (xmlDocPtr xml_doc, xmlNodePtr xml_metadata, bg_metadata_t *ret)
 Convert a libxml2 node into a metadata struct.
void bg_metadata_2_xml (xmlNodePtr xml_metadata, bg_metadata_t *ret)
 Convert a metadata struct into a libxml2 node.
bg_parameter_info_tbg_metadata_get_parameters (bg_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_metadata_dump (const bg_metadata_t *m)
 Dump metadata to stderr.
bg_chapter_list_tbg_chapter_list_create (int num_chapters)
 Create chapter list.
bg_chapter_list_tbg_chapter_list_copy (const bg_chapter_list_t *list)
 Copy chapter list.
void bg_chapter_list_destroy (bg_chapter_list_t *list)
 Destroy chapter list.
void bg_chapter_list_insert (bg_chapter_list_t *list, int index, int64_t time, const char *name)
 Insert a chapter into a chapter list.
void bg_chapter_list_delete (bg_chapter_list_t *list, int index)
 Delete a chapter from a chapter list.
void bg_chapter_list_set_default_names (bg_chapter_list_t *list)
 Set default chapter names.
int bg_chapter_list_get_current (bg_chapter_list_t *list, gavl_time_t time)
 Get current chapter.
int bg_chapter_list_changed (bg_chapter_list_t *list, gavl_time_t time, int *current_chapter)
 Get current chapter.
void bg_chapter_list_2_xml (bg_chapter_list_t *list, xmlNodePtr xml_list)
 Convert a chapter list into a libxml2 node.
bg_chapter_list_tbg_xml_2_chapter_list (xmlDocPtr xml_doc, xmlNodePtr xml_list)
 Convert libxml2 node into a chapter list.
void bg_chapter_list_save (bg_chapter_list_t *list, const char *filename)
 Save a chapter list to a file.
bg_chapter_list_tbg_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.

Detailed Description

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


Define Documentation

#define BG_TRACK_SEEKABLE   (1<<0)

Track is seekable.

#define BG_TRACK_PAUSABLE   (1<<1)

Track is pausable.


Function Documentation

void bg_metadata_free ( bg_metadata_t m  ) 

Free all strings in a metadata structure.

Parameters:
m Metadata
void bg_metadata_copy ( bg_metadata_t dst,
const bg_metadata_t src 
)

Copy metadata.

Parameters:
dst Destination
src Source

Make sure, that dst is either memset to 0 before the call or contains only strings, which can savely be freed.

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

Create trackname from metadata.

Parameters:
m Metadata
format Format 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 bg_metadata_t m,
int  use_tabs 
)

Convert metadata to a humanized string.

Parameters:
m Metadata
use_tabs Indicate, that tabs (\t) should be used in the output
Returns:
A newly allocated string
int bg_metadata_get_year ( const bg_metadata_t m  ) 

Try to get the year from the metadata.

Parameters:
m Metadata
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_metadata_append_ext ( bg_metadata_t m,
const char *  key,
const char *  value 
)

Append extended metadata.

Parameters:
m Metadata
key Key
value Value

Append a key-value pair to the extended metadata

void bg_xml_2_metadata ( xmlDocPtr  xml_doc,
xmlNodePtr  xml_metadata,
bg_metadata_t ret 
)

Convert a libxml2 node into a metadata struct.

Parameters:
xml_doc Pointer to the xml document
xml_metadata Pointer to the xml node containing the metadata
ret Metadata container, where the info will be stored

See the libxml2 documentation for more infos

void bg_metadata_2_xml ( xmlNodePtr  xml_metadata,
bg_metadata_t ret 
)

Convert a metadata struct into a libxml2 node.

Parameters:
ret Metadata
xml_metadata Pointer to the xml node for the metadata

See the libxml2 documentation for more infos

bg_parameter_info_t* bg_metadata_get_parameters ( bg_metadata_t m  ) 

Get parameters for editing metadata.

Parameters:
m Metadata
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

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

Change metadata by setting parameters.

Parameters:
data Metadata casted to void
name Name of the parameter
v Value
void bg_metadata_dump ( const bg_metadata_t m  ) 

Dump metadata to stderr.

Parameters:
m Metadata

Used for debugging purposes

bg_chapter_list_t* bg_chapter_list_create ( int  num_chapters  ) 

Create chapter list.

Parameters:
num_chapters Initial number of chapters
bg_chapter_list_t* bg_chapter_list_copy ( const bg_chapter_list_t list  ) 

Copy chapter list.

Parameters:
list Chapter list
void bg_chapter_list_destroy ( bg_chapter_list_t list  ) 

Destroy chapter list.

Parameters:
list A chapter list
void bg_chapter_list_insert ( bg_chapter_list_t list,
int  index,
int64_t  time,
const char *  name 
)

Insert a chapter into a chapter list.

Parameters:
list A chapter list
index Position (starting with 0) where the new chapter will be placed
time Start time of the chapter
name Chapter name (or NULL)
void bg_chapter_list_delete ( bg_chapter_list_t list,
int  index 
)

Delete a chapter from a chapter list.

Parameters:
list A chapter list
index Position (starting with 0) of the chapter to delete
void bg_chapter_list_set_default_names ( bg_chapter_list_t list  ) 

Set default chapter names.

Parameters:
list A chapter list

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

int bg_chapter_list_get_current ( bg_chapter_list_t list,
gavl_time_t  time 
)

Get current chapter.

Parameters:
list A chapter list
time Playback time
Returns:
The current chapter index

Use this function after seeking to signal a chapter change

int bg_chapter_list_changed ( bg_chapter_list_t list,
gavl_time_t  time,
int *  current_chapter 
)

Get current chapter.

Parameters:
list A chapter list
time Playback time
current_chapter Returns the current chapter
Returns:
1 if the chapter changed, 0 else

Use this function during linear playback to signal a chapter change

void bg_chapter_list_2_xml ( bg_chapter_list_t list,
xmlNodePtr  xml_list 
)

Convert a chapter list into a libxml2 node.

Parameters:
list Chapter list
xml_list Pointer to the xml node for the chapter list

See the libxml2 documentation for more infos

bg_chapter_list_t* bg_xml_2_chapter_list ( xmlDocPtr  xml_doc,
xmlNodePtr  xml_list 
)

Convert libxml2 node into a chapter list.

Parameters:
xml_doc Pointer to the xml document
xml_list Pointer 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 ( bg_chapter_list_t list,
const char *  filename 
)

Save a chapter list to a file.

Parameters:
list A chapter list
filename Where to save the list
bg_chapter_list_t* bg_chapter_list_load ( const char *  filename  ) 

Load a chapter list from a file.

Parameters:
filename From 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:
info Track 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:
info Track info
location filename 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:
location filename or URL
Returns:
A newly allocated track name which must be freed by the caller
Parameters:
track Track index
num_tracks Total 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.

Generated on Sun Feb 28 07:43:45 2010 for gmerlin by  doxygen 1.6.3