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

#define WEBVTT_STACK_SIZE   64

Definition at line 30 of file webvttenc.c.

Referenced by webvtt_stack_push().

Function Documentation

static void webvtt_print ( WebVTTContext s,
const char *  str,
  ... 
)
static
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().

static char webvtt_stack_pop ( WebVTTContext s)
static

Definition at line 60 of file webvttenc.c.

Referenced by webvtt_stack_push_pop().

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().

static void webvtt_close_tag ( WebVTTContext s,
char  tag 
)
static

Definition at line 76 of file webvttenc.c.

Referenced by 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().

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().

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

Definition at line 112 of file webvttenc.c.

static void webvtt_new_line_cb ( void priv,
int  forced 
)
static

Definition at line 118 of file webvttenc.c.

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

Definition at line 123 of file webvttenc.c.

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

Definition at line 133 of file webvttenc.c.

static void webvtt_end_cb ( void priv)
static

Definition at line 139 of file webvttenc.c.

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

Definition at line 157 of file webvttenc.c.

static int webvtt_encode_close ( AVCodecContext avctx)
static

Definition at line 210 of file webvttenc.c.

static av_cold int webvtt_encode_init ( AVCodecContext avctx)
static

Definition at line 218 of file webvttenc.c.

Variable Documentation

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,
}
#define NULL
Definition: coverity.c:32
static void webvtt_style_cb(void *priv, char style, int close)
Definition: webvttenc.c:123
static void webvtt_cancel_overrides_cb(void *priv, const char *style)
Definition: webvttenc.c:133
static void webvtt_end_cb(void *priv)
Definition: webvttenc.c:139
static void webvtt_text_cb(void *priv, const char *text, int len)
Definition: webvttenc.c:112
static void webvtt_new_line_cb(void *priv, int forced)
Definition: webvttenc.c:118

Definition at line 144 of file webvttenc.c.

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,
}
static int webvtt_encode_frame(AVCodecContext *avctx, unsigned char *buf, int bufsize, const AVSubtitle *sub)
Definition: webvttenc.c:157
static av_cold int init(AVCodecContext *avctx)
Definition: avrndec.c:35
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
Definition: internal.h:186
static av_cold int webvtt_encode_init(AVCodecContext *avctx)
Definition: webvttenc.c:218
static int webvtt_encode_close(AVCodecContext *avctx)
Definition: webvttenc.c:210

Definition at line 227 of file webvttenc.c.