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

Go to the source code of this file.

Data Structures

struct  WebVTTContext
 

Macros

#define WEBVTT_STACK_SIZE   64
 

Functions

static av_printf_format (2, 3)
 
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 FFCodec ff_webvtt_encoder
 

Macro Definition Documentation

◆ WEBVTT_STACK_SIZE

#define WEBVTT_STACK_SIZE   64

Definition at line 30 of file webvttenc.c.

Function Documentation

◆ av_printf_format()

static av_printf_format ( ,
 
)
static

Definition at line 41 of file webvttenc.c.

◆ webvtt_stack_push()

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

Definition at line 49 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 57 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 64 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 73 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 78 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 90 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 109 of file webvttenc.c.

◆ webvtt_new_line_cb()

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

Definition at line 115 of file webvttenc.c.

◆ webvtt_style_cb()

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

Definition at line 120 of file webvttenc.c.

◆ webvtt_cancel_overrides_cb()

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

Definition at line 130 of file webvttenc.c.

◆ webvtt_end_cb()

static void webvtt_end_cb ( void *  priv)
static

Definition at line 136 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 154 of file webvttenc.c.

◆ webvtt_encode_close()

static int webvtt_encode_close ( AVCodecContext avctx)
static

Definition at line 190 of file webvttenc.c.

◆ webvtt_encode_init()

static av_cold int webvtt_encode_init ( AVCodecContext avctx)
static

Definition at line 197 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 141 of file webvttenc.c.

Referenced by webvtt_encode_frame().

◆ ff_webvtt_encoder

const FFCodec ff_webvtt_encoder
Initial value:
= {
.p.name = "webvtt",
CODEC_LONG_NAME("WebVTT subtitle"),
.priv_data_size = sizeof(WebVTTContext),
}

Definition at line 205 of file webvttenc.c.

AVMEDIA_TYPE_SUBTITLE
@ AVMEDIA_TYPE_SUBTITLE
Definition: avutil.h:204
WebVTTContext
Definition: webvttenc.c:31
webvtt_encode_init
static av_cold int webvtt_encode_init(AVCodecContext *avctx)
Definition: webvttenc.c:197
CODEC_LONG_NAME
#define CODEC_LONG_NAME(str)
Definition: codec_internal.h:271
AV_CODEC_ID_WEBVTT
@ AV_CODEC_ID_WEBVTT
Definition: codec_id.h:568
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:154
FF_CODEC_ENCODE_SUB_CB
#define FF_CODEC_ENCODE_SUB_CB(func)
Definition: codec_internal.h:298
webvtt_text_cb
static void webvtt_text_cb(void *priv, const char *text, int len)
Definition: webvttenc.c:109
init
int(* init)(AVBSFContext *ctx)
Definition: dts2pts.c:366
webvtt_cancel_overrides_cb
static void webvtt_cancel_overrides_cb(void *priv, const char *style)
Definition: webvttenc.c:130
webvtt_end_cb
static void webvtt_end_cb(void *priv)
Definition: webvttenc.c:136
webvtt_style_cb
static void webvtt_style_cb(void *priv, char style, int close)
Definition: webvttenc.c:120
webvtt_new_line_cb
static void webvtt_new_line_cb(void *priv, int forced)
Definition: webvttenc.c:115
webvtt_encode_close
static int webvtt_encode_close(AVCodecContext *avctx)
Definition: webvttenc.c:190