FFmpeg
Loading...
Searching...
No Matches
vf_subtitles.c File Reference

Libass subtitles burning filter. More...

#include <ass/ass.h>
#include "config_components.h"
#include "libavutil/avstring.h"
#include "libavutil/mem.h"
#include "libavutil/opt.h"
#include "filters.h"
#include "drawutils.h"
#include "avfilter.h"
#include "formats.h"
#include "video.h"

Go to the source code of this file.

Data Structures

struct  AssContext
 

Macros

#define FF_ASS_FEATURE_WRAP_UNICODE   (LIBASS_VERSION >= 0x01600010)
 
#define OFFSET(x)
 
#define FLAGS   AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM
 
#define COMMON_OPTIONS
 
#define SHAPING_OPTIONS
 
#define AR(c)
 
#define AG(c)
 
#define AB(c)
 
#define AA(c)
 

Functions

static enum AVColorSpace ass_get_color_space (ASS_YCbCrMatrix ass_matrix, enum AVColorSpace inlink_space)
 
static enum AVColorRange ass_get_color_range (ASS_YCbCrMatrix ass_matrix, enum AVColorRange inlink_range)
 
static void ass_log (int ass_level, const char *fmt, va_list args, void *ctx)
 
static av_cold int init (AVFilterContext *ctx)
 
static av_cold void uninit (AVFilterContext *ctx)
 
static int query_formats (const AVFilterContext *ctx, AVFilterFormatsConfig **cfg_in, AVFilterFormatsConfig **cfg_out)
 
static int config_input (AVFilterLink *inlink)
 
static void overlay_ass_image (AssContext *ass, AVFrame *picref, const ASS_Image *image)
 
static int filter_frame (AVFilterLink *inlink, AVFrame *picref)
 

Variables

static const int ass_libavfilter_log_level_map []
 
static const AVFilterPad ass_inputs []
 

Detailed Description

Libass subtitles burning filter.

See also
{http://www.matroska.org/technical/specs/subtitles/ssa.html}

Definition in file vf_subtitles.c.

Macro Definition Documentation

◆ FF_ASS_FEATURE_WRAP_UNICODE

#define FF_ASS_FEATURE_WRAP_UNICODE   (LIBASS_VERSION >= 0x01600010)

Definition at line 48 of file vf_subtitles.c.

◆ OFFSET

#define OFFSET ( x)
Value:
offsetof(AssContext, x)

Definition at line 69 of file vf_subtitles.c.

◆ FLAGS

Definition at line 70 of file vf_subtitles.c.

◆ COMMON_OPTIONS

#define COMMON_OPTIONS
Value:
{"filename", "set the filename of file to read", OFFSET(filename), AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0, FLAGS }, \
{"f", "set the filename of file to read", OFFSET(filename), AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0, FLAGS }, \
{"original_size", "set the size of the original video (used to scale fonts)", OFFSET(original_w), AV_OPT_TYPE_IMAGE_SIZE, {.str = NULL}, 0, 0, FLAGS }, \
{"fontsdir", "set the directory containing the fonts to read", OFFSET(fontsdir), AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0, FLAGS }, \
{"alpha", "enable processing of alpha channel", OFFSET(alpha), AV_OPT_TYPE_BOOL, {.i64 = 0 }, 0, 1, FLAGS }, \
#define FLAGS
Definition cmdutils.c:598
#define NULL
Definition coverity.c:32
#define OFFSET(x)
@ AV_OPT_TYPE_IMAGE_SIZE
Underlying C type is two consecutive integers.
Definition opt.h:302
@ AV_OPT_TYPE_BOOL
Underlying C type is int.
Definition opt.h:326
@ AV_OPT_TYPE_STRING
Underlying C type is a uint8_t* that is either NULL or points to a C string allocated with the av_mal...
Definition opt.h:275
static const int16_t alpha[]
Definition ilbcdata.h:55

Definition at line 72 of file vf_subtitles.c.

◆ SHAPING_OPTIONS

#define SHAPING_OPTIONS
Value:
{"shaping", "set shaping engine", OFFSET(shaping), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, 1, FLAGS, .unit = "shaping_mode"}, \
{"auto", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = -1}, INT_MIN, INT_MAX, FLAGS, .unit = "shaping_mode"}, \
{"simple", "simple shaping", 0, AV_OPT_TYPE_CONST, {.i64 = ASS_SHAPING_SIMPLE}, INT_MIN, INT_MAX, FLAGS, .unit = "shaping_mode"}, \
{"complex", "complex shaping", 0, AV_OPT_TYPE_CONST, {.i64 = ASS_SHAPING_COMPLEX}, INT_MIN, INT_MAX, FLAGS, .unit = "shaping_mode"}, \
@ AV_OPT_TYPE_CONST
Special option type for declaring named constants.
Definition opt.h:298
@ AV_OPT_TYPE_INT
Underlying C type is int.
Definition opt.h:258

