From patchwork Wed Jan 24 08:16: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: 45772 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:120f:b0:199:de12:6fa6 with SMTP id v15csp1129863pzf; Wed, 24 Jan 2024 00:19:27 -0800 (PST) X-Google-Smtp-Source: AGHT+IHxgBfFxSRDBfUGiOYeOwpfnUdEEr9rvKuPmzF3j5c1qJsE8Zfs4npl6tegnDbOIu5cm41w X-Received: by 2002:a17:906:2449:b0:a30:ff25:5dfc with SMTP id a9-20020a170906244900b00a30ff255dfcmr1001039ejb.6.1706084366813; Wed, 24 Jan 2024 00:19:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1706084366; cv=none; d=google.com; s=arc-20160816; b=opmDi/N58CEi24KLKGZcsVdr3CYgUdOH8IFyICxK5nAxR65p5vq4QUNMSfEIXYXYP4 AgXwVzeDnexM6vJnbeewywwbswW6v1I2Mw3ioXcrvwIqpqcwzSdNUtT8BGFfBTLaBiam Ien5BpGdIT3vNToz3jxNMtqiSTEv/BidMMNNe244l0ptgUjCqHZ5sqQmoGu+wjEqgzx6 n0cdQ2raz20nkYHLUfaxqO6oIojzABFH3HPVg9j2NluAiRGjKhnSmcdt8cNfFfmCGaNj ukjz+v9YCPL7Z42ol41Y9jCvIQM4emPQ1pt2iG+lR+eQooSMzAGnju6hTr7J4s2NkOFK GrCg== 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=/u/B5DD2wcTRH9D5BZuM8rKUPmPpVRBAyMGjQUbha+M=; fh=YOA8vD9MJZuwZ71F/05pj6KdCjf6jQRmzLS+CATXUQk=; b=rmzUpJ7x9Ev4QIOt7d135ZQKNf8O+jKUwy+zdSidY5CD81CtPcU9giIQmaSG8ad/TV /13T321DwZB0h9sPCQx6TapctlSPG+VxIqoBc2U1fr2CeOnPFu8T8c8FFVo4WdpVEYFB PnQl5MLNNZA7rky/VdSA0c6LZRhOvo/wClWTZ7O46xX7aZ65sks6jA8eJ4RinKLOp5lX do/JX+MfhYwnHXGs4kb1uP3kawBWleBt6oS7/Zz3dVRaMr9d6vNBxyHfgFCO/AN7brMN ZAyJyYrg+vKIULMt9mVuvJWKy5kS0USDtpvpexQRwtEbzUPSctB9c3THEhLOG1j9Q7BY QkGw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@khirnov.net header.s=mail header.b="MUvd/xYZ"; 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 o10-20020a17090608ca00b00a30b2ea6725si1726113eje.581.2024.01.24.00.19.26; Wed, 24 Jan 2024 00:19:26 -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="MUvd/xYZ"; 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 4E13868D14D; Wed, 24 Jan 2024 10:17:40 +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 4B11E68D0ED for ; Wed, 24 Jan 2024 10:17:27 +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=MUvd/xYZ; dkim-atps=neutral Received: from localhost (mail1.khirnov.net [IPv6:::1]) by mail1.khirnov.net (Postfix) with ESMTP id 017351BAE for ; Wed, 24 Jan 2024 09:17:25 +0100 (CET) Received: from mail1.khirnov.net ([IPv6:::1]) by localhost (mail1.khirnov.net [IPv6:::1]) (amavis, port 10024) with ESMTP id Q8c-vYhjAWJT for ; Wed, 24 Jan 2024 09:17:24 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=khirnov.net; s=mail; t=1706084240; bh=kIwvjEC+ddvavyCWY6Jd2Xu6QKbBdzbrBy0uVjCi48w=; h=From:To:Subject:Date:In-Reply-To:References:From; b=MUvd/xYZoLywfThejj3ONlfhXTqUaDawc1AP38tVCi47CmPtF0uUTPSZj8vVU9EGb ZiopCQ40kCU/Rnfbnajof8CQbNHfxHGjD9xVfycmc76fPfSsUNXC6XrnVJbue9gAgd qXfRB39HJiATY+jsSudz397h5yntHs+C/rk54NbEggG2ySNZaSbZpvOWCA56QhIqhA cKRm5hWLYXkr22IEKsa5DuEfGq+W6F8Lr6fQXBHHT6WY74ZSYWNjmc9ZQx8znue6eR bcwmZLm+KEOdswR7cuyYOb9YhhpnUHSNDHWReMO6BQ8ypC5uGxp4ammBLq2juAvSuU AaurWMA5RjEiA== 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 43BDD1BB9 for ; Wed, 24 Jan 2024 09:17:20 +0100 (CET) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:::1]) by libav.khirnov.net (Postfix) with ESMTP id 37DE13A0534 for ; Wed, 24 Jan 2024 09:17:20 +0100 (CET) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Wed, 24 Jan 2024 09:16:54 +0100 Message-ID: <20240124081702.4759-24-anton@khirnov.net> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20240124081702.4759-1-anton@khirnov.net> References: <20240124081702.4759-1-anton@khirnov.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 24/31] fftools/ffmpeg_dec: pass AVCodec through DecoderOpts 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: a4Mh97HneWrM Do not retrieve it from InputStream directly. This is a step towards decoupling Decoder and InputStream. --- fftools/ffmpeg.h | 2 ++ fftools/ffmpeg_dec.c | 2 +- fftools/ffmpeg_demux.c | 2 ++ 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/fftools/ffmpeg.h b/fftools/ffmpeg.h index bdfacf16b7..b169b1a323 100644 --- a/fftools/ffmpeg.h +++ b/fftools/ffmpeg.h @@ -297,6 +297,8 @@ typedef struct DecoderOpts { char *name; + const AVCodec *codec; + /* hwaccel options */ enum HWAccelID hwaccel_id; enum AVHWDeviceType hwaccel_device_type; diff --git a/fftools/ffmpeg_dec.c b/fftools/ffmpeg_dec.c index ba261f4912..c64b9f5b70 100644 --- a/fftools/ffmpeg_dec.c +++ b/fftools/ffmpeg_dec.c @@ -951,7 +951,7 @@ int dec_open(InputStream *ist, Scheduler *sch, unsigned sch_idx, AVDictionary **dec_opts, const DecoderOpts *o) { DecoderPriv *dp; - const AVCodec *codec = ist->dec; + const AVCodec *codec = o->codec; int ret; ret = dec_alloc(&ist->decoder); diff --git a/fftools/ffmpeg_demux.c b/fftools/ffmpeg_demux.c index 8bc73e2bf3..f66319aafe 100644 --- a/fftools/ffmpeg_demux.c +++ b/fftools/ffmpeg_demux.c @@ -930,6 +930,8 @@ static int ist_use(InputStream *ist, int decoding_needed) snprintf(ds->dec_name, sizeof(ds->dec_name), "%d:%d", ist->file->index, ist->index); ds->dec_opts.name = ds->dec_name; + ds->dec_opts.codec = ist->dec; + ret = dec_open(ist, d->sch, ds->sch_idx_dec, &ist->decoder_opts, &ds->dec_opts); if (ret < 0)