From patchwork Wed Dec 2 04:22:35 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 24312 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id 6408B44AAF6 for ; Wed, 2 Dec 2020 06:36:08 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 2569968A6CD; Wed, 2 Dec 2020 06:24:41 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-ed1-f51.google.com (mail-ed1-f51.google.com [209.85.208.51]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 7FC4868A606 for ; Wed, 2 Dec 2020 06:24:34 +0200 (EET) Received: by mail-ed1-f51.google.com with SMTP id c7so1176252edv.6 for ; Tue, 01 Dec 2020 20:24:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references:reply-to :mime-version:content-transfer-encoding; bh=YO855213A/43aLqj282MAxP5sAJejXtr1VEJP1JYsaM=; b=ELfdXhp9u4uKTnOzVeJRZzj+IYFgRNrBLLcCI1hOW58ILfPyfOk2Qx3pfVs/nsvLSV 6aC3gjtdnVh6P+FbmJHA7NDq63OYvx8gUsGebIZ6Y+DE9tZJHHuL6cmwnqkjFF44lFTg m5IA3PvWdJrOFv1Uv6amZioRkNsX2O4QB3R7akhIex7JJRM6ris9B4jOmHrLdB0Puiep xbHZmSJyk6C36sjSqkDdibnr/j8ZCH1SBGLzQR8BYIFdulsYNnUKr+PST9ezOE9W64md 8VTPtCYI1d1yByJgpiPt/XviJVP6oD0bR+a6yb65k5I1UIEk03f5VjdMe9aZB0SUEkG1 a0Bw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:reply-to:mime-version:content-transfer-encoding; bh=YO855213A/43aLqj282MAxP5sAJejXtr1VEJP1JYsaM=; b=JM2xtKFRFhqtAdHmybC3+pkaBGmfGqJ4Q6hqY2CB0Jw0VX1rX2UwQ7saIvxfxurFwE UG+1eSr4XW40bKW4hMf1LgBf3Y4PS8ptyVgDI4yzzeIvfnEq7ozKlLWdia6RDmJdPAXJ bkjBcduKRrSaJ/xNov7dzaBp5AjOIJvUhLYB3pIRIJW6GLvUyp6volSfMZ6Nt5gvxxLs RqgdC2aPlkOmh7Lb7QgzgX0X4EEj8uAU8/aWwfdIpOAhN430ga0/eIzrrT+N0uPhwSl0 Bdcmphoj/1KaSvgEzru9uOQBwVJ9CQHxfJ/Y2qFQJ9FLrZOg03akWdnaRQZgq5BrX7xV hDvg== X-Gm-Message-State: AOAM530bCiyi8EUZvx6OM3/OFWgZf9BfdIfAZ3t4rmysfZWuziWTUvfI DUDIxR5x6EbqOYqbNBT+caZ5CCNJI61p5g== X-Google-Smtp-Source: ABdhPJztCyM5xe0EwoqERmM9m9ANaX0rVfIm1STlFWC6qpY2LsvYm8zPxF88SboM0qtgQVs/fYkVYQ== X-Received: by 2002:a05:6402:21c7:: with SMTP id bi7mr900699edb.54.1606883073541; Tue, 01 Dec 2020 20:24:33 -0800 (PST) Received: from sblaptop.fritz.box (ipbcc1aa4b.dynamic.kabel-deutschland.de. [188.193.170.75]) by smtp.gmail.com with ESMTPSA id mc25sm265087ejb.58.2020.12.01.20.24.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Dec 2020 20:24:32 -0800 (PST) From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Wed, 2 Dec 2020 05:22:35 +0100 Message-Id: <20201202042244.519127-74-andreas.rheinhardt@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201127010249.2724610-1-andreas.rheinhardt@gmail.com> References: <20201127010249.2724610-1-andreas.rheinhardt@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 208/217] avcodec: Mark ff_ass_subtitle_header based decoders as init-threadsafe X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 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 Cc: Andreas Rheinhardt Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" ff_ass_subtitle_header_full() just uses av_asprintf() and is therefore thread-safe itself. Signed-off-by: Andreas Rheinhardt --- 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 --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 #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, };