From 5602a464c9f9e3c0922f5cfeccaf2fa1c40b2401 Mon Sep 17 00:00:00 2001 From: Justin Ruggles Date: Sun, 15 Jan 2012 13:38:03 -0500 Subject: avcodec: add a Vorbis parser to get packet duration This also allows for removing some of the Vorbis-related hacks. --- libavformat/oggparsevorbis.c | 1 + libavformat/rtpdec.c | 3 +++ libavformat/utils.c | 6 +----- 3 files changed, 5 insertions(+), 5 deletions(-) (limited to 'libavformat') diff --git a/libavformat/oggparsevorbis.c b/libavformat/oggparsevorbis.c index ba9b348456..b9d9f575e0 100644 --- a/libavformat/oggparsevorbis.c +++ b/libavformat/oggparsevorbis.c @@ -251,6 +251,7 @@ vorbis_header (AVFormatContext * s, int idx) st->codec->codec_type = AVMEDIA_TYPE_AUDIO; st->codec->codec_id = CODEC_ID_VORBIS; + st->need_parsing = AVSTREAM_PARSE_HEADERS; if (srate > 0) { st->codec->sample_rate = srate; diff --git a/libavformat/rtpdec.c b/libavformat/rtpdec.c index a8c5c3ff4c..61653f7b39 100644 --- a/libavformat/rtpdec.c +++ b/libavformat/rtpdec.c @@ -396,6 +396,9 @@ RTPDemuxContext *ff_rtp_parse_open(AVFormatContext *s1, AVStream *st, URLContext case CODEC_ID_H264: st->need_parsing = AVSTREAM_PARSE_FULL; break; + case CODEC_ID_VORBIS: + st->need_parsing = AVSTREAM_PARSE_HEADERS; + break; case CODEC_ID_ADPCM_G722: /* According to RFC 3551, the stream clock rate is 8000 * even if the sample rate is 16000. */ diff --git a/libavformat/utils.c b/libavformat/utils.c index cf4392b581..123bc8bf9a 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -701,9 +701,6 @@ static int get_audio_frame_size(AVCodecContext *enc, int size) { int frame_size; - if(enc->codec_id == CODEC_ID_VORBIS) - return -1; - if (enc->frame_size <= 1) { int bits_per_sample = av_get_bits_per_sample(enc->codec_id); @@ -1995,8 +1992,7 @@ static int has_codec_parameters(AVCodecContext *avctx) case AVMEDIA_TYPE_AUDIO: val = avctx->sample_rate && avctx->channels && avctx->sample_fmt != AV_SAMPLE_FMT_NONE; if (!avctx->frame_size && - (avctx->codec_id == CODEC_ID_VORBIS || - avctx->codec_id == CODEC_ID_AAC || + (avctx->codec_id == CODEC_ID_AAC || avctx->codec_id == CODEC_ID_MP1 || avctx->codec_id == CODEC_ID_MP2 || avctx->codec_id == CODEC_ID_MP3 || -- cgit v1.2.3