diff mbox series

[FFmpeg-devel,208/217] avcodec: Mark ff_ass_subtitle_header based decoders as init-threadsafe

Message ID 20201202042244.519127-74-andreas.rheinhardt@gmail.com
State New
Headers show
Series [FFmpeg-devel,01/45] avcodec/a64multienc: Fix memleak upon init failure
Related show

Checks

Context Check Description
andriy/x86 warning Failed to apply patch

Commit Message

Andreas Rheinhardt Dec. 2, 2020, 4:22 a.m. UTC
ff_ass_subtitle_header_full() just uses av_asprintf() and is therefore
thread-safe itself.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
---
 libavcodec/ccaption_dec.c | 2 ++
 libavcodec/jacosubdec.c   | 2 ++
 libavcodec/microdvddec.c  | 2 ++
 libavcodec/movtextdec.c   | 2 ++
 libavcodec/mpl2dec.c      | 2 ++
 libavcodec/realtextdec.c  | 2 ++
 libavcodec/samidec.c      | 2 ++
 libavcodec/srtdec.c       | 3 +++
 libavcodec/subviewerdec.c | 2 ++
 libavcodec/textdec.c      | 6 ++++++
 libavcodec/webvttdec.c    | 2 ++
 11 files changed, 27 insertions(+)
diff mbox series

Patch

diff --git a/libavcodec/ccaption_dec.c b/libavcodec/ccaption_dec.c
index a208e19b95..a75a5e03db 100644
--- a/libavcodec/ccaption_dec.c
+++ b/libavcodec/ccaption_dec.c
@@ -21,6 +21,7 @@ 
 
 #include "avcodec.h"
 #include "ass.h"
+#include "internal.h"
 #include "libavutil/opt.h"
 
 #define SCREEN_ROWS 15
@@ -952,4 +953,5 @@  AVCodec ff_ccaption_decoder = {
     .decode         = decode,
     .priv_class     = &ccaption_dec_class,
     .capabilities   = AV_CODEC_CAP_DELAY,
+    .caps_internal  = FF_CODEC_CAP_INIT_THREADSAFE,
 };
diff --git a/libavcodec/jacosubdec.c b/libavcodec/jacosubdec.c
index cdb372af58..b632e474c5 100644
--- a/libavcodec/jacosubdec.c
+++ b/libavcodec/jacosubdec.c
@@ -26,6 +26,7 @@ 
 
 #include <time.h>
 #include "ass.h"
+#include "internal.h"
 #include "jacosub.h"
 #include "libavutil/avstring.h"
 #include "libavutil/bprint.h"
@@ -202,4 +203,5 @@  AVCodec ff_jacosub_decoder = {
     .decode         = jacosub_decode_frame,
     .flush          = ff_ass_decoder_flush,
     .priv_data_size = sizeof(FFASSDecoderContext),
+    .caps_internal  = FF_CODEC_CAP_INIT_THREADSAFE,
 };
diff --git a/libavcodec/microdvddec.c b/libavcodec/microdvddec.c
index dad0ec8a22..c39d54e084 100644
--- a/libavcodec/microdvddec.c
+++ b/libavcodec/microdvddec.c
@@ -31,6 +31,7 @@ 
 #include "libavutil/bprint.h"
 #include "avcodec.h"
 #include "ass.h"
