FFmpeg
Data Structures | Enumerations | Functions | Variables
ttmlenc.c File Reference
#include "libavutil/avstring.h"
#include "avformat.h"
#include "internal.h"
#include "mux.h"
#include "ttmlenc.h"
#include "libavcodec/ttmlenc.h"
#include "libavutil/internal.h"

Go to the source code of this file.

Data Structures

struct  TTMLHeaderParameters
 
struct  TTMLMuxContext
 

Enumerations

enum  TTMLPacketType { PACKET_TYPE_PARAGRAPH, PACKET_TYPE_DOCUMENT }
 

Functions

static void ttml_write_time (AVIOContext *pb, const char tag[], int64_t millisec)
 
static int ttml_set_header_values_from_extradata (AVCodecParameters *par, struct TTMLHeaderParameters *header_params)
 
static int ttml_write_header (AVFormatContext *ctx)
 
static int ttml_write_packet (AVFormatContext *ctx, AVPacket *pkt)
 
static int ttml_write_trailer (AVFormatContext *ctx)
 

Variables

static const char ttml_header_text []
 
static const char ttml_footer_text []
 
const FFOutputFormat ff_ttml_muxer
 

Detailed Description

TTML subtitle muxer

See also
https://www.w3.org/TR/ttml1/
https://www.w3.org/TR/ttml2/
https://www.w3.org/TR/ttml-imsc/rec

Definition in file ttmlenc.c.

Enumeration Type Documentation

◆ TTMLPacketType

Enumerator
PACKET_TYPE_PARAGRAPH 
PACKET_TYPE_DOCUMENT 

Definition at line 38 of file ttmlenc.c.

Function Documentation

◆ ttml_write_time()

static void ttml_write_time ( AVIOContext pb,
const char  tag[],
int64_t  millisec 
)
static

Definition at line 67 of file ttmlenc.c.

Referenced by ttml_write_packet().

◆ ttml_set_header_values_from_extradata()

static int ttml_set_header_values_from_extradata ( AVCodecParameters par,
struct TTMLHeaderParameters header_params 
)
static

Definition at line 82 of file ttmlenc.c.

Referenced by ttml_write_header().

◆ ttml_write_header()

static int ttml_write_header ( AVFormatContext ctx)
static

Definition at line 124 of file ttmlenc.c.

◆ ttml_write_packet()

static int ttml_write_packet ( AVFormatContext ctx,
AVPacket pkt 
)
static

Definition at line 161 of file ttmlenc.c.

◆ ttml_write_trailer()

static int ttml_write_trailer ( AVFormatContext ctx)
static

Definition at line 199 of file ttmlenc.c.

Variable Documentation

◆ ttml_header_text

const char ttml_header_text[]
static
Initial value:
=
"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"
"<tt\n"
"%s"
" xml:lang=\"%s\">\n"
"%s"
" <body>\n"
" <div>\n"

Definition at line 53 of file ttmlenc.c.

Referenced by ttml_write_header().

◆ ttml_footer_text

const char ttml_footer_text[]
static
Initial value:
=
" </div>\n"
" </body>\n"
"</tt>\n"

Definition at line 62 of file ttmlenc.c.

Referenced by ttml_write_trailer().

◆ ff_ttml_muxer

const FFOutputFormat ff_ttml_muxer
Initial value:
= {
.p.name = "ttml",
.p.long_name = NULL_IF_CONFIG_SMALL("TTML subtitle"),
.p.extensions = "ttml",
.p.mime_type = "text/ttml",
.priv_data_size = sizeof(TTMLMuxContext),
.p.video_codec = AV_CODEC_ID_NONE,
.p.audio_codec = AV_CODEC_ID_NONE,
.p.subtitle_codec = AV_CODEC_ID_TTML,
.flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH |
.write_header = ttml_write_header,
.write_packet = ttml_write_packet,
.write_trailer = ttml_write_trailer,
}

Definition at line 210 of file ttmlenc.c.

ttml_write_trailer
static int ttml_write_trailer(AVFormatContext *ctx)
Definition: ttmlenc.c:199
AVFMT_VARIABLE_FPS
#define AVFMT_VARIABLE_FPS
Format allows variable fps.
Definition: avformat.h:482
ttml_write_packet
static int ttml_write_packet(AVFormatContext *ctx, AVPacket *pkt)
Definition: ttmlenc.c:161
FF_OFMT_FLAG_ONLY_DEFAULT_CODECS
#define FF_OFMT_FLAG_ONLY_DEFAULT_CODECS
If this flag is set, then the only permitted audio/video/subtitle codec ids are AVOutputFormat....
Definition: mux.h:59
TTMLMuxContext
Definition: ttmlenc.c:48
ttml_write_header
static int ttml_write_header(AVFormatContext *ctx)
Definition: ttmlenc.c:124
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:106
AVFMT_GLOBALHEADER
#define AVFMT_GLOBALHEADER
Format wants global header.
Definition: avformat.h:478
AV_CODEC_ID_NONE
@ AV_CODEC_ID_NONE
Definition: codec_id.h:50
AV_CODEC_ID_TTML
@ AV_CODEC_ID_TTML
Definition: codec_id.h:573
FF_OFMT_FLAG_MAX_ONE_OF_EACH
#define FF_OFMT_FLAG_MAX_ONE_OF_EACH
If this flag is set, it indicates that for each codec type whose corresponding default codec (i....
Definition: mux.h:50
AVFMT_TS_NONSTRICT
#define AVFMT_TS_NONSTRICT
Format does not require strictly increasing timestamps, but they must still be monotonic.
Definition: avformat.h:491