[MPlayer-dev-eng] [PATCH] libmpdemux/demux_audio: Skip ID3v2.4 tags.

Ingo Brückl ib at wupperonline.de
Sun Jan 15 14:51:52 CET 2012


Benoît Thébaudeau wrote on Fri, 13 Jan 2012 21:47:24 +0100 (CET):

> @@ -358,9 +358,11 @@ static int demux_audio_open(demuxer_t* d
>  	step = 4;
>      } else if( hdr[0] == 'I' && hdr[1] == 'D' && hdr[2] == '3' && (hdr[3] >= 2)) {
>        int len;
> -      stream_skip(s,2);
> +      stream_skip(s,1);
> +      stream_read(s,hdr,1);
> +      len = hdr[0] & 0x10 ? 10 : 0;
>        stream_read(s,hdr,4);
> -      len = (hdr[0]<<21) | (hdr[1]<<14) | (hdr[2]<<7) | hdr[3];
> +      len += (hdr[0]<<21) | (hdr[1]<<14) | (hdr[2]<<7) | hdr[3];
>        stream_skip(s,len);
>        step = 4;
>      } else if( found_WAVE && hdr[0] == 'f' && hdr[1] == 'm' && hdr[2] == 't' && hdr[3] == ' ' ) {

Why skipping 10 extra bytes? If I understand the specs correctly, the footer
at the end of the file doesn't count for the ID3v2.4 size, so it's compatible
to earlier ID3v2.

> @@ -446,6 +448,17 @@ static int demux_audio_open(demuxer_t* d
>  	g = stream_read_char(s);
>  	demux_info_add(demuxer,"Genre",genres[g]);
>        }
> +      stream_seek(s,demuxer->movi_end-10);
> +      stream_read(s,hdr,4);

I'd prefer reading into tag to better match the "TAG" check.

Are "TAG" and "3DI" mutually exclusive (I don't get it clearly from the
specs)? What if both are present and "TAG" comes before "3DI"?

> +      if( hdr[0] == '3' && hdr[1] == 'D' && hdr[2] == 'I' && (hdr[3] >= 2)) {
> +	int len;
> +	stream_skip(s,1);
> +	stream_read(s,hdr,1);
> +	len = hdr[0] & 0x10 ? 20 : 10;
> +	stream_read(s,hdr,4);
> +	len += (hdr[0]<<21) | (hdr[1]<<14) | (hdr[2]<<7) | hdr[3];
> +	demuxer->movi_end = stream_tell(s)-len;
> +      }
>      }
>      if (duration && demuxer->movi_end && demuxer->movi_end > demuxer->movi_start) sh_audio->wf->nAvgBytesPerSec = (demuxer->movi_end - demuxer->movi_start) / duration;
>      sh_audio->i_bps = sh_audio->wf->nAvgBytesPerSec;

Isn't it simply demuxer->movi_end = stream_tell(s)-4?

Ingo


More information about the MPlayer-dev-eng mailing list