+#include "internal.h"
 
 static int indexof(const char *s, int c)
 {
@@ -377,4 +378,5 @@  AVCodec ff_microdvd_decoder = {
     .decode       = microdvd_decode_frame,
     .flush        = ff_ass_decoder_flush,
     .priv_data_size = sizeof(FFASSDecoderContext),
+    .caps_internal  = FF_CODEC_CAP_INIT_THREADSAFE,
 };
diff --git a/libavcodec/movtextdec.c b/libavcodec/movtextdec.c
index ad790bf44c..8a219a457c 100644
--- a/libavcodec/movtextdec.c
+++ b/libavcodec/movtextdec.c
@@ -28,6 +28,7 @@ 
 #include "libavutil/intreadwrite.h"
 #include "libavutil/mem.h"
 #include "bytestream.h"
+#include "internal.h"
 
 #define STYLE_FLAG_BOLD         (1<<0)
 #define STYLE_FLAG_ITALIC       (1<<1)
@@ -593,4 +594,5 @@  AVCodec ff_movtext_decoder = {
     .decode       = mov_text_decode_frame,
     .close        = mov_text_decode_close,
     .flush        = mov_text_flush,
+    .caps_internal  = FF_CODEC_CAP_INIT_THREADSAFE,
 };
diff --git a/libavcodec/mpl2dec.c b/libavcodec/mpl2dec.c
index 409e4b3708..d60528af32 100644
--- a/libavcodec/mpl2dec.c
+++ b/libavcodec/mpl2dec.c
@@ -27,6 +27,7 @@ 
 
 #include "avcodec.h"
 #include "ass.h"
+#include "internal.h"
 #include "libavutil/bprint.h"
 
 static int mpl2_event_to_ass(AVBPrint *buf, const char *p)
@@ -90,4 +91,5 @@  AVCodec ff_mpl2_decoder = {
     .init           = ff_ass_subtitle_header_default,
     .flush          = ff_ass_decoder_flush,
     .priv_data_size = sizeof(FFASSDecoderContext),
+    .caps_internal  = FF_CODEC_CAP_INIT_THREADSAFE,
 };
diff --git a/libavcodec/realtextdec.c b/libavcodec/realtextdec.c
index 5084781123..8581081c02 100644
--- a/libavcodec/realtextdec.c
+++ b/libavcodec/realtextdec.c
@@ -26,6 +26,7 @@ 
 
 #include "avcodec.h"
 #include "ass.h"
+#include "internal.h"
 #include "libavutil/avstring.h"
 #include "libavutil/bprint.h"
 
@@ -83,4 +84,5 @@  AVCodec ff_realtext_decoder = {
     .init           = ff_ass_subtitle_header_default,
     .flush          = ff_ass_decoder_flush,
     .priv_data_size = sizeof(FFASSDecoderContext),
+    .caps_internal  = FF_CODEC_CAP_INIT_THREADSAFE,
 };
diff --git a/libavcodec/samidec.c b/libavcodec/samidec.c
index e32f238c62..400a7642a2 100644
--- a/libavcodec/samidec.c
+++ b/libavcodec/samidec.c
@@ -28,6 +28,7 @@ 
 #include "libavutil/avstring.h"
 #include "libavutil/bprint.h"
 #include "htmlsubtitles.h"
+#include "internal.h"
 
 typedef struct {
     AVBPrint source;
@@ -190,4 +191,5 @@  AVCodec ff_sami_decoder = {
     .close          = sami_close,
     .decode         = sami_decode_frame,
     .flush          = sami_flush,
+    .caps_internal  = FF_CODEC_CAP_INIT_THREADSAFE,
 };
diff --git a/libavcodec/srtdec.c b/libavcodec/srtdec.c
index ecc0801595..8ee4e04934 100644
--- a/libavcodec/srtdec.c
+++ b/libavcodec/srtdec.c
@@ -26,6 +26,7 @@ 
 #include "avcodec.h"
 #include "ass.h"
 #include "htmlsubtitles.h"
+#include "internal.h"
 
 static int srt_to_ass(AVCodecContext *avctx, AVBPrint *dst,
                        const char *in, int x1, int y1, int x2, int y2)
@@ -96,6 +97,7 @@  AVCodec ff_srt_decoder = {
     .decode       = srt_decode_frame,
     .flush        = ff_ass_decoder_flush,
     .priv_data_size = sizeof(FFASSDecoderContext),
+    .caps_internal  = FF_CODEC_CAP_INIT_THREADSAFE,
 };
 #endif
 
@@ -109,5 +111,6 @@  AVCodec ff_subrip_decoder = {
     .decode       = srt_decode_frame,
     .flush        = ff_ass_decoder_flush,
     .priv_data_size = sizeof(FFASSDecoderContext),
+    .caps_internal  = FF_CODEC_CAP_INIT_THREADSAFE,
 };
 #endif
diff --git a/libavcodec/subviewerdec.c b/libavcodec/subviewerdec.c
index 805c7dd547..e5397a61f3 100644
--- a/libavcodec/subviewerdec.c
+++ b/libavcodec/subviewerdec.c
@@ -26,6 +26,7 @@ 
 
 #include "avcodec.h"
 #include "ass.h"
+#include "internal.h"
 #include "libavutil/bprint.h"
 
 static int subviewer_event_to_ass(AVBPrint *buf, const char *p)
@@ -74,4 +75,5 @@  AVCodec ff_subviewer_decoder = {
     .init           = ff_ass_subtitle_header_default,
     .flush          = ff_ass_decoder_flush,
     .priv_data_size = sizeof(FFASSDecoderContext),
+    .caps_internal  = FF_CODEC_CAP_INIT_THREADSAFE,
 };
diff --git a/libavcodec/textdec.c b/libavcodec/textdec.c
index 964da72ad5..24d0b7eea5 100644
--- a/libavcodec/textdec.c
+++ b/libavcodec/textdec.c
@@ -25,6 +25,7 @@ 
 
 #include "avcodec.h"
 #include "ass.h"
+#include "internal.h"
 #include "libavutil/bprint.h"
 #include "libavutil/opt.h"
 
@@ -91,6 +92,7 @@  AVCodec ff_text_decoder = {
     .init           = ff_ass_subtitle_header_default,
     .priv_class     = &text_decoder_class,
     .flush          = text_flush,
+    .caps_internal  = FF_CODEC_CAP_INIT_THREADSAFE,
 };
 #endif
 
@@ -117,6 +119,7 @@  AVCodec ff_vplayer_decoder = {
     .init           = linebreak_init,
     .priv_class     = &vplayer_decoder_class,
     .flush          = text_flush,
+    .caps_internal  = FF_CODEC_CAP_INIT_THREADSAFE,
 };
 #endif
 
@@ -134,6 +137,7 @@  AVCodec ff_stl_decoder = {
     .init           = linebreak_init,
     .priv_class     = &stl_decoder_class,
     .flush          = text_flush,
+    .caps_internal  = FF_CODEC_CAP_INIT_THREADSAFE,
 };
 #endif
 
@@ -151,6 +155,7 @@  AVCodec ff_pjs_decoder = {
     .init           = linebreak_init,
     .priv_class     = &pjs_decoder_class,
     .flush          = text_flush,
+    .caps_internal  = FF_CODEC_CAP_INIT_THREADSAFE,
 };
 #endif
 
@@ -168,6 +173,7 @@  AVCodec ff_subviewer1_decoder = {
     .init           = linebreak_init,
     .priv_class     = &subviewer1_decoder_class,
     .flush          = text_flush,
+    .caps_internal  = FF_CODEC_CAP_INIT_THREADSAFE,
 };
 #endif
 
diff --git a/libavcodec/webvttdec.c b/libavcodec/webvttdec.c
index 7b2d1750de..ca3b3f8e49 100644
--- a/libavcodec/webvttdec.c
+++ b/libavcodec/webvttdec.c
@@ -27,6 +27,7 @@ 
 
 #include "avcodec.h"
 #include "ass.h"
+#include "internal.h"
 #include "libavutil/bprint.h"
 
 static const struct {
@@ -107,4 +108,5 @@  AVCodec ff_webvtt_decoder = {
     .init           = ff_ass_subtitle_header_default,
     .flush          = ff_ass_decoder_flush,
     .priv_data_size = sizeof(FFASSDecoderContext),
+    .caps_internal  = FF_CODEC_CAP_INIT_THREADSAFE,
 };