FFmpeg
Data Structures | Macros | Functions | Variables
webvttenc.c File Reference
#include <stdarg.h>
#include "avcodec.h"
#include "libavutil/avstring.h"
#include "libavutil/bprint.h"
#include "ass_split.h"
#include "ass.h"
#include "internal.h"

Go to the source code of this file.

Data Structures

struct  WebVTTContext
 

Macros

#define WEBVTT_STACK_SIZE   64
 

Functions

static void webvtt_print (WebVTTContext *s, const char *str,...)
 
static int webvtt_stack_push (WebVTTContext *s, const char c)
 
static char webvtt_stack_pop (WebVTTContext *s)
 
static int webvtt_stack_find (WebVTTContext *s, const char c)
 
static void webvtt_close_tag (WebVTTContext *s, char tag)
 
static void webvtt_stack_push_pop (WebVTTContext *s, const char c, int close)
 
static void webvtt_style_apply (WebVTTContext *s, const char *style)
 
static void webvtt_text_cb (void *priv, const char *text, int len)
 
static void webvtt_new_line_cb (void *priv, int forced)
 
static void webvtt_style_cb (void *priv, char style, int close)
 
static void webvtt_cancel_overrides_cb (void *priv, const char *style)
 
static void webvtt_end_cb (void *priv)
 
static int webvtt_encode_frame (AVCodecContext *avctx, unsigned char *buf, int bufsize, const AVSubtitle *sub)
 
static int webvtt_encode_close (AVCodecContext *avctx)
 
static av_cold int webvtt_encode_init (AVCodecContext *avctx)
 

Variables

static const ASSCodesCallbacks webvtt_callbacks
 
const AVCodec ff_webvtt_encoder
 

Macro Definition Documentation

◆ WEBVTT_STACK_SIZE

#define WEBVTT_STACK_SIZE   64

Definition at line 31 of file webvttenc.c.

Function Documentation

◆ webvtt_print()

static void webvtt_print ( WebVTTContext s,
const char *  str,
  ... 
)
static

◆ webvtt_stack_push()

static int webvtt_stack_push ( WebVTTContext s,
const char  c 
)
static

Definition at line 53 of file webvttenc.c.

Referenced by webvtt_stack_push_pop(), and webvtt_style_apply().

◆ webvtt_stack_pop()

static char webvtt_stack_pop ( WebVTTContext s)
static

Definition at line 61 of file webvttenc.c.

Referenced by webvtt_stack_push_pop().

◆ webvtt_stack_find()

static int webvtt_stack_find ( WebVTTContext s,
const char  c 
)
static

Definition at line 68 of file webvttenc.c.

Referenced by webvtt_stack_push_pop().

◆ webvtt_close_tag()

static void webvtt_close_tag ( WebVTTContext s,
char  tag 
)
static

Definition at line 77 of file webvttenc.c.

Referenced by webvtt_stack_push_pop().

◆ webvtt_stack_push_pop()

static void webvtt_stack_push_pop ( WebVTTContext s,
const char  c,
int  close 
)
static

Definition at line 82 of file webvttenc.c.

Referenced by webvtt_cancel_overrides_cb(), webvtt_end_cb(), and webvtt_style_cb().

◆ webvtt_style_apply()

static void webvtt_style_apply ( WebVTTContext s,
const char *  style 
)
static

Definition at line 94 of file webvttenc.c.

Referenced by webvtt_cancel_overrides_cb(), and webvtt_encode_frame().

◆ webvtt_text_cb()

static void webvtt_text_cb ( void *  priv,
const char *  text,
int  len 
)
static

Definition at line 113 of file webvttenc.c.

◆ webvtt_new_line_cb()

static void webvtt_new_line_cb ( void *  priv,
int  forced 
)
static

Definition at line 119 of file webvttenc.c.

◆ webvtt_style_cb()

static void webvtt_style_cb ( void *  priv,
char  style,
int  close 
)
static

Definition at line 124 of file webvttenc.c.

◆ webvtt_cancel_overrides_cb()

static void webvtt_cancel_overrides_cb ( void *  priv,
const char *  style 
)
static

Definition at line 134 of file webvttenc.c.

◆ webvtt_end_cb()

static void webvtt_end_cb ( void *  priv)
static

Definition at line 140 of file webvttenc.c.

◆ webvtt_encode_frame()

static int webvtt_encode_frame ( AVCodecContext avctx,
unsigned char *  buf,
int  bufsize,
const AVSubtitle sub 
)
static

Definition at line 158 of file webvttenc.c.

◆ webvtt_encode_close()

static int webvtt_encode_close ( AVCodecContext avctx)
static

Definition at line 197 of file webvttenc.c.

◆ webvtt_encode_init()

static av_cold int webvtt_encode_init ( AVCodecContext avctx)
static

Definition at line 205 of file webvttenc.c.

Variable Documentation

◆ webvtt_callbacks

const ASSCodesCallbacks webvtt_callbacks
static
Initial value:
= {
.text = webvtt_text_cb,
.new_line = webvtt_new_line_cb,
.style = webvtt_style_cb,
.color = NULL,
.font_name = NULL,
.font_size = NULL,
.alignment = NULL,
.cancel_overrides = webvtt_cancel_overrides_cb,
.move = NULL,
.end = webvtt_end_cb,
}

Definition at line 145 of file webvttenc.c.

Referenced by webvtt_encode_frame().

◆ ff_webvtt_encoder

const AVCodec ff_webvtt_encoder
Initial value:
= {
.name = "webvtt",
.long_name = NULL_IF_CONFIG_SMALL("WebVTT subtitle"),
.priv_data_size = sizeof(WebVTTContext),
.encode_sub = webvtt_encode_frame,
.caps_internal = FF_CODEC_CAP_INIT_THREADSAFE,
}

Definition at line 214 of file webvttenc.c.

AVMEDIA_TYPE_SUBTITLE
@ AVMEDIA_TYPE_SUBTITLE
Definition: avutil.h:204
FF_CODEC_CAP_INIT_THREADSAFE
#define FF_CODEC_CAP_INIT_THREADSAFE
The codec does not modify any global variables in the init function, allowing to call the init functi...
Definition: internal.h:41
init
static av_cold int init(AVCodecContext *avctx)
Definition: avrndec.c:31
WebVTTContext
Definition: webvttenc.c:32
webvtt_encode_init
static av_cold int webvtt_encode_init(AVCodecContext *avctx)
Definition: webvttenc.c:205
AV_CODEC_ID_WEBVTT
@ AV_CODEC_ID_WEBVTT
Definition: codec_id.h:537
NULL
#define NULL
Definition: coverity.c:32
webvtt_encode_frame
static int webvtt_encode_frame(AVCodecContext *avctx, unsigned char *buf, int bufsize, const AVSubtitle *sub)
Definition: webvttenc.c:158
webvtt_text_cb
static void webvtt_text_cb(void *priv, const char *text, int len)
Definition: webvttenc.c:113
NULL_IF_CONFIG_SMALL
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
Definition: internal.h:117
webvtt_cancel_overrides_cb
static void webvtt_cancel_overrides_cb(void *priv, const char *style)
Definition: webvttenc.c:134
webvtt_end_cb
static void webvtt_end_cb(void *priv)
Definition: webvttenc.c:140
webvtt_style_cb
static void webvtt_style_cb(void *priv, char style, int close)
Definition: webvttenc.c:124
webvtt_new_line_cb
static void webvtt_new_line_cb(void *priv, int forced)
Definition: webvttenc.c:119
webvtt_encode_close
static int webvtt_encode_close(AVCodecContext *avctx)
Definition: webvttenc.c:197