Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
* [FFmpeg-devel] [PATCH 01/10] fftools/ffmpeg: move freeing an input stream into a separate function
@ 2022-11-17 10:16 Anton Khirnov
  2022-11-17 10:16 ` [FFmpeg-devel] [PATCH 02/10] fftools/ffmpeg: drop an arbitrary condition Anton Khirnov
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: Anton Khirnov @ 2022-11-17 10:16 UTC (permalink / raw)
  To: ffmpeg-devel

---
 fftools/ffmpeg.c | 41 ++++++++++++++++++++++++-----------------
 1 file changed, 24 insertions(+), 17 deletions(-)

diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c
index dfdfad3ce4..25155e155e 100644
--- a/fftools/ffmpeg.c
+++ b/fftools/ffmpeg.c
@@ -502,6 +502,28 @@ static int decode_interrupt_cb(void *ctx)
 
 const AVIOInterruptCB int_cb = { decode_interrupt_cb, NULL };
 
+static void ist_free(InputStream **pist)
+{
+    InputStream *ist = *pist;
+
+    if (!ist)
+        return;
+
+    av_frame_free(&ist->decoded_frame);
+    av_packet_free(&ist->pkt);
+    av_dict_free(&ist->decoder_opts);
+    avsubtitle_free(&ist->prev_sub.subtitle);
+    av_frame_free(&ist->sub2video.frame);
+    av_freep(&ist->filters);
+    av_freep(&ist->hwaccel_device);
+    av_freep(&ist->dts_buffer);
+
+    avcodec_free_context(&ist->dec_ctx);
+    avcodec_parameters_free(&ist->par);
+
+    av_freep(pist);
+}
+
 static void ffmpeg_cleanup(int ret)
 {
     int i, j;
@@ -558,23 +580,8 @@ static void ffmpeg_cleanup(int ret)
     for (i = 0; i < nb_input_files; i++)
         ifile_close(&input_files[i]);
 
-    for (i = 0; i < nb_input_streams; i++) {
-        InputStream *ist = input_streams[i];
-
-        av_frame_free(&ist->decoded_frame);
-        av_packet_free(&ist->pkt);
-        av_dict_free(&ist->decoder_opts);
-        avsubtitle_free(&ist->prev_sub.subtitle);
-        av_frame_free(&ist->sub2video.frame);
-        av_freep(&ist->filters);
-        av_freep(&ist->hwaccel_device);
-        av_freep(&ist->dts_buffer);
-
-        avcodec_free_context(&ist->dec_ctx);
-        avcodec_parameters_free(&ist->par);
-
-        av_freep(&input_streams[i]);
-    }
+    for (i = 0; i < nb_input_streams; i++)
+        ist_free(&input_streams[i]);
 
     if (vstats_file) {
         if (fclose(vstats_file))
-- 
2.35.1

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

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2022-11-17 10:18 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-17 10:16 [FFmpeg-devel] [PATCH 01/10] fftools/ffmpeg: move freeing an input stream into a separate function Anton Khirnov
2022-11-17 10:16 ` [FFmpeg-devel] [PATCH 02/10] fftools/ffmpeg: drop an arbitrary condition Anton Khirnov
2022-11-17 10:16 ` [FFmpeg-devel] [PATCH 03/10] fftools/ffmpeg: stop inventing fake source information Anton Khirnov
2022-11-17 10:16 ` [FFmpeg-devel] [PATCH 04/10] fftools/ffmpeg: replace OutputStream.source_index with a pointer to InputStream Anton Khirnov
2022-11-17 10:16 ` [FFmpeg-devel] [PATCH 05/10] fftools/ffmpeg_mux_init: simplify inner loop in map_auto_{video, audio} Anton Khirnov
2022-11-17 10:16 ` [FFmpeg-devel] [PATCH 06/10] fftools/ffmpeg: remove the input_streams global Anton Khirnov
2022-11-17 10:16 ` [FFmpeg-devel] [PATCH 07/10] fftools/ffmpeg: do not assume input streams exist Anton Khirnov
2022-11-17 10:16 ` [FFmpeg-devel] [PATCH 08/10] fftools/ffmpeg: declare loop variables inside loops in transcode_init() Anton Khirnov
2022-11-17 10:16 ` [FFmpeg-devel] [PATCH 09/10] fftools/ffmpeg: _-prefix variables in MATCH_PER_STREAM_OPT() Anton Khirnov
2022-11-17 10:16 ` [FFmpeg-devel] [PATCH 10/10] fftools/ffmpeg_mux_init: postpone matching -disposition to streams Anton Khirnov

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