summaryrefslogtreecommitdiff
path: root/libavcodec/mpegaudiodec.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2006-10-30 02:19:55 +0000
committerMichael Niedermayer <michaelni@gmx.at>2006-10-30 02:19:55 +0000
commit498c544ad20be3e5ebf9c481cc239958399fba12 (patch)
tree286002226bf9acd609bf5a6ffecd33d19ac3362f /libavcodec/mpegaudiodec.c
parentc0d8052b501bb07ccc379f0967ffe9bb2c77e606 (diff)
dont set the sampling rate just because 1 mp3 packet header says so (fixes playback speed on some old mencoder generated avis which where then dumped to mp3)
Originally committed as revision 6837 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/mpegaudiodec.c')
-rw-r--r--libavcodec/mpegaudiodec.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/libavcodec/mpegaudiodec.c b/libavcodec/mpegaudiodec.c
index 7d6087adde..071c1a192c 100644
--- a/libavcodec/mpegaudiodec.c
+++ b/libavcodec/mpegaudiodec.c
@@ -1190,7 +1190,7 @@ static int decode_header(MPADecodeContext *s, uint32_t header)
/* useful helper to get mpeg audio stream infos. Return -1 if error in
header, otherwise the coded frame size in bytes */
-int mpa_decode_header(AVCodecContext *avctx, uint32_t head)
+int mpa_decode_header(AVCodecContext *avctx, uint32_t head, int *sample_rate)
{
MPADecodeContext s1, *s = &s1;
@@ -1217,7 +1217,7 @@ int mpa_decode_header(AVCodecContext *avctx, uint32_t head)
break;
}
- avctx->sample_rate = s->sample_rate;
+ *sample_rate = s->sample_rate;
avctx->channels = s->nb_channels;
avctx->bit_rate = s->bit_rate;
avctx->sub_id = s->layer;
@@ -2547,7 +2547,6 @@ retry:
return -1;
}
/* update codec info */
- avctx->sample_rate = s->sample_rate;
avctx->channels = s->nb_channels;
avctx->bit_rate = s->bit_rate;
avctx->sub_id = s->layer;
@@ -2574,9 +2573,11 @@ retry:
}
out_size = mp_decode_frame(s, out_samples, buf, buf_size);
- if(out_size>=0)
+ if(out_size>=0){
*data_size = out_size;
- else
+ avctx->sample_rate = s->sample_rate;
+ //FIXME maybe move the other codec info stuff from above here too
+ }else
av_log(avctx, AV_LOG_DEBUG, "Error while decoding MPEG audio frame.\n"); //FIXME return -1 / but also return the number of bytes consumed
s->frame_size = 0;
return buf_size;