[vlc-devel] [PATCH] demux: mp4: Add support for GoPro HiLight tags as chapters, so they can appear in the progress bar

Jean-Baptiste Kempf jb at videolan.org
Wed Oct 28 20:42:25 CET 2015


On 28 Oct, Emeric Grange wrote :
> +        p_hmmt->chapter[i].psz_name = malloc( 18 );
> +        if( !p_hmmt->chapter[i].psz_name )
> +            MP4_READBOX_EXIT( 0 );
> +        strncpy(p_hmmt->chapter[i].psz_name, "HiLight tag #", 17);
> +        snprintf(tag_nb, 3, "%d", i + 1);
> +        strncat(p_hmmt->chapter[i].psz_name, tag_nb, 4);

asprintf to replace all this maybe?

> +static void LoadChapterGoPro( demux_t  *p_demux, MP4_Box_t *p_chpl )
> +{
> +    demux_sys_t *p_sys = p_demux->p_sys;
> +    int i;
> +
> +    p_sys->p_title = vlc_input_title_New();
> +    for( i = 0; i < BOXDATA(p_chpl)->i_chapter; i++ )

We are C99, you can do
for( int i ; ..

Moreover, i_chapter is unsigned, so you probably should use unsigned
int i.

> +    {
> +        seekpoint_t *s = vlc_seekpoint_New();

This can fail. (unlikely).


-- 
Jean-Baptiste Kempf
http://www.jbkempf.com/ - +33 672 704 734
Sent from my Electronic Device


More information about the vlc-devel mailing list