FFmpeg
Data Structures | Macros | Functions | Variables
srtenc.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  SRTContext
 

Macros

#define SRT_STACK_SIZE   64
 

Functions

static void srt_print (SRTContext *s, const char *str,...)
 
static int srt_stack_push (SRTContext *s, const char c)
 
static char srt_stack_pop (SRTContext *s)
 
static int srt_stack_find (SRTContext *s, const char c)
 
static void srt_close_tag (SRTContext *s, char tag)
 
static void srt_stack_push_pop (SRTContext *s, const char c, int close)
 
static void srt_style_apply (SRTContext *s, const char *style)
 
static av_cold int srt_encode_init (AVCodecContext *avctx)
 
static void srt_text_cb (void *priv, const char *text, int len)
 
static void srt_new_line_cb (void *priv, int forced)
 
static void srt_style_cb (void *priv, char style, int close)
 
static void srt_color_cb (void *priv, unsigned int color, unsigned int color_id)
 
static void srt_font_name_cb (void *priv, const char *name)
 
static void srt_font_size_cb (void *priv, int size)
 
static void srt_alignment_cb (void *priv, int alignment)
 
static void srt_cancel_overrides_cb (void *priv, const char *style)
 
static void srt_move_cb (void *priv, int x1, int y1, int x2, int y2, int t1, int t2)
 
static void srt_end_cb (void *priv)
 
static int encode_frame (AVCodecContext *avctx, unsigned char *buf, int bufsize, const AVSubtitle *sub, const ASSCodesCallbacks *cb)
 
static int srt_encode_frame (AVCodecContext *avctx, unsigned char *buf, int bufsize, const AVSubtitle *sub)
 
static int text_encode_frame (AVCodecContext *avctx, unsigned char *buf, int bufsize, const AVSubtitle *sub)
 
static int srt_encode_close (AVCodecContext *avctx)
 

Variables

static const ASSCodesCallbacks srt_callbacks
 
static const ASSCodesCallbacks text_callbacks
 

Macro Definition Documentation

◆ SRT_STACK_SIZE

#define SRT_STACK_SIZE   64

Definition at line 31 of file srtenc.c.

Function Documentation

◆ srt_print()

static void srt_print ( SRTContext s,
const char *  str,
  ... 
)
static

◆ srt_stack_push()

static int srt_stack_push ( SRTContext s,
const char  c 
)
static

Definition at line 54 of file srtenc.c.

Referenced by srt_stack_push_pop(), and srt_style_apply().

◆ srt_stack_pop()

static char srt_stack_pop ( SRTContext s)
static

Definition at line 62 of file srtenc.c.

Referenced by srt_stack_push_pop().

◆ srt_stack_find()

static int srt_stack_find ( SRTContext s,
const char  c 
)
static

Definition at line 69 of file srtenc.c.

Referenced by srt_stack_push_pop().

◆ srt_close_tag()

static void srt_close_tag ( SRTContext s,
char  tag 
)
static

Definition at line 78 of file srtenc.c.

Referenced by srt_stack_push_pop().

◆ srt_stack_push_pop()

static void srt_stack_push_pop ( SRTContext s,
const char  c,
int  close 
)
static

◆ srt_style_apply()

static void srt_style_apply ( SRTContext s,
const char *  style 
)
static

Definition at line 95 of file srtenc.c.

Referenced by encode_frame(), and srt_cancel_overrides_cb().

◆ srt_encode_init()

static av_cold int srt_encode_init ( AVCodecContext avctx)
static

Definition at line 134 of file srtenc.c.

◆ srt_text_cb()

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

Definition at line 143 of file srtenc.c.

◆ srt_new_line_cb()

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

Definition at line 149 of file srtenc.c.

◆ srt_style_cb()

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

Definition at line 154 of file srtenc.c.

◆ srt_color_cb()

static void srt_color_cb ( void *  priv,
unsigned int  color,
unsigned int  color_id 
)
static

Definition at line 161 of file srtenc.c.

◆ srt_font_name_cb()

static void srt_font_name_cb ( void *  priv,
const char *  name 
)
static

Definition at line 171 of file srtenc.c.

◆ srt_font_size_cb()

static void srt_font_size_cb ( void *  priv,
int  size 
)
static

Definition at line 178 of file srtenc.c.

◆ srt_alignment_cb()

static void srt_alignment_cb ( void *  priv,
int  alignment 
)
static

Definition at line 185 of file srtenc.c.

◆ srt_cancel_overrides_cb()

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

Definition at line 194 of file srtenc.c.

◆ srt_move_cb()

static void srt_move_cb ( void *  priv,
int  x1,
int  y1,
int  x2,
int  y2,
int  t1,
int  t2 
)
static

Definition at line 200 of file srtenc.c.

◆ srt_end_cb()

static void srt_end_cb ( void *  priv)
static

Definition at line 207 of file srtenc.c.

◆ encode_frame()

static int encode_frame ( AVCodecContext avctx,
unsigned char *  buf,
int  bufsize,
const AVSubtitle sub,
const ASSCodesCallbacks cb 
)
static

Definition at line 230 of file srtenc.c.

Referenced by srt_encode_frame(), and text_encode_frame().

◆ srt_encode_frame()

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

Definition at line 272 of file srtenc.c.

◆ text_encode_frame()

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

Definition at line 278 of file srtenc.c.

◆ srt_encode_close()

static int srt_encode_close ( AVCodecContext avctx)
static

Definition at line 284 of file srtenc.c.

Variable Documentation

◆ srt_callbacks

const ASSCodesCallbacks srt_callbacks
static
Initial value:
= {
.text = srt_text_cb,
.new_line = srt_new_line_cb,
.style = srt_style_cb,
.color = srt_color_cb,
.font_name = srt_font_name_cb,
.font_size = srt_font_size_cb,
.alignment = srt_alignment_cb,
.cancel_overrides = srt_cancel_overrides_cb,
.move = srt_move_cb,
.end = srt_end_cb,
}

Definition at line 212 of file srtenc.c.

Referenced by srt_encode_frame().

◆ text_callbacks

const ASSCodesCallbacks text_callbacks
static
Initial value:
= {
.text = srt_text_cb,
.new_line = srt_new_line_cb,
}

Definition at line 225 of file srtenc.c.

Referenced by text_encode_frame().

srt_new_line_cb
static void srt_new_line_cb(void *priv, int forced)
Definition: srtenc.c:149
srt_alignment_cb
static void srt_alignment_cb(void *priv, int alignment)
Definition: srtenc.c:185
srt_font_size_cb
static void srt_font_size_cb(void *priv, int size)
Definition: srtenc.c:178
srt_cancel_overrides_cb
static void srt_cancel_overrides_cb(void *priv, const char *style)
Definition: srtenc.c:194
srt_move_cb
static void srt_move_cb(void *priv, int x1, int y1, int x2, int y2, int t1, int t2)
Definition: srtenc.c:200
srt_color_cb
static void srt_color_cb(void *priv, unsigned int color, unsigned int color_id)
Definition: srtenc.c:161
srt_end_cb
static void srt_end_cb(void *priv)
Definition: srtenc.c:207
srt_style_cb
static void srt_style_cb(void *priv, char style, int close)
Definition: srtenc.c:154
srt_text_cb
static void srt_text_cb(void *priv, const char *text, int len)
Definition: srtenc.c:143
srt_font_name_cb
static void srt_font_name_cb(void *priv, const char *name)
Definition: srtenc.c:171