diff options
author | David Conrad <lessen42@gmail.com> | 2007-09-05 00:23:31 +0000 |
---|---|---|
committer | David Conrad <lessen42@gmail.com> | 2007-09-05 00:23:31 +0000 |
commit | 44008871efe9ea8e32a7aabc89b7f74ec60c8843 (patch) | |
tree | 2c4d6ada2d69c7712def42e9de7d5a258a6155e5 /libavformat/matroskaenc.c | |
parent | 1a302a5c2a891140c640dded168d0956d271b6c4 (diff) | |
download | ffmpeg-44008871efe9ea8e32a7aabc89b7f74ec60c8843.tar.gz |
Write bit depth for PCM audio
Originally committed as revision 10322 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavformat/matroskaenc.c')
-rw-r--r-- | libavformat/matroskaenc.c | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c index 8828de9384..3b5634fdbd 100644 --- a/libavformat/matroskaenc.c +++ b/libavformat/matroskaenc.c @@ -366,6 +366,7 @@ static int mkv_write_tracks(AVFormatContext *s) AVCodecContext *codec = st->codec; offset_t subinfo, track; int native_id = 0; + int bit_depth = 0; track = start_ebml_master(pb, MATROSKA_ID_TRACKENTRY); put_ebml_uint (pb, MATROSKA_ID_TRACKNUMBER , i + 1); @@ -384,6 +385,19 @@ static int mkv_write_tracks(AVFormatContext *s) } } + 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) { @@ -438,7 +452,9 @@ static int mkv_write_tracks(AVFormatContext *s) subinfo = start_ebml_master(pb, MATROSKA_ID_TRACKAUDIO); put_ebml_uint (pb, MATROSKA_ID_AUDIOCHANNELS , codec->channels); put_ebml_float (pb, MATROSKA_ID_AUDIOSAMPLINGFREQ, codec->sample_rate); - // XXX: output sample freq (for sbr) and bitdepth (for pcm) + // XXX: output sample freq (for sbr) + if (bit_depth) + put_ebml_uint(pb, MATROSKA_ID_AUDIOBITDEPTH, bit_depth); end_ebml_master(pb, subinfo); break; |