From patchwork Fri Mar 31 16:22:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Jan_Ekstr=C3=B6m?= X-Patchwork-Id: 40958 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:4645:b0:e3:3194:9d20 with SMTP id eb5csp852183pzb; Fri, 31 Mar 2023 09:23:46 -0700 (PDT) X-Google-Smtp-Source: AKy350bAhJiXZddJQNXIofkMSQxwNjL+JSivIZagOb0Lv7F0lzY4Pbi4v2QLdZvgA0HCX2HlGtNV X-Received: by 2002:a17:906:2b8e:b0:946:c022:8979 with SMTP id m14-20020a1709062b8e00b00946c0228979mr15680045ejg.21.1680279826157; Fri, 31 Mar 2023 09:23:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680279826; cv=none; d=google.com; s=arc-20160816; b=ckYjgkYPH+ckQ81JFSRGL06RQ4dF5G13/4h1RKL3/lhR22hZmTJtAgATvYS2gGNDYU tJ8V5FnNRUYIycBMzee1Y2075bRG0ja+eq02QDme6GYjCk2zM4r2lk/IYCc9IipWaI7Z 93MbQS5gmEx7Dy0DfFVBZvKU4iD+xZ7hUz0v0Iu13os6MrXgbQUIYWLbFFmz4BeFHt1a o3znRolM57yu9B4TBin4pLnnWQxUP4XfP2ZNTgMI5OTdEcvlOda4/pY26+NfvuVBnngp RK2e96G2VMKLiV83GL049ecJmTtfAKvRffrdBBj5fZz0C5iN3a24jma4KJjH4AR0LwOB Ju2A== 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=1AurSeyA5Jnphyld2+oZMRZ60/f5BqDeexDLSdMMpeE=; b=Df+JeCqBQinayfdatCGrrwDxLsKchfrmWweHjrsU/L6XJUfY+DV4yWY9TA4OiZzAjX QEL0GKSViIMhokKksHTaB8M3UzeunpmNZIYOEMPoWcE/8UfQ4WXBBmj5sYZQWDI1XuiZ uSnd+e2yY6yei5WFjfEP03oABvbWPtRK9ZN4rZP6bkjf4ZaPJxERKgW62TrXLQYysqML /XTWaCdXcaKSFxPVtVQGiFAMsTWlLVkEoPlSNFPhKD6N7djRA8gysK8KO180GhCe7crU NUDl3XuA6WxB34Xyfg7ZSGe9BgcW6GcpLl0q5FlxJOLKlHKT4fgX1BaKyDx9O4Y3EUuH +0Xg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20210112 header.b=fj4itjaI; 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 y14-20020aa7d50e000000b004fd23c354a4si2405652edq.536.2023.03.31.09.23.45; Fri, 31 Mar 2023 09:23:46 -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=20210112 header.b=fj4itjaI; 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 AF70F68C345; Fri, 31 Mar 2023 19:22:33 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-lj1-f178.google.com (mail-lj1-f178.google.com [209.85.208.178]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 7C9B368C2EE for ; Fri, 31 Mar 2023 19:22:18 +0300 (EEST) Received: by mail-lj1-f178.google.com with SMTP id a44so4975965ljr.10 for ; Fri, 31 Mar 2023 09:22:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1680279737; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=1NnZ+wvikwZDTSvlAF1ULTsLB12vvqbdwGQdXJ/I1ds=; b=fj4itjaImNZxqgJEIF3NER1v4DDOelnUQYF9uoZx4vjZWufU+mazhSdCO8IRlhFeyD a8q4zneq6VoiKrDcZamk/YuBrKae9uBDE71oWBqWBWsssblsbGVhicz5XEPWFyFHamjw e/7qgREbAqbORRbR9HxN0LAv5Y0DBFvGdgKN/v/a1+N7RWFokHlNSYBxP1F50pjHPfrF hkrdUpffd59jwTVgTJ6588A5n/swQrnxMxeHGYYG/UhXUf3m9PnQdRgzGFhIWihizQSF xuL1Ep3mVyYF8W4H8gnltWbyBEG5bZKK1W4kqt8npEKn8j0D0+Im06Mo7OCQxoL4eN/N 5Rgg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680279737; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=1NnZ+wvikwZDTSvlAF1ULTsLB12vvqbdwGQdXJ/I1ds=; b=jLq2xX7Mo+ci73p9/XE36Hu7wQDoqKcemGlmcLLKwJhm62Z9EAxPyWv1ed54nybCf5 kMp+7Q6IsA669wS4dURUDfsjmYZq5jQj6G+58sJUo9rvzTDTVSmgTYuf9riCMA9nZoUa xcG4TpclL5Ma1AoTb4dg1gE5LcOyp6dO/2CpqF3eyg58Fig+Nwx/uyUuovAweJsUCzPK Z8rAnzAYtrhzW2GXfMdTXvXV97eR3Wh/Nhmy0inpjXgro6Pgjc5FtDmhFiR0M5QX7Pap uWr3ruclZomOk6UYSHlD2NuR+MFg5UMcgX5GTl4toZLonFTRlLzgWXjK+A6cEfqEaa6R 6YYQ== X-Gm-Message-State: AAQBX9dd0+tU0XxD61uCEYCphlTJSjh+HpFqN5HTHPPcjQz5+DZlvf/t JyrLXFiwc27uxprQ22DZs8k8jdWVIwM= X-Received: by 2002:a2e:9c11:0:b0:2a1:8c04:b094 with SMTP id s17-20020a2e9c11000000b002a18c04b094mr7181813lji.3.1680279737834; Fri, 31 Mar 2023 09:22:17 -0700 (PDT) Received: from localhost.localdomain (91-153-198-187.elisa-laajakaista.fi. [91.153.198.187]) by smtp.gmail.com with ESMTPSA id n20-20020a2e8794000000b0029573844d03sm411483lji.109.2023.03.31.09.22.17 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 31 Mar 2023 09:22:17 -0700 (PDT) From: =?utf-8?q?Jan_Ekstr=C3=B6m?= To: ffmpeg-devel@ffmpeg.org Date: Fri, 31 Mar 2023 19:22:02 +0300 Message-Id: <20230331162205.428735-10-jeebjp@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230331162205.428735-1-jeebjp@gmail.com> References: <20230331162205.428735-1-jeebjp@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v1 09/12] ffmpeg: pass first video AVFrame's side data to encoder 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: raxKctxdR6si This enables further configuration of output based on the results of input decoding and filtering in a similar manner as the color information. --- fftools/ffmpeg.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c index 438bee8fef..c26dd1ad0c 100644 --- a/fftools/ffmpeg.c +++ b/fftools/ffmpeg.c @@ -3118,11 +3118,23 @@ static int init_output_stream_encode(OutputStream *ost, AVFrame *frame) av_pix_fmt_desc_get(enc_ctx->pix_fmt)->comp[0].depth); if (frame) { + int ret = AVERROR_BUG; + enc_ctx->color_range = frame->color_range; enc_ctx->color_primaries = frame->color_primaries; enc_ctx->color_trc = frame->color_trc; enc_ctx->colorspace = frame->colorspace; enc_ctx->chroma_sample_location = frame->chroma_location; + + if ((ret = av_extend_side_data_set(&enc_ctx->side_data_set, + (const AVFrameSideDataSet){ + .side_data = frame->side_data, + .nb_side_data = frame->nb_side_data + })) < 0) { + av_log(NULL, AV_LOG_ERROR, "failed to configure video encoder: %s!\n", + av_err2str(ret)); + return ret; + } } enc_ctx->framerate = ost->frame_rate;