FFmpeg
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Typedefs | Enumerations | Functions | Variables
ass_split.c File Reference
#include "avcodec.h"
#include "ass_split.h"

Go to the source code of this file.

Data Structures

struct  ASSFields
 
struct  ASSSection
 
struct  ASSSplitContext
 This struct can be casted to ASS to access to the split data. More...
 

Typedefs

typedef int(* ASSConvertFunc )(void *dest, const char *buf, int len)
 

Enumerations

enum  ASSFieldType {
  ASS_STR, ASS_INT, ASS_FLT, ASS_COLOR,
  ASS_TIMESTAMP, ASS_ALGN
}
 

Functions

static int convert_str (void *dest, const char *buf, int len)
 
static int convert_int (void *dest, const char *buf, int len)
 
static int convert_flt (void *dest, const char *buf, int len)
 
static int convert_color (void *dest, const char *buf, int len)
 
static int convert_timestamp (void *dest, const char *buf, int len)
 
static int convert_alignment (void *dest, const char *buf, int len)
 
static uint8_trealloc_section_array (ASSSplitContext *ctx)
 
static int is_eol (char buf)
 
static const char * skip_space (const char *buf)
 
static const char * ass_split_section (ASSSplitContext *ctx, const char *buf)
 
static int ass_split (ASSSplitContext *ctx, const char *buf)
 
ASSSplitContextff_ass_split (const char *buf)
 Split a full ASS file or a ASS header from a string buffer and store the split structure in a newly allocated context.
 
static void free_section (ASSSplitContext *ctx, const ASSSection *section)
 
ASSDialogff_ass_split_dialog (ASSSplitContext *ctx, const char *buf, int cache, int *number)
 Split one or several ASS "Dialogue" lines from a string buffer and store them in a already initialized context.
 
void ff_ass_split_free (ASSSplitContext *ctx)
 Free all the memory allocated for an ASSSplitContext.
 
int ff_ass_split_override_codes (const ASSCodesCallbacks *callbacks, void *priv, const char *buf)
 Split override codes out of a ASS "Dialogue" Text field.
 
ASSStyleff_ass_style_get (ASSSplitContext *ctx, const char *style)
 Find an ASSStyle structure by its name.
 

Variables

static const ASSSection ass_sections []
 
static const ASSConvertFunc convert_func []
 

Typedef Documentation

typedef int(* ASSConvertFunc)(void *dest, const char *buf, int len)

Definition at line 113 of file ass_split.c.

Enumeration Type Documentation

Enumerator:
ASS_STR 
ASS_INT 
ASS_FLT 
ASS_COLOR 
ASS_TIMESTAMP 
ASS_ALGN 

Definition at line 25 of file ass_split.c.

Function Documentation

static int convert_str ( void dest,
const char *  buf,
int  len 
)
static

Definition at line 115 of file ass_split.c.

static int convert_int ( void dest,
const char *  buf,
int  len 
)
static

Definition at line 127 of file ass_split.c.

static int convert_flt ( void dest,
const char *  buf,
int  len 
)
static

Definition at line 131 of file ass_split.c.

static int convert_color ( void dest,
const char *  buf,
int  len 
)
static

Definition at line 135 of file ass_split.c.

static int convert_timestamp ( void dest,
const char *  buf,
int  len 
)
static

Definition at line 140 of file ass_split.c.

static int convert_alignment ( void dest,
const char *  buf,
int  len 
)
static

Definition at line 147 of file ass_split.c.

static uint8_t* realloc_section_array ( ASSSplitContext ctx)
static

Definition at line 176 of file ass_split.c.

Referenced by ass_split_section().

static int is_eol ( char  buf)
inlinestatic

Definition at line 191 of file ass_split.c.

Referenced by ass_split_section().

static const char* skip_space ( const char *  buf)
inlinestatic

Definition at line 196 of file ass_split.c.

Referenced by ass_split_section().

static const char* ass_split_section ( ASSSplitContext ctx,
const char *  buf 
)
static

Definition at line 203 of file ass_split.c.

Referenced by ass_split().

static int ass_split ( ASSSplitContext ctx,
const char *  buf 
)
static

Definition at line 278 of file ass_split.c.

Referenced by ff_ass_split(), and ff_ass_split_dialog().

ASSSplitContext* ff_ass_split ( const char *  buf)

Split a full ASS file or a ASS header from a string buffer and store the split structure in a newly allocated context.

Parameters
bufString containing the ASS formated data.
Returns
Newly allocated struct containing split data.

Definition at line 303 of file ass_split.c.

Referenced by ass_decode_init(), mov_text_encode_init(), and srt_encode_init().

static void free_section ( ASSSplitContext ctx,
const ASSSection section 
)
static

Definition at line 314 of file ass_split.c.

Referenced by ff_ass_split_dialog(), and ff_ass_split_free().

ASSDialog* ff_ass_split_dialog ( ASSSplitContext ctx,
const char *  buf,
int  cache,
int *  number 
)

Split one or several ASS "Dialogue" lines from a string buffer and store them in a already initialized context.

Parameters
ctxContext previously initialized by ff_ass_split().
bufString containing the ASS "Dialogue" lines.
cacheSet to 1 to keep all the previously split ASSDialog in the context, or set to 0 to free all the previously split ASSDialog.
numberIf not NULL, the pointed integer will be set to the number of split ASSDialog.
Returns
Pointer to the first split ASSDialog.

Definition at line 338 of file ass_split.c.

Referenced by ass_decode_frame(), mov_text_encode_frame(), and srt_encode_frame().

void ff_ass_split_free ( ASSSplitContext ctx)

Free all the memory allocated for an ASSSplitContext.

Parameters
ctxContext previously initialized by ff_ass_split().

Definition at line 357 of file ass_split.c.

Referenced by ass_decode_close(), ff_ass_split(), mov_text_encode_close(), and srt_encode_close().

int ff_ass_split_override_codes ( const ASSCodesCallbacks callbacks,
void priv,
const char *  buf 
)

Split override codes out of a ASS "Dialogue" Text field.

Parameters
callbacksSet of callback functions called for each override code encountered.
privOpaque pointer passed to the callback functions.
bufThe ASS "Dialogue" Text field to split.
Returns
>= 0 on success otherwise an error code <0

Definition at line 370 of file ass_split.c.

Referenced by mov_text_encode_frame(), and srt_encode_frame().

ASSStyle* ff_ass_style_get ( ASSSplitContext ctx,
const char *  style 
)

Find an ASSStyle structure by its name.

Parameters
ctxContext previously initialized by ff_ass_split().
stylename of the style to search for.
Returns
the ASSStyle corresponding to style, or NULL if style can't be found

Definition at line 465 of file ass_split.c.

Referenced by srt_style_apply().

Variable Documentation

const ASSSection ass_sections[]
static

Definition at line 50 of file ass_split.c.

const ASSConvertFunc convert_func[]
static