Mercurial > libavformat.hg
comparison raw.c @ 5046:b4b0df2c408b libavformat
Add support for id3 tag parsing for ADTS AAC streams
Patch by Patrick Dehne ( patrick mysonicweb com )
author | superdump |
---|---|
date | Fri, 19 Jun 2009 14:36:47 +0000 |
parents | 62d8279280a8 |
children | fcb33a4b62d3 |
comparison
equal
deleted
inserted
replaced
5045:9ed3c88ed9ba | 5046:b4b0df2c408b |
---|---|
25 #include "libavcodec/get_bits.h" | 25 #include "libavcodec/get_bits.h" |
26 #include "libavcodec/bytestream.h" | 26 #include "libavcodec/bytestream.h" |
27 #include "avformat.h" | 27 #include "avformat.h" |
28 #include "raw.h" | 28 #include "raw.h" |
29 #include "id3v2.h" | 29 #include "id3v2.h" |
30 #include "id3v1.h" | |
30 | 31 |
31 /* simple formats */ | 32 /* simple formats */ |
32 | 33 |
33 #if CONFIG_ROQ_MUXER | 34 #if CONFIG_ROQ_MUXER |
34 static int roq_write_header(struct AVFormatContext *s) | 35 static int roq_write_header(struct AVFormatContext *s) |
623 else if(max_frames>500)return AVPROBE_SCORE_MAX/2; | 624 else if(max_frames>500)return AVPROBE_SCORE_MAX/2; |
624 else if(max_frames>=3) return AVPROBE_SCORE_MAX/4; | 625 else if(max_frames>=3) return AVPROBE_SCORE_MAX/4; |
625 else if(max_frames>=1) return 1; | 626 else if(max_frames>=1) return 1; |
626 else return 0; | 627 else return 0; |
627 } | 628 } |
629 | |
630 static int adts_aac_read_header(AVFormatContext *s, | |
631 AVFormatParameters *ap) | |
632 { | |
633 AVStream *st; | |
634 | |
635 st = av_new_stream(s, 0); | |
636 if (!st) | |
637 return AVERROR(ENOMEM); | |
638 | |
639 st->codec->codec_type = CODEC_TYPE_AUDIO; | |
640 st->codec->codec_id = s->iformat->value; | |
641 st->need_parsing = AVSTREAM_PARSE_FULL; | |
642 | |
643 ff_id3v1_read(s); | |
644 ff_id3v2_read(s); | |
645 | |
646 return 0; | |
647 } | |
648 | |
628 #endif | 649 #endif |
629 | 650 |
630 /* Note: Do not forget to add new entries to the Makefile as well. */ | 651 /* Note: Do not forget to add new entries to the Makefile as well. */ |
631 | 652 |
632 #if CONFIG_AAC_DEMUXER | 653 #if CONFIG_AAC_DEMUXER |
633 AVInputFormat aac_demuxer = { | 654 AVInputFormat aac_demuxer = { |
634 "aac", | 655 "aac", |
635 NULL_IF_CONFIG_SMALL("raw ADTS AAC"), | 656 NULL_IF_CONFIG_SMALL("raw ADTS AAC"), |
636 0, | 657 0, |
637 adts_aac_probe, | 658 adts_aac_probe, |
638 audio_read_header, | 659 adts_aac_read_header, |
639 ff_raw_read_partial_packet, | 660 ff_raw_read_partial_packet, |
640 .flags= AVFMT_GENERIC_INDEX, | 661 .flags= AVFMT_GENERIC_INDEX, |
641 .extensions = "aac", | 662 .extensions = "aac", |
642 .value = CODEC_ID_AAC, | 663 .value = CODEC_ID_AAC, |
643 }; | 664 }; |