From patchwork Thu Feb 13 23:29:36 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Carl Eugen Hoyos X-Patchwork-Id: 17780 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id 5416744BBC5 for ; Fri, 14 Feb 2020 01:29:55 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 2ED8668AE93; Fri, 14 Feb 2020 01:29:55 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-io1-f51.google.com (mail-io1-f51.google.com [209.85.166.51]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id BF1A4687FAA for ; Fri, 14 Feb 2020 01:29:48 +0200 (EET) Received: by mail-io1-f51.google.com with SMTP id s24so8526813iog.5 for ; Thu, 13 Feb 2020 15:29:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=Ng89Sqe51UwI6XP4YiUCDMUFQeS0GuahQdDfYzTu6hg=; b=UoR/fWC5EWqTe7u+kOehMTcI95nDvuMYBjDxOweics1l9t/wOvZqmpIk19z4UQDYLF Qi0OJAHHHVTbcW7xN+PsnNznw6LnCbTaZm4doe84ItIubB82NZhUuNjI7A0F/IeAIELK Uk34xXAboMZuJZaMuNHaPH/AFtF6G4I/+QQYAdPGvDED4h4sjzhSlOr4UpLF7wqQBEBO X3fQnBixmxxTdEqAPs3/NOkV2NzB2HBzxB9yFH8yoRn074CcX0YEVp2hmwCW1lO6xn6M jjSlxcrkGOIyCUtHZu/q/n/HH38Z+p4lyM5CdKwwhTuJWRpP9xp2Ern+HGIpM4xg+RIY LhBA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=Ng89Sqe51UwI6XP4YiUCDMUFQeS0GuahQdDfYzTu6hg=; b=e4e2Mr5IjfTmDDroGSJD7MBE75Zjy9fkvfC1E7SSCM+ofgzslTUS1FD981LtELihqG Qpsx05OhDsAAyaTyZt6XZ0lsosBtiBqUtErXa6dUfi0hCi4STPKVAbXbtMioPtJsywEo D6HBbvv9lqsRJqXgqKeD8JGa/QHarefeeZVXQtQyxZmDsGoFvcVNE+XB6XXvZOgcGMdc H/8EeuZIXKJtDj7l6ZDvS6/mB+vRUB7KL5jiwHRbhv+z4VibdOgTXUf78yDQoAu1BhQP jCWohuY0gOJkUR/LJGIcSDb9llLroMe2VwdifI85I7x8KT6b4jVA9UApiTNnIiO03Qmt FqoA== X-Gm-Message-State: APjAAAX0acbOQ5davi2HhYgQGeeOOl23bj20Wjrps77HEbkCa9mZBr07 APBE97eoCMKERquT6w1EGTZRnAjG5mM6LLjNinZbtnjq X-Google-Smtp-Source: APXvYqztFd84xpZfcYjnBcB77z/BLyqbqX7v0ZfH/063US/v3d/rDYpFcLpyYv2OSSZchSHShPi4i/7VcPHG5kVRN5E= X-Received: by 2002:a6b:600f:: with SMTP id r15mr84022iog.54.1581636587065; Thu, 13 Feb 2020 15:29:47 -0800 (PST) MIME-Version: 1.0 From: Carl Eugen Hoyos Date: Fri, 14 Feb 2020 00:29:36 +0100 Message-ID: To: FFmpeg development discussions and patches Subject: [FFmpeg-devel] [PATCH]lavc/mlp_parse: Read wordlength from 0xba streams X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Hi! Attached patch allows detecting s16 truehd streams encoded with FFmpeg, only tested with FFmpeg's encoder, I did not look into any specification. Please comment, Carl Eugen From 1b98303ab87463037e05e66f3129112fc5c6e484 Mon Sep 17 00:00:00 2001 From: Carl Eugen Hoyos Date: Fri, 14 Feb 2020 00:25:52 +0100 Subject: [PATCH] lavc/mlp_parse: Read wordlength from 0xba streams. Fixes detecting 16 bit streams encoded with FFmpeg. --- libavcodec/mlp_parse.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/libavcodec/mlp_parse.c b/libavcodec/mlp_parse.c index 45715352c2..74173acba3 100644 --- a/libavcodec/mlp_parse.c +++ b/libavcodec/mlp_parse.c @@ -123,7 +123,6 @@ int ff_mlp_read_major_sync(void *log, MLPHeaderInfo *mh, GetBitContext *gb) mh->channels_mlp = mlp_channels[channel_arrangement]; mh->channel_layout_mlp = mlp_layout[channel_arrangement]; } else if (mh->stream_type == 0xba) { - mh->group1_bits = 24; // TODO: Is this information actually conveyed anywhere? mh->group2_bits = 0; ratebits = get_bits(gb, 4); @@ -159,7 +158,15 @@ int ff_mlp_read_major_sync(void *log, MLPHeaderInfo *mh, GetBitContext *gb) mh->num_substreams = get_bits(gb, 4); - skip_bits_long(gb, 4 + (header_size - 17) * 8); + if (mh->stream_type == 0xba) { + skip_bits(gb, 17); + mh->group1_bits = get_bits(gb, 5); + if (!mh->group1_bits) + mh->group1_bits = 24; + skip_bits_long(gb, 4 + (header_size - 17) * 8 - 22); + } else { + skip_bits_long(gb, 4 + (header_size - 17) * 8); + } return 0; } -- 2.24.1