Definition at line 79 of file vf_subtitles.c.

◆ AR

#define AR ( c)
Value:
( (c)>>24)
static double c[64]

Definition at line 219 of file vf_subtitles.c.

Referenced by overlay_ass_image().

◆ AG

#define AG ( c)
Value:
(((c)>>16)&0xFF)

Definition at line 220 of file vf_subtitles.c.

Referenced by overlay_ass_image().

◆ AB

#define AB ( c)
Value:
(((c)>>8) &0xFF)

Definition at line 221 of file vf_subtitles.c.

Referenced by overlay_ass_image().

◆ AA

#define AA ( c)
Value:
((0xFF-(c)) &0xFF)

Definition at line 222 of file vf_subtitles.c.

Referenced by overlay_ass_image().

Function Documentation

◆ ass_get_color_space()

static enum AVColorSpace ass_get_color_space ( ASS_YCbCrMatrix ass_matrix,
enum AVColorSpace inlink_space )
static

Definition at line 97 of file vf_subtitles.c.

Referenced by config_input().

◆ ass_get_color_range()

static enum AVColorRange ass_get_color_range ( ASS_YCbCrMatrix ass_matrix,
enum AVColorRange inlink_range )
static

Definition at line 114 of file vf_subtitles.c.

Referenced by config_input().

◆ ass_log()

static void ass_log ( int ass_level,
const char * fmt,
va_list args,
void * ctx )
static

Definition at line 131 of file vf_subtitles.c.

Referenced by init().

◆ init()

static av_cold int init ( AVFilterContext * ctx)
static

Definition at line 141 of file vf_subtitles.c.

◆ uninit()

static av_cold void uninit ( AVFilterContext * ctx)
static

Definition at line 169 of file vf_subtitles.c.

◆ query_formats()

static int query_formats ( const AVFilterContext * ctx,
AVFilterFormatsConfig ** cfg_in,
AVFilterFormatsConfig ** cfg_out )
static

Definition at line 181 of file vf_subtitles.c.

◆ config_input()

static int config_input ( AVFilterLink * inlink)
static

Definition at line 189 of file vf_subtitles.c.

◆ overlay_ass_image()

static void overlay_ass_image ( AssContext * ass,
AVFrame * picref,
const ASS_Image * image )
static

Definition at line 224 of file vf_subtitles.c.

Referenced by filter_frame().

◆ filter_frame()

static int filter_frame ( AVFilterLink * inlink,
AVFrame * picref )
static

Definition at line 239 of file vf_subtitles.c.

Variable Documentation

◆ ass_libavfilter_log_level_map

const int ass_libavfilter_log_level_map[]
static
Initial value:
= {
[0] = AV_LOG_FATAL,
[1] = AV_LOG_ERROR,
[4] = AV_LOG_INFO,
[5] = AV_LOG_INFO,
[7] = AV_LOG_DEBUG,
}
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
Definition log.h:231
#define AV_LOG_WARNING
Something somehow does not look correct.
Definition log.h:216
#define AV_LOG_FATAL
Something went wrong and recovery is not possible.
Definition log.h:204
#define AV_LOG_VERBOSE
Detailed information.
Definition log.h:226
#define AV_LOG_INFO
Standard information.
Definition log.h:221
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition log.h:210

Definition at line 86 of file vf_subtitles.c.

Referenced by ass_log().

◆ ass_inputs

const AVFilterPad ass_inputs[]
static
Initial value:
= {
{
.name = "default",
.filter_frame = filter_frame,
.config_props = config_input,
},
}
static int config_input(AVFilterLink *inlink)
static int filter_frame(DBEDecodeContext *s, AVFrame *frame)
Definition dolby_e.c:1067
@ AVMEDIA_TYPE_VIDEO
Definition avutil.h:200
#define AVFILTERPAD_FLAG_NEEDS_WRITABLE
The filter expects writable frames from its input link, duplicating data buffers if needed.
Definition filters.h:59

Definition at line 257 of file vf_subtitles.c.