Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: Traian Coza <traian.coza@gmail.com>
To: ffmpeg-devel@ffmpeg.org
Cc: Traian Coza <traian.coza@gmail.com>
Subject: [FFmpeg-devel] [PATCH 10/12] Rearranged files, all tests are passing!
Date: Tue,  3 May 2022 12:13:26 -0400
Message-ID: <20220503161328.842587-11-traian.coza@gmail.com> (raw)
In-Reply-To: <20220503161328.842587-1-traian.coza@gmail.com>

---
 fftools/Makefile         |  2 ++
 fftools/ffmpeg.c         |  6 ++++--
 fftools/text_to_bitmap.c | 14 +++-----------
 fftools/text_to_bitmap.h | 14 ++++----------
 libavcodec/Makefile      |  1 -
 libavcodec/avcodec.c     |  9 ---------
 6 files changed, 13 insertions(+), 33 deletions(-)

diff --git a/fftools/Makefile b/fftools/Makefile
index 81ad6c4f4f..f9334a5622 100644
--- a/fftools/Makefile
+++ b/fftools/Makefile
@@ -15,6 +15,8 @@ OBJS-ffmpeg +=                  \
     fftools/ffmpeg_mux.o        \
     fftools/ffmpeg_opt.o        \
 
+OBJS-ffmpeg-$(CONFIG_LIBASS) += fftools/text_to_bitmap.o
+
 define DOFFTOOL
 OBJS-$(1) += fftools/cmdutils.o fftools/opt_common.o fftools/$(1).o $(OBJS-$(1)-yes)
 $(1)$(PROGSSUF)_g$(EXESUF): $$(OBJS-$(1))
diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c
index ae622492ee..251a3ce427 100644
--- a/fftools/ffmpeg.c
+++ b/fftools/ffmpeg.c
@@ -72,7 +72,7 @@
 # include "libavfilter/buffersink.h"
 
 #if CONFIG_LIBASS
-#include "libavcodec/text_to_bitmap.h"
+#include "fftools/text_to_bitmap.h"
 #endif
 
 #if HAVE_SYS_RESOURCE_H
@@ -3239,7 +3239,7 @@ static int init_output_stream(OutputStream *ost, AVFrame *frame,
                 return AVERROR_INVALIDDATA;
             }
             if (input_props == AV_CODEC_PROP_TEXT_SUB && output_props == AV_CODEC_PROP_BITMAP_SUB)
