summaryrefslogtreecommitdiff
path: root/libavformat/amr.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2006-10-10 23:56:49 +0000
committerMichael Niedermayer <michaelni@gmx.at>2006-10-10 23:56:49 +0000
commitb49638928ba26012fb71736dc2878ce485212cb1 (patch)
treeabb2d882915063883b484b24462c2e9fe8f40106 /libavformat/amr.c
parentd84fd5d153f7d12504cf605c786e3cfd2397206d (diff)
more factoriztaion and a FIXME note
Originally committed as revision 6636 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavformat/amr.c')
-rw-r--r--libavformat/amr.c17
1 files changed, 6 insertions, 11 deletions
diff --git a/libavformat/amr.c b/libavformat/amr.c
index 9992f09959..f271750fdf 100644
--- a/libavformat/amr.c
+++ b/libavformat/amr.c
@@ -91,6 +91,11 @@ static int amr_read_header(AVFormatContext *s,
get_buffer(pb, header, 6);
+ st = av_new_stream(s, 0);
+ if (!st)
+ {
+ return AVERROR_NOMEM;
+ }
if(memcmp(header,AMR_header,6)!=0)
{
get_buffer(pb, header+6, 3);
@@ -98,11 +103,6 @@ static int amr_read_header(AVFormatContext *s,
{
return -1;
}
- st = av_new_stream(s, 0);
- if (!st)
- {
- return AVERROR_NOMEM;
- }
st->codec->codec_tag = MKTAG('s', 'a', 'w', 'b');
st->codec->codec_id = CODEC_ID_AMR_WB;
@@ -110,12 +110,6 @@ static int amr_read_header(AVFormatContext *s,
}
else
{
- st = av_new_stream(s, 0);
- if (!st)
- {
- return AVERROR_NOMEM;
- }
-
st->codec->codec_tag = MKTAG('s', 'a', 'm', 'r');
st->codec->codec_id = CODEC_ID_AMR_NB;
st->codec->sample_rate = 8000;
@@ -140,6 +134,7 @@ static int amr_read_packet(AVFormatContext *s,
return AVERROR_IO;
}
+//FIXME this is wrong, this should rather be in a AVParset
toc=get_byte(&s->pb);
mode = (toc >> 3) & 0x0F;