[vlc-commits] libvlc: clean recent title and chapter API additions
Felix Paul Kühne
git at videolan.org
Tue Jun 16 13:00:28 CEST 2015
vlc | branch: master | Felix Paul Kühne <fkuehne at videolan.org> | Tue Jun 16 12:52:45 2015 +0200| [45668a249ecd1b33448b6ca4173a732b838680cb] | committer: Felix Paul Kühne
libvlc: clean recent title and chapter API additions
Thanks to Rémi for the suggestions
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=45668a249ecd1b33448b6ca4173a732b838680cb
---
include/vlc/libvlc_media_player.h | 20 ++++++++------------
lib/media_player.c | 5 ++---
src/input/control.c | 6 +++---
3 files changed, 13 insertions(+), 18 deletions(-)
diff --git a/include/vlc/libvlc_media_player.h b/include/vlc/libvlc_media_player.h
index ca32d1a..d24392d 100644
--- a/include/vlc/libvlc_media_player.h
+++ b/include/vlc/libvlc_media_player.h
@@ -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;
/**
diff --git a/lib/media_player.c b/lib/media_player.c
index 9c88996..c26e190 100644
--- a/lib/media_player.c
+++ b/lib/media_player.c
@@ -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;
diff --git a/src/input/control.c b/src/input/control.c
index dc33492..6d45d7f 100644
--- a/src/input/control.c
+++ b/src/input/control.c
@@ -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;
More information about the vlc-commits
mailing list