From patchwork Mon Jan 30 10:06:33 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Carl Eugen Hoyos X-Patchwork-Id: 2367 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.103.89.21 with SMTP id n21csp1381198vsb; Mon, 30 Jan 2017 02:06:44 -0800 (PST) X-Received: by 10.223.147.100 with SMTP id 91mr7872745wro.5.1485770804237; Mon, 30 Jan 2017 02:06:44 -0800 (PST) Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id d136si12750429wme.95.2017.01.30.02.06.43; Mon, 30 Jan 2017 02:06:44 -0800 (PST) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 78C6A68A4DE; Mon, 30 Jan 2017 12:06:39 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from vie01a-dmta-pe04-2.mx.upcmail.net (vie01a-dmta-pe04-2.mx.upcmail.net [62.179.121.164]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 8031168A37E for ; Mon, 30 Jan 2017 12:06:33 +0200 (EET) Received: from [172.31.216.44] (helo=vie01a-pemc-psmtp-pe02) by vie01a-dmta-pe04.mx.upcmail.net with esmtp (Exim 4.87) (envelope-from ) id 1cY8r4-0003PV-MV for ffmpeg-devel@ffmpeg.org; Mon, 30 Jan 2017 11:06:34 +0100 Received: from [192.168.1.3] ([80.110.106.213]) by vie01a-pemc-psmtp-pe02 with SMTP @ mailcloud.upcmail.net id ea6Z1u02x4cGVTk01a6aL3; Mon, 30 Jan 2017 11:06:34 +0100 X-SourceIP: 80.110.106.213 From: Carl Eugen Hoyos To: FFmpeg development discussions and patches Date: Mon, 30 Jan 2017 11:06:33 +0100 User-Agent: KMail/1.9.10 MIME-Version: 1.0 Message-Id: <201701301106.33424.cehoyos@ag.or.at> Subject: [FFmpeg-devel] [PATCH]lavc/alac: Export samplerate 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! I suspect attached patch makes using the alac decoder easier with non-FFmpeg demuxers. Please comment, Carl Eugen From c3a4a0ca8a5ce07cabb339f0288e6b1223dda1b0 Mon Sep 17 00:00:00 2001 From: Carl Eugen Hoyos Date: Mon, 30 Jan 2017 11:03:21 +0100 Subject: [PATCH] lavc/alac: Export samplerate. Fixes ticket #6096. --- libavcodec/alac.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libavcodec/alac.c b/libavcodec/alac.c index b9c3400..8d234ed 100644 --- a/libavcodec/alac.c +++ b/libavcodec/alac.c @@ -76,6 +76,7 @@ typedef struct ALACContext { uint8_t rice_history_mult; uint8_t rice_initial_history; uint8_t rice_limit; + int sample_rate; int extra_bits; /**< number of extra bits beyond 16-bit */ int nb_samples; /**< number of samples in the current frame */ @@ -538,7 +539,7 @@ static int alac_set_info(ALACContext *alac) bytestream2_get_be16u(&gb); // maxRun bytestream2_get_be32u(&gb); // max coded frame size bytestream2_get_be32u(&gb); // average bitrate - bytestream2_get_be32u(&gb); // samplerate + alac->sample_rate = bytestream2_get_be32u(&gb); return 0; } @@ -570,6 +571,7 @@ static av_cold int alac_decode_init(AVCodecContext * avctx) return AVERROR_PATCHWELCOME; } avctx->bits_per_raw_sample = alac->sample_size; + avctx->sample_rate = alac->sample_rate; if (alac->channels < 1) { av_log(avctx, AV_LOG_WARNING, "Invalid channel count\n");