Commit 45668a24 authored by Felix Paul Kühne's avatar Felix Paul Kühne

libvlc: clean recent title and chapter API additions

Thanks to Rémi for the suggestions
parent 0ed21d15
......@@ -55,27 +55,23 @@ typedef struct libvlc_track_description_t
} libvlc_track_description_t;
/**
* Description for titles. It contains name (description string),
* duration in milliseconds if known,
* and information if it was recognized as a menu by the demuxer.
* Description for titles
*/
typedef struct libvlc_title_description_t
{
int64_t i_duration;
char *psz_name;
bool b_menu;
int64_t i_duration; /**< duration in milliseconds */
char *psz_name; /**< title name */
bool b_menu; /**< info if item was recognized as a menu by the demuxer */
} libvlc_title_description_t;
/**
* Description for chapters.
* It contains information about time offset, duration
* (both in milliseconds) as well as name (description string).
* Description for chapters
*/
typedef struct libvlc_chapter_description_t
{
int64_t i_time_offset;
int64_t i_duration;
char *psz_name;
int64_t i_time_offset; /**< time-offset of the chapter in milliseconds */
int64_t i_duration; /**< duration of the chapter in milliseconds */
char *psz_name; /**< chapter name */
} libvlc_chapter_description_t;
/**
......
......@@ -1368,7 +1368,7 @@ int libvlc_media_player_get_full_title_descriptions( libvlc_media_player_t *p_mi
/* fill array */
for( int i = 0; i < ci_title_count; i++)
{
libvlc_title_description_t *p_title = calloc( 1, sizeof(*p_title) );
libvlc_title_description_t *p_title = malloc( sizeof(*p_title) );
if( unlikely(p_title == NULL) )
{
libvlc_title_descriptions_release( *pp_titles, ci_title_count );
......@@ -1446,11 +1446,10 @@ int libvlc_media_player_get_full_chapter_descriptions( libvlc_media_player_t *p_
/* fill array */
for( int i = 0; i < ci_chapter_count; i++)
{
libvlc_chapter_description_t *p_chapter = calloc( 1, sizeof(*p_chapter) );
libvlc_chapter_description_t *p_chapter = malloc( sizeof(*p_chapter) );
if( unlikely(p_chapter == NULL) )
{
libvlc_chapter_descriptions_release( *pp_chapters, ci_chapter_count );
free( p_chapter );
return -1;
}
(*pp_chapters)[i] = p_chapter;
......
......@@ -393,8 +393,8 @@ int input_vaControl( input_thread_t *p_input, int i_query, va_list args )
case INPUT_GET_SEEKPOINTS:
{
seekpoint_t ***array = (seekpoint_t ***)va_arg( args, seekpoint_t *** );
int *pi_title_to_fetch = (int *) va_arg( args, int * );
seekpoint_t ***array = va_arg( args, seekpoint_t *** );
int *pi_title_to_fetch = va_arg( args, int * );
vlc_mutex_lock( &p_input->p->p_item->lock );
......@@ -420,7 +420,7 @@ int input_vaControl( input_thread_t *p_input, int i_query, va_list args )
}
*array = calloc( p_title->i_seekpoint, sizeof(**array) );
if( !array )
if( unlikely(array == NULL) )
{
vlc_mutex_unlock( &p_input->p->p_item->lock );
return VLC_ENOMEM;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment