From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id AAC4B48CAE for ; Wed, 24 Jan 2024 08:20:14 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 1D78F68D127; Wed, 24 Jan 2024 10:17:47 +0200 (EET) Received: from mail1.khirnov.net (quelana.khirnov.net [94.230.150.81]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 7C0AD68D103 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=JczsZf8v; dkim-atps=neutral Received: from localhost (mail1.khirnov.net [IPv6:::1]) by mail1.khirnov.net (Postfix) with ESMTP id 844681BB5 for ; Wed, 24 Jan 2024 09:17:24 +0100 (CET) Received: from mail1.khirnov.net ([IPv6:::1]) by localhost (mail1.khirnov.net [IPv6:::1]) (amavis, port 10024) with ESMTP id rL2lBcxrTElU 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=vV0irvYH/je8QLtCLIFXP2khtEtiVO0jLtx8X0PL2To=; h=From:To:Subject:Date:In-Reply-To:References:From; b=JczsZf8vkoNWAQU4l4Z0DEB3dklR58cLNe2NGwhovIyCbERSMPqVkuJI3b6O7xPAS df389qUNDICyDunmclxJVjwY2YGrblSfcZGXxloDBYYr+ZB+hfHeILrgdbCSjH2X/v 9IMbibQUbnZx9BTZBYFMUuYSIDDnPYoXQRFdg0saTWyrc05YWzVbdKNBnsHQX9+7eD UPLNEX2oKars4zjXUJwZ3Sp0ylQL4iSVh6NPuJqKGB9o1kfr7UQuTTqnByGz6Y5EX1 QnGHYPIoOGe0SUH7ZqEKHX0mvnFCW8L7IbQ5qv6dxo/Y6kUO6FIv6myNzhxZWtid/p Osdi5gttneb4A== 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 389851BB8 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 2D25D3A054A 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:53 +0100 Message-ID: <20240124081702.4759-23-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 23/31] fftools/ffmpeg_dec: eliminate InputStream use in hw_device_setup_for_decode() 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 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: The same information can also be obtained from the decoder itself. This is a step towards decoupling Decoder and InputStream. --- fftools/ffmpeg_dec.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/fftools/ffmpeg_dec.c b/fftools/ffmpeg_dec.c index 6c8f08d33e..ba261f4912 100644 --- a/fftools/ffmpeg_dec.c +++ b/fftools/ffmpeg_dec.c @@ -803,7 +803,8 @@ static HWDevice *hw_device_match_by_codec(const AVCodec *codec) } } -static int hw_device_setup_for_decode(InputStream *ist, DecoderPriv *dp, +static int hw_device_setup_for_decode(DecoderPriv *dp, + const AVCodec *codec, const char *hwaccel_device) { const AVCodecHWConfig *config; @@ -858,7 +859,7 @@ static int hw_device_setup_for_decode(InputStream *ist, DecoderPriv *dp, if (!dev) err = hw_device_init_from_type(type, NULL, &dev); } else { - dev = hw_device_match_by_codec(ist->dec); + dev = hw_device_match_by_codec(codec); if (!dev) { // No device for this codec, but not using generic hwaccel // and therefore may well not need one - ignore. @@ -869,12 +870,12 @@ static int hw_device_setup_for_decode(InputStream *ist, DecoderPriv *dp, if (auto_device) { int i; - if (!avcodec_get_hw_config(ist->dec, 0)) { + if (!avcodec_get_hw_config(codec, 0)) { // Decoder does not support any hardware devices. return 0; } for (i = 0; !dev; i++) { - config = avcodec_get_hw_config(ist->dec, i); + config = avcodec_get_hw_config(codec, i); if (!config) break; type = config->device_type; @@ -886,7 +887,7 @@ static int hw_device_setup_for_decode(InputStream *ist, DecoderPriv *dp, } } for (i = 0; !dev; i++) { - config = avcodec_get_hw_config(ist->dec, i); + config = avcodec_get_hw_config(codec, i); if (!config) break; type = config->device_type; @@ -921,7 +922,7 @@ static int hw_device_setup_for_decode(InputStream *ist, DecoderPriv *dp, if (!dev) { av_log(dp, AV_LOG_ERROR, "No device available " "for decoder: device type %s needed for codec %s.\n", - av_hwdevice_get_type_name(type), ist->dec->name); + av_hwdevice_get_type_name(type), codec->name); return err; } @@ -1010,7 +1011,7 @@ int dec_open(InputStream *ist, Scheduler *sch, unsigned sch_idx, av_dict_set(dec_opts, "flags", "+copy_opaque", AV_DICT_MULTIKEY); - ret = hw_device_setup_for_decode(ist, dp, o->hwaccel_device); + ret = hw_device_setup_for_decode(dp, codec, o->hwaccel_device); if (ret < 0) { av_log(dp, AV_LOG_ERROR, "Hardware device setup failed for decoder: %s\n", -- 2.42.0 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".