[vlc-devel] [PATCH 3/3] demux: es: use STREAM_GET_TAGS
Thomas Guillem
thomas at gllm.fr
Mon Jul 17 14:36:19 CEST 2017
This set looks good to me.
On Thu, Jul 13, 2017, at 14:05, Francois Cartegnie wrote:
> ---
> modules/demux/mpeg/es.c | 31 +++++++++----------------------
> 1 file changed, 9 insertions(+), 22 deletions(-)
>
> diff --git a/modules/demux/mpeg/es.c b/modules/demux/mpeg/es.c
> index 3186592..8f27bae 100644
> --- a/modules/demux/mpeg/es.c
> +++ b/modules/demux/mpeg/es.c
> @@ -952,33 +952,20 @@ static int ID3TAG_Parse_Handler( uint32_t i_tag,
> const uint8_t *p_payload, size_
> return VLC_SUCCESS;
> }
>
> -static int ID3Parse( demux_t *p_demux, uint64_t i_stream_offset,
> +static int ID3Parse( demux_t *p_demux,
> int (*pf_callback)(uint32_t, const uint8_t *,
> size_t, void *) )
> {
> - const uint8_t *p_peek;
> + const uint8_t **pp_tags;
> + const int *pi_tag_sizes;
> + int i_tags;
>
> - bool b_canseek;
> - if( i_stream_offset < 10 ||
> - vlc_stream_Control( p_demux->s, STREAM_CAN_SEEK, &b_canseek ) !=
> VLC_SUCCESS ||
> - !b_canseek ||
> - vlc_stream_Seek( p_demux->s, 0 ) != VLC_SUCCESS )
> + if( vlc_stream_Control( p_demux->s, STREAM_GET_TAGS, &pp_tags,
> &pi_tag_sizes, &i_tags ) != VLC_SUCCESS )
> return VLC_EGENERIC;
>
> - int64_t i_peek = vlc_stream_Peek( p_demux->s, &p_peek,
> i_stream_offset );
> - if( i_peek > 0 && (uint64_t) i_peek == i_stream_offset )
> - {
> - while( i_peek > 0 )
> - {
> - size_t i_forward = ID3TAG_Parse( p_peek, i_peek,
> - pf_callback, (void *)
> p_demux );
> - if(i_forward == 0)
> - break;
> - p_peek += i_forward;
> - i_peek -= i_forward;
> - }
> - }
> + for( int i=0; i<i_tags; i++ )
> + ID3TAG_Parse( pp_tags[i], pi_tag_sizes[i], pf_callback, (void *)
> p_demux );
>
> - return vlc_stream_Seek( p_demux->s, i_stream_offset );
> + return VLC_SUCCESS;
> }
>
> static int MpgaInit( demux_t *p_demux )
> @@ -991,7 +978,7 @@ static int MpgaInit( demux_t *p_demux )
> /* */
> p_sys->i_packet_size = 1024;
>
> - ID3Parse( p_demux, p_sys->i_stream_offset, ID3TAG_Parse_Handler );
> + ID3Parse( p_demux, ID3TAG_Parse_Handler );
>
> /* Load a potential xing header */
> i_peek = vlc_stream_Peek( p_demux->s, &p_peek, 4 + 1024 );
> --
> 2.9.4
>
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel
More information about the vlc-devel
mailing list