FFmpeg
Data Structures | Macros | Functions | Variables
tedcaptionsdec.c File Reference
#include "libavutil/bprint.h"
#include "libavutil/log.h"
#include "libavutil/opt.h"
#include "avformat.h"
#include "demux.h"
#include "internal.h"
#include "subtitles.h"

Go to the source code of this file.

Data Structures

struct  TEDCaptionsDemuxer
 

Macros

#define BETWEEN(a, amin, amax)   ((unsigned)((a) - (amin)) <= (amax) - (amin))
 
#define HEX_DIGIT_TEST(c)   (BETWEEN(c, '0', '9') || BETWEEN((c) | 32, 'a', 'z'))
 
#define HEX_DIGIT_VAL(c)   ((c) <= '9' ? (c) - '0' : ((c) | 32) - 'a' + 10)
 
#define ERR_CODE(c)   ((c) < 0 ? (c) : AVERROR_INVALIDDATA)
 

Functions

static void av_bprint_utf8 (AVBPrint *bp, unsigned c)
 
static void next_byte (AVIOContext *pb, int *cur_byte)
 
static void skip_spaces (AVIOContext *pb, int *cur_byte)
 
static int expect_byte (AVIOContext *pb, int *cur_byte, uint8_t c)
 
static int parse_string (AVIOContext *pb, int *cur_byte, AVBPrint *bp, int full)
 
static int parse_label (AVIOContext *pb, int *cur_byte, AVBPrint *bp)
 
static int parse_boolean (AVIOContext *pb, int *cur_byte, int *result)
 
static int parse_int (AVIOContext *pb, int *cur_byte, int64_t *result)
 
static int parse_file (AVIOContext *pb, FFDemuxSubtitlesQueue *subs)
 
static av_cold int tedcaptions_read_header (AVFormatContext *avf)
 
static int tedcaptions_read_packet (AVFormatContext *avf, AVPacket *packet)
 
static int tedcaptions_read_close (AVFormatContext *avf)
 
static av_cold int tedcaptions_read_probe (const AVProbeData *p)
 
static int tedcaptions_read_seek (AVFormatContext *avf, int stream_index, int64_t min_ts, int64_t ts, int64_t max_ts, int flags)
 

Variables

static const AVOption tedcaptions_options []
 
static const AVClass tedcaptions_demuxer_class
 
const FFInputFormat ff_tedcaptions_demuxer
 

Macro Definition Documentation

◆ BETWEEN

#define BETWEEN (   a,
  amin,
  amax 
)    ((unsigned)((a) - (amin)) <= (amax) - (amin))

Definition at line 51 of file tedcaptionsdec.c.

◆ HEX_DIGIT_TEST

#define HEX_DIGIT_TEST (   c)    (BETWEEN(c, '0', '9') || BETWEEN((c) | 32, 'a', 'z'))

Definition at line 53 of file tedcaptionsdec.c.

◆ HEX_DIGIT_VAL

#define HEX_DIGIT_VAL (   c)    ((c) <= '9' ? (c) - '0' : ((c) | 32) - 'a' + 10)

Definition at line 54 of file tedcaptionsdec.c.

◆ ERR_CODE

#define ERR_CODE (   c)    ((c) < 0 ? (c) : AVERROR_INVALIDDATA)

Definition at line 55 of file tedcaptionsdec.c.

Function Documentation

◆ av_bprint_utf8()

static void av_bprint_utf8 ( AVBPrint *  bp,
unsigned  c 
)
static

Definition at line 57 of file tedcaptionsdec.c.

Referenced by parse_string().

◆ next_byte()

static void next_byte ( AVIOContext pb,
int *  cur_byte 
)
static

◆ skip_spaces()

static void skip_spaces ( AVIOContext pb,
int *  cur_byte 
)
static

Definition at line 78 of file tedcaptionsdec.c.

Referenced by expect_byte(), parse_boolean(), parse_file(), and parse_int().

◆ expect_byte()

static int expect_byte ( AVIOContext pb,
int *  cur_byte,
uint8_t  c 
)
static

Definition at line 85 of file tedcaptionsdec.c.

Referenced by parse_file(), parse_label(), and parse_string().

◆ parse_string()

static int parse_string ( AVIOContext pb,
int *  cur_byte,
AVBPrint *  bp,
int  full 
)
static

Definition at line 94 of file tedcaptionsdec.c.

Referenced by parse_file(), and parse_label().

◆ parse_label()

static int parse_label ( AVIOContext pb,
int *  cur_byte,
AVBPrint *  bp 
)
static

Definition at line 132 of file tedcaptionsdec.c.

Referenced by parse_file().

◆ parse_boolean()

static int parse_boolean ( AVIOContext pb,
int *  cur_byte,
int *  result 
)
static

Definition at line 146 of file tedcaptionsdec.c.

Referenced by parse_file().

◆ parse_int()

static int parse_int ( AVIOContext pb,
int *  cur_byte,
int64_t result 
)
static

Definition at line 168 of file tedcaptionsdec.c.

