From patchwork Fri Oct 12 23:06:40 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cameron Cawley X-Patchwork-Id: 10661 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 E69F9441027 for ; Sat, 13 Oct 2018 02:14:29 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 4464E68A516; Sat, 13 Oct 2018 02:14:11 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wr1-f66.google.com (mail-wr1-f66.google.com [209.85.221.66]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 549E568A4B0 for ; Sat, 13 Oct 2018 02:14:05 +0300 (EEST) Received: by mail-wr1-f66.google.com with SMTP id y11-v6so14988446wrd.4 for ; Fri, 12 Oct 2018 16:14:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=U9PP1sVXOB5iHv4i6ZoVaI9s7nAVfpUoVMA3r0uEsTI=; b=i5XTS6dRnSp1LxdjcZha8WnqvtC+p4L9WO1poDvsGusc3E88I5fm6V38uLiQFyg1ff wXovBbzvs3JER3my2g58/amoUd9Bs0YEIwF6WaCt9Dy5/wfE6IwEYYJe0OO7l5OHLB9e r0UOho4AVrvp95rG/+1YYhJ2LJWGoh6mV83JfuwwR5lM8qbkv851ztlhf4vo7n5/ikYL t1UCA9vjp7zPR5vu04Y0dUFItDjjb6hmupTDerw9YcUwfVRu1qp9Wk8uqxchNcT5/HaB gpql1xNK1X7JDugr3m+EfDGIM486dLOf63HVO54motLiweTsg6qJhCNYey1N6p0JhibM Zzpw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=U9PP1sVXOB5iHv4i6ZoVaI9s7nAVfpUoVMA3r0uEsTI=; b=PLWfM1+cs1xfe7V2lsNUruJLncDR8HCVesaeKRg8XfuAqLYEMMukjtVK0b4QHw3RaZ SORoQvjhfCZvvXTxJhSJMve/Vi84cYMYnqbVRa3TbjONsg3aUHUs9sVA56IVrX1YssQi CiyMcaeQ5zis9xpsXgFBLUmCAwy4BQEPwdOxZnMXkFkt9jiQT39Snzy1jV4gCK9b3wwv 3DS3FoevvL6PFWnNHB/NvHHo289xOKb/MRloc1Lbi+F+C9mKbK4EemZWN9pRppoajocd OUUX/NkR75/TPbz247rMWKLZwGBT2N/BhhXYzAvhoPwSk4kflG2XXgCw2cVXE+LJPnUa 1B7A== X-Gm-Message-State: ABuFfohzToEOVb+2lge84Pomynmj/hfRy7CeTZIeZsjR57UY1ewd2f+H ulXfoqwkwe4+fHkq7Wj5rlZ/n9WC X-Google-Smtp-Source: ACcGV62/TbbXcJOGxQYWlh5YuBo0Zw5DNPTHzNiYWAfSoygxS3SHu94qCWpJDv67JXdh07RMx9Wiyw== X-Received: by 2002:adf:f2d0:: with SMTP id d16-v6mr7238290wrp.258.1539385743922; Fri, 12 Oct 2018 16:09:03 -0700 (PDT) Received: from localhost.localdomain (host86-144-162-102.range86-144.btcentralplus.com. [86.144.162.102]) by smtp.gmail.com with ESMTPSA id c24-v6sm4289220wre.44.2018.10.12.16.09.02 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 12 Oct 2018 16:09:03 -0700 (PDT) From: Cameron Cawley To: ffmpeg-devel@ffmpeg.org Date: Sat, 13 Oct 2018 00:06:40 +0100 Message-Id: <20181012230640.12034-2-ccawley2011@gmail.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20181012230640.12034-1-ccawley2011@gmail.com> References: <20181012230640.12034-1-ccawley2011@gmail.com> Subject: [FFmpeg-devel] [PATCH 2/2] avformat/rpl: Support files containing 8 bit PCM or VIDC audio 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 Cc: Cameron Cawley MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Signed-off-by: Cameron Cawley --- libavformat/rpl.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/libavformat/rpl.c b/libavformat/rpl.c index d373600478..6b45b35c30 100644 --- a/libavformat/rpl.c +++ b/libavformat/rpl.c @@ -119,6 +119,8 @@ static int rpl_read_header(AVFormatContext *s) AVStream *vst = NULL, *ast = NULL; int total_audio_size; int error = 0; + const char *endptr; + char audio_type[RPL_LINE_LENGTH]; uint32_t i; @@ -188,7 +190,9 @@ static int rpl_read_header(AVFormatContext *s) ast->codecpar->codec_tag = audio_format; ast->codecpar->sample_rate = read_line_and_int(pb, &error); // audio bitrate ast->codecpar->channels = read_line_and_int(pb, &error); // number of audio channels - ast->codecpar->bits_per_coded_sample = read_line_and_int(pb, &error); // audio bits per sample + error |= read_line(pb, line, sizeof(line)); + ast->codecpar->bits_per_coded_sample = read_int(line, &endptr, &error); // audio bits per sample + strcpy(audio_type, endptr); // At least one sample uses 0 for ADPCM, which is really 4 bits // per sample. if (ast->codecpar->bits_per_coded_sample == 0) @@ -205,6 +209,17 @@ static int rpl_read_header(AVFormatContext *s) // 16-bit audio is always signed ast->codecpar->codec_id = AV_CODEC_ID_PCM_S16LE; break; + } else if (ast->codecpar->bits_per_coded_sample == 8) { + if(strstr(audio_type, "unsigned") != NULL) { + ast->codecpar->codec_id = AV_CODEC_ID_PCM_U8; + break; + } else if(strstr(audio_type, "linear") != NULL) { + ast->codecpar->codec_id = AV_CODEC_ID_PCM_S8; + break; + } else { + ast->codecpar->codec_id = AV_CODEC_ID_PCM_VIDC; + break; + } } // There are some other formats listed as legal per the spec; // samples needed.