[vlc-devel] [PATCH v4] Add support for GoPro HiLight tags as chapters
Filip Roséen
filip at videolabs.io
Wed Jun 1 23:10:13 CEST 2016
See comment further down.
> +static int MP4_ReadBox_HMMT( stream_t *p_stream, MP4_Box_t *p_box )
> +{
> + MP4_Box_data_HMMT_t *p_hmmt;
> + MP4_READBOX_ENTER( MP4_Box_data_HMMT_t, MP4_FreeBox_HMMT );
> +
> + if( i_read < 5 )
> + MP4_READBOX_EXIT( 0 );
> +
> + p_hmmt = p_box->data.p_hmmt;
> +
> + MP4_GET4BYTES( p_hmmt->i_chapter_count );
> +
> + if( ( i_read / sizeof(uint32_t) ) < p_hmmt->i_chapter_count )
> + MP4_READBOX_EXIT( 0 );
> +
> + /* Cameras are allowing a maximum of 100 tags */
> + if( p_hmmt->i_chapter_count > 100 )
> + p_hmmt->i_chapter_count = 100;
> +
> + p_hmmt->i_chapter_start = calloc( p_hmmt->i_chapter_count, sizeof(uint32_t) );
> + if( p_hmmt->i_chapter_start == NULL )
> + MP4_READBOX_EXIT( 0 );
NITPICKING: `malloc` is enough, there is no need to zero out the allocated
memory ( since you know that you will write to every element of it ).
> +
> + for( uint32_t i = 0; i < p_hmmt->i_chapter_count; i++ )
> + {
> + MP4_GET4BYTES( p_hmmt->i_chapter_start[i] );
> + }
> +
> +#ifdef MP4_VERBOSE
> + msg_Dbg( p_stream, "read box: \"HMMT\" %d HiLight tags", p_hmmt->i_chapter_count );
> +#endif
> +
> + MP4_READBOX_EXIT( 1 );
> +}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20160601/8ead2719/attachment.html>
More information about the vlc-devel
mailing list