Commit 708e3e7d authored by Baptiste Coudurier's avatar Baptiste Coudurier

simplify pcm read seek, use av_get_bits_per_sample

Originally committed as revision 6728 to svn://svn.ffmpeg.org/ffmpeg/trunk
parent ca612735
...@@ -183,26 +183,11 @@ int pcm_read_seek(AVFormatContext *s, ...@@ -183,26 +183,11 @@ int pcm_read_seek(AVFormatContext *s,
int64_t pos; int64_t pos;
st = s->streams[0]; st = s->streams[0];
switch(st->codec->codec_id) {
case CODEC_ID_PCM_S16LE: block_align = st->codec->block_align ? st->codec->block_align :
case CODEC_ID_PCM_S16BE: (av_get_bits_per_sample(st->codec->codec_id) * st->codec->channels) >> 3;
case CODEC_ID_PCM_U16LE: byte_rate = st->codec->bit_rate ? st->codec->bit_rate >> 3 :
case CODEC_ID_PCM_U16BE: block_align * st->codec->sample_rate;
block_align = 2 * st->codec->channels;
byte_rate = block_align * st->codec->sample_rate;
break;
case CODEC_ID_PCM_S8:
case CODEC_ID_PCM_U8:
case CODEC_ID_PCM_MULAW:
case CODEC_ID_PCM_ALAW:
block_align = st->codec->channels;
byte_rate = block_align * st->codec->sample_rate;
break;
default:
block_align = st->codec->block_align;
byte_rate = st->codec->bit_rate / 8;
break;
}
if (block_align <= 0 || byte_rate <= 0) if (block_align <= 0 || byte_rate <= 0)
return -1; return -1;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment