From patchwork Mon Apr 19 14:10:10 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Almer X-Patchwork-Id: 27051 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a6b:5014:0:0:0:0:0 with SMTP id e20csp565013iob; Mon, 19 Apr 2021 07:22:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz/2bkNUPPSuGhoWiNRWlw+uekJcJ3kX1KTGaaswmQEkzjOJTLPFq76933vFPc5T5VquM4A X-Received: by 2002:aa7:dbd3:: with SMTP id v19mr25773750edt.314.1618842159682; Mon, 19 Apr 2021 07:22:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618842159; cv=none; d=google.com; s=arc-20160816; b=AWmMLEuBAcm4/pK/+dpFAa/XOZyk0qrs3YAx8rP1jVirM8R7csH/ZPGe0SGZXqms5p E+98KYe6IAYLwlWE8Ygt64Nou1GF2Gqt5UK7Zv2vq6HryO3AfpitqqiBMoepzVyUHVtw heNmA83MUFfehbhDGfGL8l3PsjaWtAVLydLRwryQkdir9xEoUpjVfNs8koZHEXGHVR/q qEpTdGEeNi55SYfSwRxTOiKvrmh7KPi9ZnEt2ku5rbGPLHwgQ5gsp6/i0b8CQbgE+0Ns YjR+PRgj7vQvPX2QOKFqbMZ9S8s28fHwrG3Kgat3W3ogBWvnUAUt+fAbzFbTs2qmy6gw td8w== 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:references:in-reply-to:message-id :date:to:from:dkim-signature:delivered-to; bh=4wv5tIpSNNJ+QPP5xtkKQQakLnUENH9UpRzBtYabjE8=; b=Mej09IPPniQ5rrZQfAzkS4gxqoKsOQiz3wUqKb8D57vRAPJaQavIQ4zUxgAnttL5Zc HjuPdx7t6dJuxI9BoYJxx7dl/JBFr0ppLpF2EZlDT6ChXi931z4mHBq1FTroQufal8V4 9Fa7psTZBl/U5mR6ahHVawa1TtxjzPiNgZ0Xz3rOJ/YVb2FmZKK9xt3KeM86PwZ6pRjm 4+iMIx7/Jnzc+1sX0B9lC0GOo2uYSVyjaVkKnDZxpDecXeJEZou76tzJCXSw940AtwlX FIOvYDyoZL/26nI1H9tId8aA8Tgx6e+AsDUp3ABrSGJcWcbf8d9NfR2EXA6fvQvZvQOx iGEQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20161025 header.b=nbURBSxR; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id d1si1883840eds.356.2021.04.19.07.22.39; Mon, 19 Apr 2021 07:22:39 -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=@gmail.com header.s=20161025 header.b=nbURBSxR; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 499B2680967; Mon, 19 Apr 2021 17:12:36 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-qv1-f42.google.com (mail-qv1-f42.google.com [209.85.219.42]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 0E4AC680967 for ; Mon, 19 Apr 2021 17:12:34 +0300 (EEST) Received: by mail-qv1-f42.google.com with SMTP id i3so11376736qvj.7 for ; Mon, 19 Apr 2021 07:12:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=4qt5YKv7SbN3LYIHtmwF1f0KPP3O5FRLL5Q1uLWmx38=; b=nbURBSxR2ID3YSCud+jwztvyWTq8+DXz7ksUXjxVU38QsMHSI9j4iDl0zOkWRyt/Z1 KleQdyHPTkhNQsyjrFQhoulGJNsAt4VShTNhqGljKAZ8YDILuLJbGyWHeCqEPYC5etmI rVMx0zXlzvohi7o7zk8cFa6NU/2avve99dSQAp7pEjs7hnjRAjlpUm39cqJVohU57XSs Fxkwude1B4Si5HM/dYNov5njZHy2fxwcauIvmGzSer5MrlI9pzXn2DhxhEwC96FQw9wS mGIgEvSEdmekRu3Gjbt+ndHR0NZg2tjXwh8E/rmPX4lxNGksye+WUJ9M8cliuXKSKQq2 XVaw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=4qt5YKv7SbN3LYIHtmwF1f0KPP3O5FRLL5Q1uLWmx38=; b=le1oa1gX2EZTpStrSLUigThW+pSoXAQINgAaZ8VJGj6rMlZom4lUnr0zNCzuYhdRvj PMMTtBqSR3Fz+H1UkRtXEo3QA0TwbG3Lle4a5rlhjjMWhP1CdAHyLVatqjdYHnuorU2K PLWeWa5m0qaMHIWTmoebG0UytMeN90dNXkQfc05ugi1AvwHXjN4dkcHKclroLBpJhS3x TDNVRAmHEHAWB81uRra3SuAKZfyQfslubY2kD73NlmoAL7y3NNinYx0VnCk/RBuWt4Vb 7ohSXuFEknNpZC0hT3RHSNYKNi2TELX85bGfLFbf0ae+5xnmNNp0/OoJ1kafygVpZURI 6vhQ== X-Gm-Message-State: AOAM533QtuvRy/grV2OzNIvnhF0Sbhz9K28q+zkrHrSiT8oxToV9et9c h/ekNZ8OrPczK0EC2r1kF86dcbunZ7c= X-Received: by 2002:a0c:c488:: with SMTP id u8mr21280686qvi.47.1618841553694; Mon, 19 Apr 2021 07:12:33 -0700 (PDT) Received: from localhost.localdomain ([191.83.209.133]) by smtp.gmail.com with ESMTPSA id f7sm2049494qtv.53.2021.04.19.07.12.32 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Apr 2021 07:12:32 -0700 (PDT) From: James Almer To: ffmpeg-devel@ffmpeg.org Date: Mon, 19 Apr 2021 11:10:10 -0300 Message-Id: <20210419141024.8174-74-jamrial@gmail.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210419141024.8174-1-jamrial@gmail.com> References: <20210419141024.8174-1-jamrial@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 73/87] avformat/avformat: Constify AVFormatContext.*_codec pointers 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: 2MUPkuiLqb5M From: Andreas Rheinhardt This also allows to exclusively use pointers to const AVCodec in fftools/ffmpeg_opt.c. Signed-off-by: Andreas Rheinhardt --- doc/APIchanges | 3 +++ fftools/ffmpeg_opt.c | 4 ++-- libavformat/avformat.h | 8 ++++---- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/doc/APIchanges b/doc/APIchanges index e9fa7ddf64..2522978952 100644 --- a/doc/APIchanges +++ b/doc/APIchanges @@ -17,6 +17,9 @@ API changes, most recent first: 2021-04-17 - xxxxxxxxxx - lavu 56.73.100 - frame.h detection_bbox.h Add AV_FRAME_DATA_DETECTION_BBOXES +2021-04-14 - xxxxxxxxxx - lavf yyyyyyyyy - avformat.h + Constified AVFormatContext.*_codec. + 2021-04-14 - xxxxxxxxxx - lavf yyyyyyyyy - avformat.h Constified the pointers to AVInputFormats and AVOutputFormats in AVFormatContext, avformat_alloc_output_context2(), diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c index 9e26de5a94..e66141f3ab 100644 --- a/fftools/ffmpeg_opt.c +++ b/fftools/ffmpeg_opt.c @@ -737,11 +737,11 @@ static int opt_recording_timestamp(void *optctx, const char *opt, const char *ar return 0; } -static AVCodec *find_codec_or_die(const char *name, enum AVMediaType type, int encoder) +static const AVCodec *find_codec_or_die(const char *name, enum AVMediaType type, int encoder) { const AVCodecDescriptor *desc; const char *codec_string = encoder ? "encoder" : "decoder"; - AVCodec *codec; + const AVCodec *codec; codec = encoder ? avcodec_find_encoder_by_name(name) : diff --git a/libavformat/avformat.h b/libavformat/avformat.h index 3834c9869f..23bdaa207b 100644 --- a/libavformat/avformat.h +++ b/libavformat/avformat.h @@ -1598,7 +1598,7 @@ typedef struct AVFormatContext { * the same codec_id. * Demuxing: Set by user */ - AVCodec *video_codec; + const AVCodec *video_codec; /** * Forced audio codec. @@ -1606,7 +1606,7 @@ typedef struct AVFormatContext { * the same codec_id. * Demuxing: Set by user */ - AVCodec *audio_codec; + const AVCodec *audio_codec; /** * Forced subtitle codec. @@ -1614,7 +1614,7 @@ typedef struct AVFormatContext { * the same codec_id. * Demuxing: Set by user */ - AVCodec *subtitle_codec; + const AVCodec *subtitle_codec; /** * Forced data codec. @@ -1622,7 +1622,7 @@ typedef struct AVFormatContext { * the same codec_id. * Demuxing: Set by user */ - AVCodec *data_codec; + const AVCodec *data_codec; /** * Number of bytes to be written as padding in a metadata header.