From patchwork Tue May 4 12:05:26 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zane van Iperen X-Patchwork-Id: 27582 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a6b:6109:0:0:0:0:0 with SMTP id v9csp355239iob; Tue, 4 May 2021 05:05:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzdxBsB/ufQP5x2mRibMksm/YWQ7hNUJLiPW4FzhtVd0OPAfMYZb1CobmiIqcqBH/pm655c X-Received: by 2002:aa7:cdca:: with SMTP id h10mr6314324edw.271.1620129944572; Tue, 04 May 2021 05:05:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620129944; cv=none; d=google.com; s=arc-20160816; b=OI1tR/P6GneTWhWWykoQ3Yay7q9wzG/p8FYKIjUUofab4/gJmA2aD5L7PjgVjLwKKC kR9yYuVFnGt8BaqpOVDucEC4LA4mAUAc0kchmvbbD+EVgOxrIQ6ZFuYOPMBFt6Aul9bt Xl5QNqQ4YfZgkK7CLBhJxyEG6BdTBTvjD1tM9SMT+L9+0svDYEf3THU2w0uTKu0g42aZ KGv2vXitBxyFMT5nhJ8be1EEUqHLqQZbTERNEh6PtRRhuXaKmmzbNGbrYN6FBEdmwhEk lXFX+x3Ju0uwGpuIPmgmXR16VeV+m36N5ZEIbzuVmlbJogQ4U1W4CKD7k5ySe7Fsmfm9 fLZQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:message-id:date:to:from :dkim-signature:delivered-to; bh=dwZldRlmw+utc3iy6QqPAyrQJMZRuUE8Hi4/xjIPyls=; b=QpWcrQ7R/rvjIqS0lxo0UVONJsDbHsAVlfWArNlqaYXMtFj/Zqa+m1uGrx1KfRX0ns spzFAB5rcfx/hrGaryjjWflHbTxuxD5Q5nmiiF0CJYIInlOo31Q+XWU2LBIfIbMISLml YfuP9xON9zKKisDaHAJo/mAIwnulRv9RV0tpJtYJ+YFrGcVFMGZU6Zs41TuPpDD0u9cG 7eTU9xvZn+gtO2wJI4WwSjR/S7Bk4Z4Ao6SJvXcUOcYDU70pX1RlrbPBsIiANT1s2xhI +gpw0eJh8KDycGepLrUejgmtViQwNeu7ztMi2PrC+3Ev0qQsKT5G4GsfsZwyeoxrgiIO Ujsg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@zanevaniperen.com header.s=key1 header.b=M93HeB3t; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=zanevaniperen.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id gu21si2349486ejb.12.2021.05.04.05.05.43; Tue, 04 May 2021 05:05:44 -0700 (PDT) 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; dkim=neutral (body hash did not verify) header.i=@zanevaniperen.com header.s=key1 header.b=M93HeB3t; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=zanevaniperen.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 6BAB6680BD2; Tue, 4 May 2021 15:05:40 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from out2.migadu.com (unknown [188.165.223.204]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id DD7086809A7 for ; Tue, 4 May 2021 15:05:33 +0300 (EEST) X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=zanevaniperen.com; s=key1; t=1620129932; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=3NHEFQumm0mam9ZyfCifCkQIWMvwDDiHIV5bc2xOSe8=; b=M93HeB3tKnUgxvyRw7jtYAvJMwjCa5v8NfP0f9APB2VawzH8oFPq6JXyt4fJJYGHrZmdjk WtXTq88VCUwLVO7Nol2KY1zwzQJuWVaMclWLHwvZceUq3Ny3TdjQ1ivG6knVr/iVNh11Ma AziM+YvzCgBsxwFy2R/HkBhcYmyfRNNT7mQ8bk1Wz3UD865AYjXH7WuhVHdCGt3hUT1Fj7 vntgIqyRVB02GuGB773eQjG9v204pxScQkefLG5i7xJEJrlS7DGXowtMZfhclWsaSj3k+l GkGTBB5/paBIseU9simfTkQreoDd27KvFnPFXm5c6s/8iaxXpm8tvqi6zRF6jg== From: Zane van Iperen To: ffmpeg-devel@ffmpeg.org Date: Tue, 4 May 2021 22:05:26 +1000 Message-Id: <20210504120526.27373-1-zane@zanevaniperen.com> MIME-Version: 1.0 X-Migadu-Flow: FLOW_OUT X-Migadu-Auth-User: git-morningstar@zanevaniperen.com Subject: [FFmpeg-devel] [PATCH] avformat/rpl: cosmetics X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 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" X-TUID: 4Tfni2nLfqOB Signed-off-by: Zane van Iperen --- libavformat/rpl.c | 26 ++++++++++---------------- 1 file changed, 10 insertions(+), 16 deletions(-) diff --git a/libavformat/rpl.c b/libavformat/rpl.c index f5d2b8fe59..367e80b2c4 100644 --- a/libavformat/rpl.c +++ b/libavformat/rpl.c @@ -216,18 +216,13 @@ static int rpl_read_header(AVFormatContext *s) if (ast->codecpar->bits_per_coded_sample == 16) { // 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(av_stristr(audio_type, "unsigned") != NULL) { + if (av_stristr(audio_type, "unsigned") != NULL) ast->codecpar->codec_id = AV_CODEC_ID_PCM_U8; - break; - } else if(av_stristr(audio_type, "linear") != NULL) { + else if (av_stristr(audio_type, "linear") != NULL) ast->codecpar->codec_id = AV_CODEC_ID_PCM_S8; - break; - } else { + else ast->codecpar->codec_id = AV_CODEC_ID_PCM_VIDC; - break; - } } // There are some other formats listed as legal per the spec; // samples needed. @@ -237,10 +232,8 @@ static int rpl_read_header(AVFormatContext *s) // The samples with this kind of audio that I have // are all unsigned. ast->codecpar->codec_id = AV_CODEC_ID_PCM_U8; - break; } else if (ast->codecpar->bits_per_coded_sample == 4) { ast->codecpar->codec_id = AV_CODEC_ID_ADPCM_IMA_EA_SEAD; - break; } break; } @@ -297,7 +290,8 @@ static int rpl_read_header(AVFormatContext *s) total_audio_size += audio_size * 8; } - if (error) return AVERROR(EIO); + if (error) + return AVERROR(EIO); return 0; } @@ -322,9 +316,10 @@ static int rpl_read_packet(AVFormatContext *s, AVPacket *pkt) index_entry = &stream->internal->index_entries[rpl->chunk_number]; - if (rpl->frame_in_part == 0) + if (rpl->frame_in_part == 0) { if (avio_seek(pb, index_entry->pos, SEEK_SET) < 0) return AVERROR(EIO); + } if (stream->codecpar->codec_type == AVMEDIA_TYPE_VIDEO && stream->codecpar->codec_tag == 124) { @@ -340,9 +335,9 @@ static int rpl_read_packet(AVFormatContext *s, AVPacket *pkt) ret = av_get_packet(pb, pkt, frame_size); if (ret < 0) return ret; - if (ret != frame_size) { + if (ret != frame_size) return AVERROR(EIO); - } + pkt->duration = 1; pkt->pts = index_entry->timestamp + rpl->frame_in_part; pkt->stream_index = rpl->chunk_part; @@ -356,9 +351,8 @@ static int rpl_read_packet(AVFormatContext *s, AVPacket *pkt) ret = av_get_packet(pb, pkt, index_entry->size); if (ret < 0) return ret; - if (ret != index_entry->size) { + if (ret != index_entry->size) return AVERROR(EIO); - } if (stream->codecpar->codec_type == AVMEDIA_TYPE_VIDEO) { // frames_per_chunk should always be one here; the header