changeset 2454:ad38b19b0f1a libavformat

Use av_get_bits_per_sample
author conrad
date Wed, 05 Sep 2007 00:23:34 +0000
parents 2965cc9aa501
children 5589c058b0f9
files matroskaenc.c
diffstat 1 files changed, 1 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/matroskaenc.c	Wed Sep 05 00:23:31 2007 +0000
+++ b/matroskaenc.c	Wed Sep 05 00:23:34 2007 +0000
@@ -366,7 +366,7 @@
         AVCodecContext *codec = st->codec;
         offset_t subinfo, track;
         int native_id = 0;
-        int bit_depth = 0;
+        int bit_depth = av_get_bits_per_sample(codec->codec_id);
 
         track = start_ebml_master(pb, MATROSKA_ID_TRACKENTRY);
         put_ebml_uint (pb, MATROSKA_ID_TRACKNUMBER     , i + 1);
@@ -385,19 +385,6 @@
             }
         }
 
-        switch (codec->codec_id) {
-            case CODEC_ID_PCM_S16LE:
-            case CODEC_ID_PCM_S16BE:
-            case CODEC_ID_PCM_U16LE:
-            case CODEC_ID_PCM_U16BE:
-                bit_depth = 16;
-                break;
-            case CODEC_ID_PCM_S8:
-            case CODEC_ID_PCM_U8:
-                bit_depth = 8;
-                break;
-        }
-
         // XXX: CodecPrivate for vorbis, theora, aac, native mpeg4, ...
         if (native_id) {
             if (codec->codec_id == CODEC_ID_VORBIS || codec->codec_id == CODEC_ID_THEORA) {