vlc | branch: master | Thomas Guillem <[email protected]> | Thu Jul 12 11:21:31 2018 +0200| [9dc070b930b2c62d73535358c43b1298a3ee4e3b] | committer: Thomas Guillem
lib/media_player: use INPUT_GET_FULL_TITLE_INFO Don't use INPUT_GET_TITLE_INFO that depends on a variable. > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=9dc070b930b2c62d73535358c43b1298a3ee4e3b --- lib/media_player.c | 41 +++++++++++++++-------------------------- 1 file changed, 15 insertions(+), 26 deletions(-) diff --git a/lib/media_player.c b/lib/media_player.c index 426ba88903..7903d3ea43 100644 --- a/lib/media_player.c +++ b/lib/media_player.c @@ -1555,33 +1555,22 @@ int libvlc_media_player_get_full_chapter_descriptions( libvlc_media_player_t *p_ return -1; seekpoint_t **p_seekpoint = NULL; + input_title_t **pp_title, *p_title = NULL; + int i_title_count = 0, ci_chapter_count = 0; + int ret = input_Control( p_input_thread, INPUT_GET_FULL_TITLE_INFO, &pp_title, + &i_title_count ); + vlc_object_release( p_input_thread ); - /* fetch data */ - int ci_chapter_count = i_chapters_of_title; - - int ret = input_Control(p_input_thread, INPUT_GET_SEEKPOINTS, &p_seekpoint, &ci_chapter_count); - if( ret != VLC_SUCCESS) - { - vlc_object_release( p_input_thread ); - return -1; - } + if( ret != VLC_SUCCESS || i_chapters_of_title >= i_title_count ) + goto error; - if (ci_chapter_count == 0 || p_seekpoint == NULL) - { - vlc_object_release( p_input_thread ); - return 0; - } + p_title = pp_title[i_chapters_of_title]; + int64_t i_title_duration = MS_FROM_VLC_TICK(p_title->i_length); + p_seekpoint = p_title->seekpoint; + ci_chapter_count = p_title->i_seekpoint; - input_title_t *p_title; - ret = input_Control( p_input_thread, INPUT_GET_TITLE_INFO, &p_title, - &i_chapters_of_title ); - vlc_object_release( p_input_thread ); - if( ret != VLC_SUCCESS ) - { + if( ci_chapter_count == 0 || p_seekpoint == NULL) goto error; - } - int64_t i_title_duration = MS_FROM_VLC_TICK(p_title->i_length); - vlc_input_title_Delete( p_title ); *pp_chapters = calloc( ci_chapter_count, sizeof(**pp_chapters) ); if( !*pp_chapters ) @@ -1632,9 +1621,9 @@ int libvlc_media_player_get_full_chapter_descriptions( libvlc_media_player_t *p_ error: if( *pp_chapters ) libvlc_chapter_descriptions_release( *pp_chapters, ci_chapter_count ); - for ( int i = 0; i < ci_chapter_count; ++i ) - vlc_seekpoint_Delete( p_seekpoint[i] ); - free( p_seekpoint ); + for( int i = 0; i < i_title_count; i++ ) + vlc_input_title_Delete( pp_title[i] ); + free( pp_title ) ; return -1; } _______________________________________________ vlc-commits mailing list [email protected] https://mailman.videolan.org/listinfo/vlc-commits
