]> git.sesse.net Git - ffmpeg/commitdiff
avformat/avr: use ff_get_pcm_codec_id()
authorPaul B Mahol <onemda@gmail.com>
Sat, 12 Oct 2013 20:21:38 +0000 (20:21 +0000)
committerPaul B Mahol <onemda@gmail.com>
Sat, 12 Oct 2013 20:21:38 +0000 (20:21 +0000)
Signed-off-by: Paul B Mahol <onemda@gmail.com>
libavformat/avr.c

index e03f1a46f7d4839c9d3c9b3528299d359f6bf088..02edf451a82f383171454e1bbb89f737139d59a1 100644 (file)
@@ -69,16 +69,9 @@ static int avr_read_header(AVFormatContext *s)
     avio_skip(s->pb, 20);
     avio_skip(s->pb, 64);
 
-    if (!sign && bps == 8) {
-        st->codec->codec_id = AV_CODEC_ID_PCM_U8;
-    } else if (!sign && bps == 16) {
-        st->codec->codec_id = AV_CODEC_ID_PCM_U16BE;
-    } else if (sign == 0xFFFFu && bps == 8) {
-        st->codec->codec_id = AV_CODEC_ID_PCM_S8;
-    } else if (sign == 0xFFFFu && bps == 16) {
-        st->codec->codec_id = AV_CODEC_ID_PCM_S16BE;
-    } else {
-        avpriv_request_sample(s, "bits per sample %d", bps);
+    st->codec->codec_id = ff_get_pcm_codec_id(bps, 0, 1, sign);
+    if (st->codec->codec_id == AV_CODEC_ID_NONE) {
+        avpriv_request_sample(s, "Bps %d and sign %d", bps, sign);
         return AVERROR_PATCHWELCOME;
     }