summaryrefslogtreecommitdiff
path: root/libavformat
diff options
context:
space:
mode:
authorHendrik Leppkes <h.leppkes@gmail.com>2016-03-16 12:39:19 +0100
committerHendrik Leppkes <h.leppkes@gmail.com>2016-03-16 12:52:35 +0100
commitc43d4858119e79db0c24f673bcbf20eb3870b307 (patch)
treed418a9e88dd28fe504c8fe84e55b8b2fa1605279 /libavformat
parent109dfed7fc265f3e071854d5e6de5dd7f82ff9fb (diff)
matroskaenc: set the actual PCM bitdepth in the header
The actual bitdepth can be different to the storage format (ie. sample format). Fixes the stored bitdepth for 24-bit formats like FLAC.
Diffstat (limited to 'libavformat')
-rw-r--r--libavformat/matroskaenc.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
index 05b1b94f64..6ad9aed538 100644
--- a/libavformat/matroskaenc.c
+++ b/libavformat/matroskaenc.c
@@ -850,8 +850,12 @@ static int mkv_write_track(AVFormatContext *s, MatroskaMuxContext *mkv,
return 0;
}
- if (!bit_depth && codec->codec_id != AV_CODEC_ID_ADPCM_G726)
- bit_depth = av_get_bytes_per_sample(codec->sample_fmt) << 3;
+ if (!bit_depth && codec->codec_id != AV_CODEC_ID_ADPCM_G726) {
+ if (codec->bits_per_raw_sample)
+ bit_depth = codec->bits_per_raw_sample;
+ else
+ bit_depth = av_get_bytes_per_sample(codec->sample_fmt) << 3;
+ }
if (!bit_depth)
bit_depth = codec->bits_per_coded_sample;