From patchwork Tue Jan 14 03:13:34 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 17337 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 00C1344BB86 for ; Tue, 14 Jan 2020 05:14:09 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id DD74468B0BA; Tue, 14 Jan 2020 05:14:08 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wr1-f68.google.com (mail-wr1-f68.google.com [209.85.221.68]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 42F1768A898 for ; Tue, 14 Jan 2020 05:14:00 +0200 (EET) Received: by mail-wr1-f68.google.com with SMTP id y17so10691305wrh.5 for ; Mon, 13 Jan 2020 19:14:00 -0800 (PST) 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 :mime-version:content-transfer-encoding; bh=OXgg60eNs0zbAwpIQ8wUG2WNCrfvQdWKsGW6R47PI4w=; b=jqD9BRLUaAwEM3N6jWyk1TTrTIuVdXTKVg134jERuiHy5ifDjm2infX5EDnOf4sJUW 84AqaIm98FFZyIQ2DDLgR74j1khAumtHUrrylmymBpjZalFHR0PcrQUejEYKH++8Ihxw n5X2WZ6Q97lZl0b+Cr7r1gxBp7xzfaBTqp0ScjCKhckKGL3JK++9gLfbdGaMEDEER8cX sJfvIvMMUj6ILrDWLVBP/VA/i/J7jLzOLWQQfYf3KFkVNrPIdXI+uHBVY4gzt6vtvb94 gaOMO5cbOyrmOvQHSMUyHt24BMnY5rlrLZBMW2Xyzsi2nfeyDg9jX8vY9JO0DqQDq+BS 0+pw== 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:mime-version:content-transfer-encoding; bh=OXgg60eNs0zbAwpIQ8wUG2WNCrfvQdWKsGW6R47PI4w=; b=MwZbXZFnZYvVEm8SACaRGbXBm7ERvhFINEUyP7K5pLcLjZooRdi2duP+2AjxIY9DgQ Dss45KjMrmbi31gj3QP1zY++k9zN8txE5dw1nJVGUVL7b19ebExWZtugkPJRuoMnLB1p VzG+WJDqQNYgxgoe/Mwiq3NFepIi+Cv4y0LxaszFv1dB6vgXnnmvGaWZxb+tsMhCyQAU RO2AE4wLBPeW2X9eqwOW85zt8qLbQFgo0tWsDbvDFk3WUQkVf86wuGaztodOy2O/NQt4 NSp3wyqU5qyCo8EUGo+qsGT4JKLainf27kU/g6c1OhKz6fpEuZPXO2zSUM8ryXw8yQ6G jjLQ== X-Gm-Message-State: APjAAAXsdIqpp4lZjOUY9a4NveGbiki41om3YUi1IdBGyed6ILmeuxlr rCBoFN66G6fSruU879ZYfhkT10l8 X-Google-Smtp-Source: APXvYqzXal6a7j+x1tkD++/rgpMDn+ZfWa0DiPtTBg20iclpPdUuIQPxgN4i3ikTYXZ82Ci96AMb7A== X-Received: by 2002:a05:6000:1044:: with SMTP id c4mr22677851wrx.204.1578971639565; Mon, 13 Jan 2020 19:13:59 -0800 (PST) Received: from sblaptop.fritz.box (ipbcc08bbf.dynamic.kabel-deutschland.de. [188.192.139.191]) by smtp.gmail.com with ESMTPSA id w20sm16588476wmk.34.2020.01.13.19.13.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Jan 2020 19:13:59 -0800 (PST) From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Tue, 14 Jan 2020 04:13:34 +0100 Message-Id: <20200114031336.24096-5-andreas.rheinhardt@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200114031336.24096-1-andreas.rheinhardt@gmail.com> References: <20200114031336.24096-1-andreas.rheinhardt@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 5/7] avformat/segafilmenc: Remove redundant checks 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: Andreas Rheinhardt Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" If an audio stream is present, the Sega FILM muxer checks for its compability with the container during init, so that the very same check needn't be repeated during writing the trailer. Essentially the same is true for the presence of a video stream: It has already been checked during init. Furthermore, after the check for the presence of a video stream succeeded, a pointer is set to point to the video stream. Yet said pointer (which was NULL before) will be derefenced anyway regardless of the result of the check. Coverity thus complained about this in CID 1434155 and removing this pointless check will also fix this issue. Signed-off-by: Andreas Rheinhardt --- libavformat/segafilmenc.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/libavformat/segafilmenc.c b/libavformat/segafilmenc.c index 5ac60ea5c3..4f881f4f2f 100644 --- a/libavformat/segafilmenc.c +++ b/libavformat/segafilmenc.c @@ -292,15 +292,9 @@ static int film_write_header(AVFormatContext *format_context) if (film->audio_index > -1) audio = format_context->streams[film->audio_index]; - if (film->video_index > -1) - video = format_context->streams[film->video_index]; if (audio != NULL) { audio_codec = get_audio_codec_id(audio->codecpar->codec_id); - if (audio_codec < 0) { - av_log(format_context, AV_LOG_ERROR, "Incompatible audio stream format.\n"); - return AVERROR(EINVAL); - } } /* First, write the FILM header; this is very simple */ @@ -317,6 +311,8 @@ static int film_write_header(AVFormatContext *format_context) ffio_wfourcc(pb, "FDSC"); avio_wb32(pb, 0x20); /* Size of FDSC chunk */ + video = format_context->streams[film->video_index]; + /* The only two supported codecs; raw video is rare */ switch (video->codecpar->codec_id) { case AV_CODEC_ID_CINEPAK: