Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: Anton Khirnov <anton@khirnov.net>
To: ffmpeg-devel@ffmpeg.org
Subject: [FFmpeg-devel] [PATCH 07/11] fftools/ffmpeg_filter: move InputFilter.hw_frames_ctx to private data
Date: Fri,  5 May 2023 11:07:19 +0200
Message-ID: <20230505090723.24872-7-anton@khirnov.net> (raw)
In-Reply-To: <20230505090723.24872-1-anton@khirnov.net>

It is not used outside of ffmpeg_filter.
---
 fftools/ffmpeg.h        |  2 --
 fftools/ffmpeg_filter.c | 16 +++++++++-------
 2 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/fftools/ffmpeg.h b/fftools/ffmpeg.h
index 8a2254d2a8..c7e225d1a0 100644
--- a/fftools/ffmpeg.h
+++ b/fftools/ffmpeg.h
@@ -289,8 +289,6 @@ typedef struct InputFilter {
 
     int sample_rate;
     AVChannelLayout ch_layout;
-
-    AVBufferRef *hw_frames_ctx;
 } InputFilter;
 
 typedef struct OutputFilter {
diff --git a/fftools/ffmpeg_filter.c b/fftools/ffmpeg_filter.c
index 087ef8b894..34c51c23d9 100644
--- a/fftools/ffmpeg_filter.c
+++ b/fftools/ffmpeg_filter.c
@@ -61,6 +61,8 @@ typedef struct InputFilterPriv {
 
     AVFifo *frame_queue;
 
+    AVBufferRef *hw_frames_ctx;
+
     int32_t *displaymatrix;
 
     // fallback parameters to use when no input is ever sent
@@ -282,7 +284,7 @@ void fg_free(FilterGraph **pfg)
 
         av_channel_layout_uninit(&ifp->fallback.ch_layout);
 
-        av_buffer_unref(&ifilter->hw_frames_ctx);
+        av_buffer_unref(&ifp->hw_frames_ctx);
         av_freep(&ifilter->name);
         av_freep(&fg->inputs[j]);
     }
@@ -1051,7 +1053,7 @@ static int configure_input_video_filter(FilterGraph *fg, InputFilter *ifilter,
     if ((ret = avfilter_graph_create_filter(&ifilter->filter, buffer_filt, name,
                                             args.str, NULL, fg->graph)) < 0)
         goto fail;
-    par->hw_frames_ctx = ifilter->hw_frames_ctx;
+    par->hw_frames_ctx = ifp->hw_frames_ctx;
     ret = av_buffersrc_parameters_set(ifilter->filter, par);
     if (ret < 0)
         goto fail;
@@ -1413,7 +1415,7 @@ static int ifilter_parameters_from_frame(InputFilter *ifilter, const AVFrame *fr
     AVFrameSideData *sd;
     int ret;
 
-    av_buffer_unref(&ifilter->hw_frames_ctx);
+    av_buffer_unref(&ifp->hw_frames_ctx);
 
     ifilter->format = frame->format;
 
@@ -1432,8 +1434,8 @@ static int ifilter_parameters_from_frame(InputFilter *ifilter, const AVFrame *fr
         ifp->displaymatrix = av_memdup(sd->data, sizeof(int32_t) * 9);
 
     if (frame->hw_frames_ctx) {
-        ifilter->hw_frames_ctx = av_buffer_ref(frame->hw_frames_ctx);
-        if (!ifilter->hw_frames_ctx)
+        ifp->hw_frames_ctx = av_buffer_ref(frame->hw_frames_ctx);
+        if (!ifp->hw_frames_ctx)
             return AVERROR(ENOMEM);
     }
 
@@ -1565,8 +1567,8 @@ int ifilter_send_frame(InputFilter *ifilter, AVFrame *frame, int keep_reference)
     if (!ifilter->ist->reinit_filters && fg->graph)
         need_reinit = 0;
 
-    if (!!ifilter->hw_frames_ctx != !!frame->hw_frames_ctx ||
-        (ifilter->hw_frames_ctx && ifilter->hw_frames_ctx->data != frame->hw_frames_ctx->data))
+    if (!!ifp->hw_frames_ctx != !!frame->hw_frames_ctx ||
+        (ifp->hw_frames_ctx && ifp->hw_frames_ctx->data != frame->hw_frames_ctx->data))
         need_reinit = 1;
 
     if (sd = av_frame_get_side_data(frame, AV_FRAME_DATA_DISPLAYMATRIX)) {
-- 
2.39.2

_______________________________________________
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".

  parent reply	other threads:[~2023-05-05  9:08 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-05  9:07 [FFmpeg-devel] [PATCH 01/11] fftools/ffmpeg: merge choose_output() and got_eagain() Anton Khirnov
2023-05-05  9:07 ` [FFmpeg-devel] [PATCH 02/11] fftools/ffmpeg: eliminate need_output() Anton Khirnov
2023-05-05  9:07 ` [FFmpeg-devel] [PATCH 03/11] fftools/ffmpeg_enc: stop configuring filter inputs from encoder flush Anton Khirnov
2023-05-05  9:07 ` [FFmpeg-devel] [PATCH 04/11] fftools/ffmpeg_filter: take fallback parameters from decoder, not demuxer Anton Khirnov
2023-05-05  9:07 ` [FFmpeg-devel] [PATCH 05/11] fftools/ffmpeg_filter: move InputFilter.eof to private data Anton Khirnov
2023-05-05  9:07 ` [FFmpeg-devel] [PATCH 06/11] fftools/ffmpeg_filter: move InputFilter.displaymatrix " Anton Khirnov
2023-05-05  9:07 ` Anton Khirnov [this message]
2023-05-05  9:07 ` [FFmpeg-devel] [PATCH 08/11] fftools/ffmpeg_filter: use av_buffer_replace() to improve code Anton Khirnov
2023-05-05  9:07 ` [FFmpeg-devel] [PATCH 09/11] fftools/ffmpeg: move unconfigured graph handling to ffmpeg_filter Anton Khirnov
2023-05-05  9:07 ` [FFmpeg-devel] [PATCH 10/11] fftools/ffmpeg_filter: use InputFilterPriv.eof instead of InputFile.eof_reached Anton Khirnov
2023-05-05  9:07 ` [FFmpeg-devel] [PATCH 11/11] fftools/ffmpeg: discard packets for unused streams in demuxing thread Anton Khirnov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230505090723.24872-7-anton@khirnov.net \
    --to=anton@khirnov.net \
    --cc=ffmpeg-devel@ffmpeg.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git