[FFmpeg-devel] [PATCH] [2/2] add the id3v2 parsing for adts aac, take 2
Michael Niedermayer
michaelni
Thu Jun 11 01:11:32 CEST 2009
On Wed, Jun 10, 2009 at 03:58:17PM +0200, Patrick Dehne wrote:
>
> This additionally takes the added ff_ prefix to the id3v2_parse function name into account.
>
> Patrick
>
> raw.c | 34 +++++++++++++++++++++++++++++++++-
> 1 file changed, 33 insertions(+), 1 deletion(-)
> ade47364501b014617d953d4b7c680ab76cbf341 2_adtsaac_parse_id3v2.patch
> Index: libavformat/raw.c
> ===================================================================
> --- libavformat/raw.c (revision 19141)
> +++ libavformat/raw.c (working copy)
> @@ -625,6 +625,38 @@
> else if(max_frames>=1) return 1;
> else return 0;
> }
> +
> +static int adts_aac_read_header(AVFormatContext *s,
> + AVFormatParameters *ap)
> +{
> + AVStream *st;
> + uint8_t buf[ID3v2_HEADER_SIZE];
> + int len, ret;
> +
> + st = av_new_stream(s, 0);
> + if (!st)
> + return AVERROR(ENOMEM);
> +
> + st->codec->codec_type = CODEC_TYPE_AUDIO;
> + st->codec->codec_id = s->iformat->value;
> + st->need_parsing = AVSTREAM_PARSE_FULL;
> +
> + /* parse ID3v2 header */
> + ret = get_buffer(s->pb, buf, ID3v2_HEADER_SIZE);
> + if (ret != ID3v2_HEADER_SIZE)
> + return -1;
> + if (ff_id3v2_match(buf)) {
> + len = ((buf[6] & 0x7f) << 21) |
> + ((buf[7] & 0x7f) << 14) |
> + ((buf[8] & 0x7f) << 7) |
> + (buf[9] & 0x7f);
> + ff_id3v2_parse(s, len, buf[3], buf[5]);
> + } else {
> + url_fseek(s->pb, 0, SEEK_SET);
> + }
trailing whitespace
code duplication relative to mp3.c
and its missing id3v1 that mp3.c has
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
Rewriting code that is poorly written but fully understood is good.
Rewriting code that one doesnt understand is a sign that one is less smart
then the original author, trying to rewrite it will not make it better.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20090611/64462e37/attachment.pgp>
More information about the ffmpeg-devel
mailing list