Re: [FFmpeg-devel] [PATCH] lavf/matroskadec: Set A_QUICKTIME bit depth

2016-01-12 Thread Mats Peterson

On 01/13/2016 12:30 AM, Mats Peterson wrote:

Since mkvmerge doesn't set the bit depth for A_QUICKTIME audio (as far
as I know), the track->audio.bitdepth variable will be zero, and its
value needs to be retrieved from the sound sample description. Also,
confine the 0x to 'raw '/'twos' fourcc mapping to old version 0
sound sample descriptions, since they are the only valid sample
descriptions for this type of mapping.

Mats


I should add that I've limited the setting of track->audio.bitdepth to 
version 0 sound sample descriptions only, since as they can only contain 
8- or 16-bit uncompressed data, setting it here will properly reflect 
the "real" bit depth. The bit depth of version 1 sound sample 
descriptions can be larger than 16 bits.


Mats

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] lavf/matroskadec: Set A_QUICKTIME bit depth

2016-01-12 Thread Mats Peterson

On 01/13/2016 08:35 AM, Mats Peterson wrote:

I should add that I've limited the setting of track->audio.bitdepth to
version 0 sound sample descriptions only, since as they can only contain
8- or 16-bit uncompressed data



The samples can only be 8- or 16-bit uncompressed, rather.

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH] lavf/matroskadec: Set A_QUICKTIME bit depth

2016-01-12 Thread Mats Peterson
Since mkvmerge doesn't set the bit depth for A_QUICKTIME audio (as far 
as I know), the track->audio.bitdepth variable will be zero, and its 
value needs to be retrieved from the sound sample description. Also, 
confine the 0x to 'raw '/'twos' fourcc mapping to old version 0 
sound sample descriptions, since they are the only valid sample 
descriptions for this type of mapping.


Mats
>From 5c0635522f888ec208588215dc3d4a13dabe1018 Mon Sep 17 00:00:00 2001
From: Mats Peterson 
Date: Wed, 13 Jan 2016 00:06:52 +0100
Subject: [PATCH] lavf/matroskadec: Set A_QUICKTIME bit depth

Since mkvmerge doesn't set the bit depth for A_QUICKTIME audio (as far
as I know), the track->audio.bitdepth variable will be zero, and its
value needs to be retrieved from the sound sample description. Also,
confine the 0x to 'raw '/'twos' fourcc mapping to old version 0
sound sample descriptions, since they are the only valid sample
descriptions for this type of mapping.

---
 libavformat/matroskadec.c |   21 ++---
 1 file changed, 14 insertions(+), 7 deletions(-)

diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c
index cc5ec19..89bc68e 100644
--- a/libavformat/matroskadec.c
+++ b/libavformat/matroskadec.c
@@ -1891,16 +1891,23 @@ static int matroska_parse_tracks(AVFormatContext *s)
/* Normally 36, but allow noncompliant private data */
&& (track->codec_priv.size >= 32)
&& (track->codec_priv.data)) {
+uint16_t stsd_version;
 int ret = get_qt_codec(track, , _id);
 if (ret < 0)
 return ret;
-if (fourcc == 0) {
-if (track->audio.bitdepth == 8) {
-fourcc = MKTAG('r','a','w',' ');
-codec_id = ff_codec_get_id(ff_codec_movaudio_tags, fourcc);
-} else if (track->audio.bitdepth == 16) {
-fourcc = MKTAG('t','w','o','s');
-codec_id = ff_codec_get_id(ff_codec_movaudio_tags, fourcc);
+stsd_version = AV_RB16(track->codec_priv.data + 16);
+if (stsd_version == 0) {
+/* Currently not set by mkvmerge, so get the bit depth
+ * from the sample description. */
+track->audio.bitdepth = AV_RB16(track->codec_priv.data + 26);
+if (fourcc == 0) {
+if (track->audio.bitdepth == 8) {
+fourcc = MKTAG('r','a','w',' ');
+codec_id = ff_codec_get_id(ff_codec_movaudio_tags, fourcc);
+} else if (track->audio.bitdepth == 16) {
+fourcc = MKTAG('t','w','o','s');
+codec_id = ff_codec_get_id(ff_codec_movaudio_tags, fourcc);
+}
 }
 }
 } else if (!strcmp(track->codec_id, "V_QUICKTIME") &&
-- 
1.7.10.4

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel