From patchwork Fri Feb 23 13:58:54 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 46481 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:26a3:b0:19e:cdac:8cce with SMTP id h35csp994227pze; Fri, 23 Feb 2024 06:35:14 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCVFzeG1binVL3jqmbN/OslX2oBvq85HSUd8xkuubdtElQVdJ0UD+3NcNGANbLR1qSlqTh7tbwQ18O0fff0/VqMiisK5TTV9x5/VaA== X-Google-Smtp-Source: AGHT+IEeYyBxVB7b9Wamx2AKd/tKzT0BMgEJhTWpHdxm4Z0ptIEI73glOVb7porBFdrntWwTxGqu X-Received: by 2002:a17:906:57c9:b0:a3f:50ae:52d with SMTP id u9-20020a17090657c900b00a3f50ae052dmr1123ejr.10.1708698914144; Fri, 23 Feb 2024 06:35:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1708698914; cv=none; d=google.com; s=arc-20160816; b=YKLsqLnrEptj0tYhfNCb/tA+/2+w5T60Z4L6OdA2ZARbev+MIPnaT50mLo3y24EUgH eWlpF5HYFozQkDpMnq2WFUv3tC+h4PRxI/bF0jIJ5wO/8Op19BvvNs5iRy6BrFloeta/ pFn1G2MCmxxa0jflUJIM06wi3NSrSFvQ2koX9szIpR8s6eQsG11GDxx8w23MkeL4mABX A/mjEPLy0gKyRlN+WQH03OV6R1Smp3qblLqMyNBF3a1m5PytH5D+r3BMLu5R1g235LXx USsE2bb+L8cn2RmOLYQPLtyCODLPKhwGuP0izOvFq+dHpfEWqebeLFLruHJzYxDkxkHA yP+A== 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=nn4hAhhrPOwzEhaDahhbjmvor6MuiBN4o9BetQDjkUo=; fh=YOA8vD9MJZuwZ71F/05pj6KdCjf6jQRmzLS+CATXUQk=; b=sz8FxN9s94ooBwgvIOzWIlLCjoAz/gwv5kup2ZWeUH3U2hdip7IlpHm0q1xkpcoBQ6 Hl9ASzSCUj07cIrmJx3W9dDVUD8Z52E/K5c/DYMjQtLLb7cM9ptageL+6lauXaq5xyHQ 3dvm60IVC+IMN7jFUt+Ouar/XF6WaH+LlzojsBx1vV+bPpbnOQmrBx6EJe7A6NwUlg5D S1Rg1dvlXinm2UDQ3j+TpQV1iFDLpaTX7kEvfp5uoF3Rr7EIlyFC3XANvb0WR9lncV4f kM3wuGoZcQ4luP/+mm/HatzhEJxogKPk2J+/4kj3ekNW5D2PDG+mmt2YuB1N543cx4TO 8xfA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@khirnov.net header.s=mail header.b=ZeF9inHh; 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 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id d11-20020a1709067f0b00b00a3ef02c97cfsi3462007ejr.710.2024.02.23.06.35.13; Fri, 23 Feb 2024 06:35:14 -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; dkim=neutral (body hash did not verify) header.i=@khirnov.net header.s=mail header.b=ZeF9inHh; 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 A8B5A68BE3B; Fri, 23 Feb 2024 16:32:03 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail1.khirnov.net (quelana.khirnov.net [94.230.150.81]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 2D49468C6CB for ; Fri, 23 Feb 2024 16:31:36 +0200 (EET) Authentication-Results: mail1.khirnov.net; dkim=pass (2048-bit key; unprotected) header.d=khirnov.net header.i=@khirnov.net header.a=rsa-sha256 header.s=mail header.b=ZeF9inHh; dkim-atps=neutral Received: from localhost (mail1.khirnov.net [IPv6:::1]) by mail1.khirnov.net (Postfix) with ESMTP id 710614D4E for ; Fri, 23 Feb 2024 15:31:33 +0100 (CET) Received: from mail1.khirnov.net ([IPv6:::1]) by localhost (mail1.khirnov.net [IPv6:::1]) (amavis, port 10024) with ESMTP id wiQteyHWtcyx for ; Fri, 23 Feb 2024 15:31:33 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=khirnov.net; s=mail; t=1708698688; bh=u+PD/WZSB8sig/VU8p4bPxzoKwpknif6ZFkFAXQ4bD4=; h=From:To:Subject:Date:In-Reply-To:References:From; b=ZeF9inHheswC5HRJ3zg4vVqmC4qazKjPYHYK4dl+icimF7SaG/lglF1mgOWddkrvg msoINvPr8FPzIRMN5XmvIhZi/4B74jpzLjSXJr7nQ6TNndsgOupWQPp3rBS8Mc2xEP F/JgeUzeNNSmwUQVnatemjxHfvXDdCrd6XmyQG3G463VVeK7pjTri+GbhmNYTlAdCH 0PhwqrHpfB8+10YW4DRkf29wzlHcDfbDXQYDd8QLF3Q07YH0GWdVGTeootPssVekns 6NyfnHzYM0SFmMqc8DQELhBVCZVuuov2yrkIAW5EWGk0PiLUlSA5g7+X/1OC7hyYeV 8Jbyzl74MBgCw== Received: from libav.khirnov.net (libav.khirnov.net [IPv6:2a00:c500:561:201::7]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "libav.khirnov.net", Issuer "smtp.khirnov.net SMTP CA" (verified OK)) by mail1.khirnov.net (Postfix) with ESMTPS id 1E7254D5D for ; Fri, 23 Feb 2024 15:31:28 +0100 (CET) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:::1]) by libav.khirnov.net (Postfix) with ESMTP id 547CC3A2668 for ; Fri, 23 Feb 2024 15:31:23 +0100 (CET) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Fri, 23 Feb 2024 14:58:54 +0100 Message-ID: <20240223143115.16521-33-anton@khirnov.net> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20240223143115.16521-1-anton@khirnov.net> References: <20240223143115.16521-1-anton@khirnov.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 32/38] avcodec/mpeg12dec: use ff_frame_new_side_data 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: ne922V4CZwYo From: Niklas Haas For consistency, even though this cannot be overriden at the packet level. --- libavcodec/mpeg12dec.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/libavcodec/mpeg12dec.c b/libavcodec/mpeg12dec.c index 96987f5a8e..1038a08637 100644 --- a/libavcodec/mpeg12dec.c +++ b/libavcodec/mpeg12dec.c @@ -2532,15 +2532,17 @@ static int mpeg_decode_frame(AVCodecContext *avctx, AVFrame *picture, if (s->timecode_frame_start != -1 && *got_output) { char tcbuf[AV_TIMECODE_STR_SIZE]; - AVFrameSideData *tcside = av_frame_new_side_data(picture, - AV_FRAME_DATA_GOP_TIMECODE, - sizeof(int64_t)); - if (!tcside) - return AVERROR(ENOMEM); - memcpy(tcside->data, &s->timecode_frame_start, sizeof(int64_t)); + AVFrameSideData *tcside; + ret = ff_frame_new_side_data(avctx, picture, AV_FRAME_DATA_GOP_TIMECODE, + sizeof(int64_t), &tcside); + if (ret < 0) + return ret; + if (tcside) { + memcpy(tcside->data, &s->timecode_frame_start, sizeof(int64_t)); - av_timecode_make_mpeg_tc_string(tcbuf, s->timecode_frame_start); - av_dict_set(&picture->metadata, "timecode", tcbuf, 0); + av_timecode_make_mpeg_tc_string(tcbuf, s->timecode_frame_start); + av_dict_set(&picture->metadata, "timecode", tcbuf, 0); + } s->timecode_frame_start = -1; }