-                init_ass_context(input_streams, output_streams, nb_input_streams, nb_output_streams, ost->source_index, ost->index);
+                init_ass_context(ist, ost);
 #else
             if (input_props && output_props && input_props != output_props) {
                 snprintf(error, error_len,
@@ -4514,6 +4514,8 @@ static int transcode(void)
         ist = input_streams[i];
         if (ist->decoding_needed) {
             avcodec_close(ist->dec_ctx);
+            if (ist->dec_ctx->ass_context != NULL)     // This really has to be done here, sorry
+                free_ass_context(ist->dec_ctx->ass_context);
             if (ist->hwaccel_uninit)
                 ist->hwaccel_uninit(ist->dec_ctx);
         }
diff --git a/fftools/text_to_bitmap.c b/fftools/text_to_bitmap.c
index 52d161d7b1..b4a0157174 100644
--- a/fftools/text_to_bitmap.c
+++ b/fftools/text_to_bitmap.c
@@ -27,8 +27,8 @@
 #include "text_to_bitmap.h"
 
 #include "fftools/ffmpeg.h"
-#include "avcodec.h"
-#include "ass_split.h"
+#include "../libavcodec/avcodec.h"
+#include "../libavcodec/ass_split.h"
 
 /**
  * Holds the objects used by the rendering function so they don't have to be reinitialized every time
@@ -51,16 +51,8 @@ struct ASS_Context {
  * @param ist_i index of input stream for transcoding
  * @param ost_i index of output stream for transcoding
  */
-void init_ass_context(
-        InputStream **input_streams,
-        OutputStream **output_streams,
-        int nb_input_streams,
-        int nb_output_streams,
-        int ist_i,
-        int ost_i)
+void init_ass_context(InputStream *ist, OutputStream *ost)
 {
-    InputStream *ist = input_streams[ist_i];
-    OutputStream *ost = output_streams[ost_i];
     if (ist->dec_ctx->ass_context) return;
 
     ASS_Context *context = (ASS_Context *)malloc(sizeof(ASS_Context));
diff --git a/fftools/text_to_bitmap.h b/fftools/text_to_bitmap.h
index 29037150c2..a9b48c6cf3 100644
--- a/fftools/text_to_bitmap.h
+++ b/fftools/text_to_bitmap.h
@@ -21,8 +21,8 @@
  * text_to_bitmap header file
  */
 
-#ifndef AVCODEC_TEXT_TO_BITMAP_H
-#define AVCODEC_TEXT_TO_BITMAP_H
+#ifndef FFTOOLS_TEXT_TO_BITMAP_H
+#define FFTOOLS_TEXT_TO_BITMAP_H
 
 #include <ass/ass.h>
 #include "fftools/ffmpeg.h"
@@ -30,14 +30,8 @@
 struct ASS_Context;
 typedef struct ASS_Context ASS_Context;
 
-void init_ass_context(
-        InputStream **input_streams,
-        OutputStream **output_streams,
-        int nb_input_streams,
-        int nb_output_streams,
-        int ist_i,
-        int ost_i);
+void init_ass_context(InputStream *ist, OutputStream *ost);
 void render_avsub_ass(ASS_Context *, AVSubtitle *);
 void free_ass_context(ASS_Context *context);
 
-#endif //AVCODEC_TEXT_TO_BITMAP_H
+#endif //FFTOOLS_TEXT_TO_BITMAP_H
diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index 6d28513129..cfaa6f196a 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -151,7 +151,6 @@ OBJS-$(CONFIG_RV34DSP)                 += rv34dsp.o
 OBJS-$(CONFIG_SINEWIN)                 += sinewin.o
 OBJS-$(CONFIG_SNAPPY)                  += snappy.o
 OBJS-$(CONFIG_STARTCODE)               += startcode.o
-OBJS-$(CONFIG_LIBASS)                  += text_to_bitmap.o
 OBJS-$(CONFIG_TEXTUREDSP)              += texturedsp.o
 OBJS-$(CONFIG_TEXTUREDSPENC)           += texturedspenc.o
 OBJS-$(CONFIG_TPELDSP)                 += tpeldsp.o
diff --git a/libavcodec/avcodec.c b/libavcodec/avcodec.c
index 1e308f39c2..d11f035481 100644
--- a/libavcodec/avcodec.c
+++ b/libavcodec/avcodec.c
@@ -42,10 +42,6 @@
 #include "thread.h"
 #include "version.h"
 
-#if CONFIG_LIBASS
-#include "libavcodec/text_to_bitmap.h"
-#endif
-
 #include "libavutil/ffversion.h"
 const char av_codec_ffversion[] = "FFmpeg version " FFMPEG_VERSION;
 
@@ -538,11 +534,6 @@ av_cold int avcodec_close(AVCodecContext *avctx)
     } else if (av_codec_is_decoder(avctx->codec))
         av_freep(&avctx->subtitle_header);
 
-#if CONFIG_LIBASS
-    if (av_codec_is_decoder(avctx->codec) && avctx->ass_context != NULL)
-        free_ass_context(avctx->ass_context);
-#endif
-
     avctx->codec = NULL;
     avctx->active_thread_type = 0;
 
-- 
2.34.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".

  parent reply	other threads:[~2022-05-03 16:14 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-03 16:13 [FFmpeg-devel] [PATCH 00/12] I added text to bitmap subtitle conversion functionality! Traian Coza
2022-05-03 16:13 ` [FFmpeg-devel] [PATCH 01/12] Implemented text to bitmap subtitles! Traian Coza
2022-05-03 16:13 ` [FFmpeg-devel] [PATCH 02/12] Render only when necessary Traian Coza
2022-05-03 16:13 ` [FFmpeg-devel] [PATCH 03/12] Retreive width and height from video stream! Traian Coza
2022-05-03 16:13 ` [FFmpeg-devel] [PATCH 04/12] Initialize ass library only once! Traian Coza
2022-05-03 16:13 ` [FFmpeg-devel] [PATCH 05/12] Cleaned up Traian Coza
2022-05-03 16:13 ` [FFmpeg-devel] [PATCH 06/12] Wrote proper headers Traian Coza
2022-05-03 16:13 ` [FFmpeg-devel] [PATCH 07/12] Close libass after using Traian Coza
2022-05-03 16:13 ` [FFmpeg-devel] [PATCH 08/12] Added standard headers Traian Coza
2022-05-03 16:13 ` [FFmpeg-devel] [PATCH 09/12] Rearranged files, all tests are passing! Traian Coza
2022-05-03 16:13 ` Traian Coza [this message]
2022-05-03 16:13 ` [FFmpeg-devel] [PATCH 11/12] Added logging Traian Coza
2022-05-03 16:13 ` [FFmpeg-devel] [PATCH 12/12] Added more logging Traian Coza
2022-05-03 16:20 ` [FFmpeg-devel] [PATCH 00/12] I added text to bitmap subtitle conversion functionality! Paul B Mahol
2022-05-03 16:51   ` Nicolas George
2022-05-03 17:01     ` Traian Coza
2022-05-03 17:05       ` Leo Izen
2022-05-03 17:09         ` Traian Coza
2022-05-03 16:27 ` Soft Works
2022-05-04  0:16   ` Soft Works

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=20220503161328.842587-11-traian.coza@gmail.com \
    --to=traian.coza@gmail.com \
    --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