summaryrefslogtreecommitdiff
path: root/libavformat/swf.c
diff options
context:
space:
mode:
authorBaptiste Coudurier <baptiste.coudurier@gmail.com>2007-01-14 12:47:32 +0000
committerBaptiste Coudurier <baptiste.coudurier@gmail.com>2007-01-14 12:47:32 +0000
commit8f36d4ba4ddbf23840201465f96d83a744717c35 (patch)
tree022259d65f204a169b5a05b0de9fdd3b3af230c9 /libavformat/swf.c
parente8fc93136d0c0429ef7afc4820815c19093aa2ee (diff)
simplify
Originally committed as revision 7465 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavformat/swf.c')
-rw-r--r--libavformat/swf.c17
1 files changed, 4 insertions, 13 deletions
diff --git a/libavformat/swf.c b/libavformat/swf.c
index 1efcfd4a3f..7ec3f7f767 100644
--- a/libavformat/swf.c
+++ b/libavformat/swf.c
@@ -800,6 +800,7 @@ static int swf_read_header(AVFormatContext *s, AVFormatParameters *ap)
}
} else if ( ( tag == TAG_STREAMHEAD || tag == TAG_STREAMHEAD2 ) && !ast) {
/* streaming found */
+ int sample_rate_code;
get_byte(pb);
v = get_byte(pb);
swf->samples_per_frame = get_le16(pb);
@@ -811,20 +812,10 @@ static int swf_read_header(AVFormatContext *s, AVFormatParameters *ap)
if (v & 0x20)
ast->codec->codec_id = CODEC_ID_MP3;
ast->need_parsing = 1;
- switch((v>> 2) & 0x03) {
- case 1:
- ast->codec->sample_rate = 11025;
- break;
- case 2:
- ast->codec->sample_rate = 22050;
- break;
- case 3:
- ast->codec->sample_rate = 44100;
- break;
- default:
+ sample_rate_code= (v>>2) & 3;
+ if (!sample_rate_code)
return AVERROR_IO;
- }
-
+ ast->codec->sample_rate = 11025 << (sample_rate_code-1);
if (len > 4)
url_fskip(pb,len-4);