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"

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
 
AVCodec ff_webvtt_encoder
 

Macro Definition Documentation

◆ WEBVTT_STACK_SIZE

#define WEBVTT_STACK_SIZE   64

Definition at line 30 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 52 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 60 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 67 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 76 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 81 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 93 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 112 of file webvttenc.c.

◆ webvtt_new_line_cb()

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

Definition at line 118 of file webvttenc.c.

◆ webvtt_style_cb()

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

Definition at line 123 of file webvttenc.c.

◆ webvtt_cancel_overrides_cb()

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

Definition at line 133 of file webvttenc.c.

◆ webvtt_end_cb()

static void webvtt_end_cb ( void *  priv)
static

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

◆ webvtt_encode_close()

static int webvtt_encode_close ( AVCodecContext avctx)
static

Definition at line 210 of file webvttenc.c.

◆ webvtt_encode_init()

static av_cold int webvtt_encode_init ( AVCodecContext avctx)
static

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

Referenced by webvtt_encode_frame().

◆ ff_webvtt_encoder

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,
}

Definition at line 227 of file webvttenc.c.

AVMEDIA_TYPE_SUBTITLE
@ AVMEDIA_TYPE_SUBTITLE
Definition: avutil.h:204
init
static av_cold int init(AVCodecContext *avctx)
Definition: avrndec.c:35
WebVTTContext
Definition: webvttenc.c:31
webvtt_encode_init
static av_cold int webvtt_encode_init(AVCodecContext *avctx)
Definition: webvttenc.c:218
AV_CODEC_ID_WEBVTT
@ AV_CODEC_ID_WEBVTT
Definition: avcodec.h:677
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:157
webvtt_text_cb
static void webvtt_text_cb(void *priv, const char *text, int len)
Definition: webvttenc.c:112
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:188
webvtt_cancel_overrides_cb
static void webvtt_cancel_overrides_cb(void *priv, const char *style)
Definition: webvttenc.c:133
webvtt_end_cb
static void webvtt_end_cb(void *priv)
Definition: webvttenc.c:139
webvtt_style_cb
static void webvtt_style_cb(void *priv, char style, int close)
Definition: webvttenc.c:123
webvtt_new_line_cb
static void webvtt_new_line_cb(void *priv, int forced)
Definition: webvttenc.c:118
webvtt_encode_close
static int webvtt_encode_close(AVCodecContext *avctx)
Definition: webvttenc.c:210