Referenced by parse_file().

◆ parse_file()

static int parse_file ( AVIOContext pb,
FFDemuxSubtitlesQueue subs 
)
static

Definition at line 185 of file tedcaptionsdec.c.

Referenced by tedcaptions_read_header().

◆ tedcaptions_read_header()

static av_cold int tedcaptions_read_header ( AVFormatContext avf)
static

Definition at line 277 of file tedcaptionsdec.c.

◆ tedcaptions_read_packet()

static int tedcaptions_read_packet ( AVFormatContext avf,
AVPacket packet 
)
static

Definition at line 312 of file tedcaptionsdec.c.

◆ tedcaptions_read_close()

static int tedcaptions_read_close ( AVFormatContext avf)
static

Definition at line 319 of file tedcaptionsdec.c.

◆ tedcaptions_read_probe()

static av_cold int tedcaptions_read_probe ( const AVProbeData p)
static

Definition at line 327 of file tedcaptionsdec.c.

◆ tedcaptions_read_seek()

static int tedcaptions_read_seek ( AVFormatContext avf,
int  stream_index,
int64_t  min_ts,
int64_t  ts,
int64_t  max_ts,
int  flags 
)
static

Definition at line 350 of file tedcaptionsdec.c.

Variable Documentation

◆ tedcaptions_options

const AVOption tedcaptions_options[]
static
Initial value:
= {
{ "start_time", "set the start time (offset) of the subtitles, in ms",
{ .i64 = 15000 }, INT64_MIN, INT64_MAX,
{ NULL },
}

Definition at line 36 of file tedcaptionsdec.c.

◆ tedcaptions_demuxer_class

const AVClass tedcaptions_demuxer_class
static
Initial value:
= {
.class_name = "tedcaptions_demuxer",
.item_name = av_default_item_name,
}

Definition at line 44 of file tedcaptionsdec.c.

◆ ff_tedcaptions_demuxer

const FFInputFormat ff_tedcaptions_demuxer
Initial value:
= {
.p.name = "tedcaptions",
.p.long_name = NULL_IF_CONFIG_SMALL("TED Talks captions"),
.p.priv_class = &tedcaptions_demuxer_class,
.priv_data_size = sizeof(TEDCaptionsDemuxer),
.flags_internal = FF_INFMT_FLAG_INIT_CLEANUP,
.read_seek2 = tedcaptions_read_seek,
}

Definition at line 359 of file tedcaptionsdec.c.

tedcaptions_options
static const AVOption tedcaptions_options[]
Definition: tedcaptionsdec.c:36
tedcaptions_read_seek
static int tedcaptions_read_seek(AVFormatContext *avf, int stream_index, int64_t min_ts, int64_t ts, int64_t max_ts, int flags)
Definition: tedcaptionsdec.c:350
read_close
static av_cold int read_close(AVFormatContext *ctx)
Definition: libcdio.c:143
read_packet
static int read_packet(void *opaque, uint8_t *buf, int buf_size)
Definition: avio_read_callback.c:42
TEDCaptionsDemuxer
Definition: tedcaptionsdec.c:30
tedcaptions_demuxer_class
static const AVClass tedcaptions_demuxer_class
Definition: tedcaptionsdec.c:44
AV_OPT_TYPE_INT64
@ AV_OPT_TYPE_INT64
Underlying C type is int64_t.
Definition: opt.h:263
FF_INFMT_FLAG_INIT_CLEANUP
#define FF_INFMT_FLAG_INIT_CLEANUP
For an FFInputFormat with this flag set read_close() needs to be called by the caller upon read_heade...
Definition: demux.h:35
LIBAVUTIL_VERSION_INT
#define LIBAVUTIL_VERSION_INT
Definition: version.h:85
read_header
static int read_header(FFV1Context *f)
Definition: ffv1dec.c:540
NULL
#define NULL
Definition: coverity.c:32
av_default_item_name
const char * av_default_item_name(void *ptr)
Return the context name.
Definition: log.c:237
tedcaptions_read_packet
static int tedcaptions_read_packet(AVFormatContext *avf, AVPacket *packet)
Definition: tedcaptionsdec.c:312
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:94
tedcaptions_read_probe
static av_cold int tedcaptions_read_probe(const AVProbeData *p)
Definition: tedcaptionsdec.c:327
AV_OPT_FLAG_SUBTITLE_PARAM
#define AV_OPT_FLAG_SUBTITLE_PARAM
Definition: opt.h:359
tedcaptions_read_close
static int tedcaptions_read_close(AVFormatContext *avf)
Definition: tedcaptionsdec.c:319
AV_OPT_FLAG_DECODING_PARAM
#define AV_OPT_FLAG_DECODING_PARAM
A generic parameter which can be set by the user for demuxing or decoding.
Definition: opt.h:356
read_probe
static int read_probe(const AVProbeData *p)
Definition: cdg.c:30
tedcaptions_read_header
static av_cold int tedcaptions_read_header(AVFormatContext *avf)
Definition: tedcaptionsdec.c:277