[FFmpeg-devel] [PATCH v4 11/18] avfilter/subtitles: adjust for recent changes
Soft Works
softworkz at hotmail.com
Sat Sep 11 11:29:00 EEST 2021
- use new function av_get_subtitle_format_from_codecdesc
- change error message
- remove obsolete 'sub_text_format' parameter
Signed-off-by: softworkz <softworkz at hotmail.com>
---
libavfilter/vf_subtitles.c | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
diff --git a/libavfilter/vf_subtitles.c b/libavfilter/vf_subtitles.c
index d0bafcd3cf..200fb18165 100644
--- a/libavfilter/vf_subtitles.c
+++ b/libavfilter/vf_subtitles.c
@@ -35,14 +35,12 @@
# include "libavformat/avformat.h"
#endif
#include "libavutil/avstring.h"
-#include "libavutil/imgutils.h"
#include "libavutil/opt.h"
#include "libavutil/parseutils.h"
#include "drawutils.h"
#include "avfilter.h"
#include "internal.h"
#include "formats.h"
-#include "video.h"
typedef struct AssContext {
const AVClass *class;
@@ -306,6 +304,7 @@ static av_cold int init_subtitles(AVFilterContext *ctx)
AVStream *st;
AVPacket pkt;
AssContext *ass = ctx->priv;
+ enum AVSubtitleType subtitle_format;
/* Init libass */
ret = init(ctx);
@@ -386,16 +385,19 @@ static av_cold int init_subtitles(AVFilterContext *ctx)
ret = AVERROR_DECODER_NOT_FOUND;
goto end;
}
+
dec_desc = avcodec_descriptor_get(st->codecpar->codec_id);
- if (dec_desc && !(dec_desc->props & AV_CODEC_PROP_TEXT_SUB)) {
+ subtitle_format = av_get_subtitle_format_from_codecdesc(dec_desc);
+
+ if (subtitle_format != AV_SUBTITLE_FMT_ASS) {
av_log(ctx, AV_LOG_ERROR,
- "Only text based subtitles are currently supported\n");
- ret = AVERROR_PATCHWELCOME;
+ "Only text based subtitles are supported by this filter\n");
+ ret = AVERROR_INVALIDDATA;
goto end;
}
+
if (ass->charenc)
av_dict_set(&codec_opts, "sub_charenc", ass->charenc, 0);
- av_dict_set(&codec_opts, "sub_text_format", "ass", 0);
dec_ctx = avcodec_alloc_context3(dec);
if (!dec_ctx) {
--
2.30.2.windows.1
More information about the ffmpeg-devel
mailing list