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 8BD3448C9B for ; Wed, 24 Jan 2024 08:19:16 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 28EDC68D185; Wed, 24 Jan 2024 10:17:39 +0200 (EET) Received: from mail1.khirnov.net (quelana.khirnov.net [94.230.150.81]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 433B068D103 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=AaKbqX8n; dkim-atps=neutral Received: from localhost (mail1.khirnov.net [IPv6:::1]) by mail1.khirnov.net (Postfix) with ESMTP id AFD921BAD 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 hQBx3bc6ImCM 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=lfrMe5/Gv1vi0rRHB0PM0yktXwXIWrGnMXjLjfLimys=; h=From:To:Subject:Date:In-Reply-To:References:From; b=AaKbqX8nsfufxaEQfrz3s0VXHTOd6sNVbzqqK8EFomB1vvc+ynbXMyRMfpdViu4OP TkXPUla7EchPgAO7hvZNmVS/s21ko322Pa0C2xCy7Ul/X6KGJ2LP7pm/sUOo1S4vch luesSQkpZwQTzEyOeBEfE4+Dw9+dNtKmU8ZVzd+Sg9fP9KKCqU01bJMCnc6rrNM/mW Ps6LsIl15FqYFKtPAi4fc8sbgHc1rvyLs1YkAgQeD/N6Hzokb3vaed9LjmbZXzXgEL L7y4AFd/XHLB8GLoUx+B3lfRBDrYVovjMbfZbb5QzuUMKYNOxg0oqV2gfsk/C5bCzc 9tY+3q2EAigzQ== 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 2DE371BB7 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 225E13A0582 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:52 +0100 Message-ID: <20240124081702.4759-22-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 22/31] fftools/ffmpeg_dec: pass decoder name 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 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: Do not build it from InputStream values. This is a step towards decoupling Decoder and InputStream. --- fftools/ffmpeg.h | 2 ++ fftools/ffmpeg_dec.c | 17 +++++++++++------ fftools/ffmpeg_demux.c | 4 ++++ 3 files changed, 17 insertions(+), 6 deletions(-) diff --git a/fftools/ffmpeg.h b/fftools/ffmpeg.h index 9add5cac85..bdfacf16b7 100644 --- a/fftools/ffmpeg.h +++ b/fftools/ffmpeg.h @@ -295,6 +295,8 @@ enum DecoderFlags { typedef struct DecoderOpts { int flags; + char *name; + /* hwaccel options */ enum HWAccelID hwaccel_id; enum AVHWDeviceType hwaccel_device_type; diff --git a/fftools/ffmpeg_dec.c b/fftools/ffmpeg_dec.c index e34b23b40c..6c8f08d33e 100644 --- a/fftools/ffmpeg_dec.c +++ b/fftools/ffmpeg_dec.c @@ -73,6 +73,7 @@ typedef struct DecoderPriv { void *log_parent; char log_name[32]; + char *parent_name; } DecoderPriv; static DecoderPriv *dp_from_dec(Decoder *d) @@ -104,6 +105,8 @@ void dec_free(Decoder **pdec) av_frame_free(&dp->sub_prev[i]); av_frame_free(&dp->sub_heartbeat); + av_freep(&dp->parent_name); + av_freep(pdec); } @@ -499,7 +502,6 @@ static int transcode_subtitles(InputStream *ist, const AVPacket *pkt, static int packet_decode(InputStream *ist, AVPacket *pkt, AVFrame *frame) { - const InputFile *ifile = ist->file; DecoderPriv *dp = dp_from_dec(ist->decoder); AVCodecContext *dec = dp->dec_ctx; const char *type_desc = av_get_media_type_string(dec->codec_type); @@ -554,8 +556,7 @@ static int packet_decode(InputStream *ist, AVPacket *pkt, AVFrame *frame) update_benchmark(NULL); ret = avcodec_receive_frame(dec, frame); - update_benchmark("decode_%s %d.%d", type_desc, - ifile->index, ist->index); + update_benchmark("decode_%s %s", type_desc, dp->parent_name); if (ret == AVERROR(EAGAIN)) { av_assert0(pkt); // should never happen during flushing @@ -616,10 +617,10 @@ static int packet_decode(InputStream *ist, AVPacket *pkt, AVFrame *frame) } } -static void dec_thread_set_name(const InputStream *ist, const DecoderPriv *dp) +static void dec_thread_set_name(const DecoderPriv *dp) { char name[16]; - snprintf(name, sizeof(name), "dec%d:%d:%s", ist->file->index, ist->index, + snprintf(name, sizeof(name), "dec%s:%s", dp->parent_name, dp->dec_ctx->codec->name); ff_thread_setname(name); } @@ -662,7 +663,7 @@ void *decoder_thread(void *arg) if (ret < 0) goto finish; - dec_thread_set_name(ist, dp); + dec_thread_set_name(dp); while (!input_status) { int flush_buffers, have_data; @@ -972,6 +973,10 @@ int dec_open(InputStream *ist, Scheduler *sch, unsigned sch_idx, snprintf(dp->log_name, sizeof(dp->log_name), "dec:%s", codec->name); + dp->parent_name = av_strdup(o->name ? o->name : ""); + if (!dp->parent_name) + return AVERROR(ENOMEM); + if (codec->type == AVMEDIA_TYPE_SUBTITLE && (dp->flags & DECODER_FLAG_FIX_SUB_DURATION)) { for (int i = 0; i < FF_ARRAY_ELEMS(dp->sub_prev); i++) { diff --git a/fftools/ffmpeg_demux.c b/fftools/ffmpeg_demux.c index 3c3be214c5..8bc73e2bf3 100644 --- a/fftools/ffmpeg_demux.c +++ b/fftools/ffmpeg_demux.c @@ -73,6 +73,7 @@ typedef struct DemuxStream { const AVCodecDescriptor *codec_desc; DecoderOpts dec_opts; + char dec_name[16]; AVBSFContext *bsf; @@ -926,6 +927,9 @@ static int ist_use(InputStream *ist, int decoding_needed) "same time is not fully supported, also see -compute_edt [0|1]\n"); } + snprintf(ds->dec_name, sizeof(ds->dec_name), "%d:%d", ist->file->index, ist->index); + ds->dec_opts.name = ds->dec_name; + ret = dec_open(ist, d->sch, ds->sch_idx_dec, &ist->decoder_opts, &ds->dec_opts); if (ret < 0) -- 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".