FFmpeg
Data Structures | Macros | Functions | Variables
flvdec.c File Reference
#include "libavutil/avstring.h"
#include "libavutil/channel_layout.h"
#include "libavutil/dict.h"
#include "libavutil/opt.h"
#include "libavutil/intfloat.h"
#include "libavutil/mathematics.h"
#include "libavutil/time_internal.h"
#include "libavcodec/bytestream.h"
#include "libavcodec/mpeg4audio.h"
#include "avformat.h"
#include "internal.h"
#include "avio_internal.h"
#include "flv.h"

Go to the source code of this file.

Data Structures

struct  FLVContext
 
struct  amf_date
 

Macros

#define VALIDATE_INDEX_TS_THRESH   2500
 
#define RESYNC_BUFFER_SIZE   (1<<20)
 
#define MAX_DEPTH   16
 arbitrary limit to prevent unbounded recursion More...
 
#define TYPE_ONTEXTDATA   1
 
#define TYPE_ONCAPTION   2
 
#define TYPE_ONCAPTIONINFO   3
 
#define TYPE_UNKNOWN   9
 
#define OFFSET(x)   offsetof(FLVContext, x)
 
#define VD   AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_DECODING_PARAM
 

Functions

static int probe (const AVProbeData *p, int live)
 
static int flv_probe (const AVProbeData *p)
 
static int live_flv_probe (const AVProbeData *p)
 
static int kux_probe (const AVProbeData *p)
 
static void add_keyframes_index (AVFormatContext *s)
 
static AVStreamcreate_stream (AVFormatContext *s, int codec_type)
 
static int flv_same_audio_codec (AVCodecParameters *apar, int flags)
 
static void flv_set_audio_codec (AVFormatContext *s, AVStream *astream, AVCodecParameters *apar, int flv_codecid)
 
static int flv_same_video_codec (AVCodecParameters *vpar, int flags)
 
static int flv_set_video_codec (AVFormatContext *s, AVStream *vstream, int flv_codecid, int read)
 
static int amf_get_string (AVIOContext *ioc, char *buffer, int buffsize)
 
static int parse_keyframes_index (AVFormatContext *s, AVIOContext *ioc, int64_t max_pos)
 
static int amf_parse_object (AVFormatContext *s, AVStream *astream, AVStream *vstream, const char *key, int64_t max_pos, int depth)
 
static int flv_read_metabody (AVFormatContext *s, int64_t next_pos)
 
static int flv_read_header (AVFormatContext *s)
 
static int flv_read_close (AVFormatContext *s)
 
static int flv_get_extradata (AVFormatContext *s, AVStream *st, int size)
 
static int flv_queue_extradata (FLVContext *flv, AVIOContext *pb, int stream, int size)
 
static void clear_index_entries (AVFormatContext *s, int64_t pos)
 
static int amf_skip_tag (AVIOContext *pb, AMFDataType type, int depth)
 
static int flv_data_packet (AVFormatContext *s, AVPacket *pkt, int64_t dts, int64_t next)
 
static int resync (AVFormatContext *s)
 
static int flv_read_packet (AVFormatContext *s, AVPacket *pkt)
 
static int flv_read_seek (AVFormatContext *s, int stream_index, int64_t ts, int flags)
 

Variables

static const AVOption options []
 
static const AVClass flv_class
 
AVInputFormat ff_flv_demuxer
 
static const AVClass live_flv_class
 
AVInputFormat ff_live_flv_demuxer
 
static const AVClass kux_class
 
AVInputFormat ff_kux_demuxer
 

Macro Definition Documentation

◆ VALIDATE_INDEX_TS_THRESH

#define VALIDATE_INDEX_TS_THRESH   2500

Definition at line 41 of file flvdec.c.

◆ RESYNC_BUFFER_SIZE

#define RESYNC_BUFFER_SIZE   (1<<20)

Definition at line 43 of file flvdec.c.

◆ MAX_DEPTH

#define MAX_DEPTH   16

arbitrary limit to prevent unbounded recursion

Definition at line 45 of file flvdec.c.

◆ TYPE_ONTEXTDATA

#define TYPE_ONTEXTDATA   1

Definition at line 703 of file flvdec.c.

◆ TYPE_ONCAPTION

#define TYPE_ONCAPTION   2

Definition at line 704 of file flvdec.c.

◆ TYPE_ONCAPTIONINFO

#define TYPE_ONCAPTIONINFO   3

Definition at line 705 of file flvdec.c.

◆ TYPE_UNKNOWN

#define TYPE_UNKNOWN   9

Definition at line 706 of file flvdec.c.

◆ OFFSET

#define OFFSET (   x)    offsetof(FLVContext, x)

Definition at line 1383 of file flvdec.c.

◆ VD

Definition at line 1384 of file flvdec.c.

Function Documentation

◆ probe()

static int probe ( const AVProbeData p,
int  live 
)
static

Definition at line 89 of file flvdec.c.

Referenced by flv_probe(), and live_flv_probe().

◆ flv_probe()

static int flv_probe ( const AVProbeData p)
static

Definition at line 108 of file flvdec.c.

◆ live_flv_probe()

static int live_flv_probe ( const AVProbeData p)
static

Definition at line 113 of file flvdec.c.

◆ kux_probe()

static int kux_probe ( const AVProbeData p)
static

Definition at line 118 of file flvdec.c.

◆ add_keyframes_index()

static void add_keyframes_index ( AVFormatContext s)
static

Definition at line 132 of file flvdec.c.

Referenced by amf_parse_object(), and create_stream().

◆ create_stream()

static AVStream* create_stream ( AVFormatContext s,
int  codec_type 
)
static

Definition at line 163 of file flvdec.c.

Referenced by amf_parse_object(), flv_data_packet(), and flv_read_packet().

◆ flv_same_audio_codec()

static int flv_same_audio_codec ( AVCodecParameters apar,
int  flags 
)
static

Definition at line 193 of file flvdec.c.

Referenced by flv_read_packet().

◆ flv_set_audio_codec()

static void flv_set_audio_codec ( AVFormatContext s,
AVStream astream,
AVCodecParameters apar,
int  flv_codecid 
)
static

Definition at line 244 of file flvdec.c.

Referenced by amf_parse_object(), and flv_read_packet().

◆ flv_same_video_codec()

static int flv_same_video_codec ( AVCodecParameters vpar,
int  flags 
)
static

Definition at line 304 of file flvdec.c.

Referenced by flv_read_packet().

◆ flv_set_video_codec()

static int flv_set_video_codec ( AVFormatContext s,
AVStream vstream,
int  flv_codecid,
int  read 
)
static

Definition at line 329 of file flvdec.c.

Referenced by amf_parse_object(), and flv_read_packet().

◆ amf_get_string()

static int amf_get_string ( AVIOContext ioc,
char *  buffer,
int  buffsize 
)
static

◆ parse_keyframes_index()

static int parse_keyframes_index ( AVFormatContext s,
AVIOContext ioc,
int64_t  max_pos 
)
static

Definition at line 406 of file flvdec.c.

Referenced by amf_parse_object().

◆ amf_parse_object()

static int amf_parse_object ( AVFormatContext s,
AVStream astream,
AVStream vstream,
const char *  key,
int64_t  max_pos,
int  depth 
)
static

Definition at line 498 of file flvdec.c.

Referenced by flv_read_metabody().

◆ flv_read_metabody()

static int flv_read_metabody ( AVFormatContext s,
int64_t  next_pos 
)
static

Definition at line 708 of file flvdec.c.

Referenced by flv_read_packet().

◆ flv_read_header()

static int flv_read_header ( AVFormatContext s)
static

Definition at line 766 of file flvdec.c.

◆ flv_read_close()

static int flv_read_close ( AVFormatContext s)
static

Definition at line 804 of file flvdec.c.

◆ flv_get_extradata()

static int flv_get_extradata ( AVFormatContext s,
AVStream st,
int  size 
)
static

Definition at line 815 of file flvdec.c.

Referenced by flv_read_packet().

◆ flv_queue_extradata()

static int flv_queue_extradata ( FLVContext flv,
AVIOContext pb,
int  stream,
int  size 
)
static

Definition at line 827 of file flvdec.c.

Referenced by flv_read_packet().

◆ clear_index_entries()

static void clear_index_entries ( AVFormatContext s,
int64_t  pos 
)
static

Definition at line 843 of file flvdec.c.

Referenced by flv_read_packet().

◆ amf_skip_tag()

static int amf_skip_tag ( AVIOContext pb,
AMFDataType  type,
int  depth 
)
static

Definition at line 859 of file flvdec.c.

Referenced by flv_data_packet().

◆ flv_data_packet()

static int flv_data_packet ( AVFormatContext s,
AVPacket pkt,
int64_t  dts,
int64_t  next 
)
static

Definition at line 908 of file flvdec.c.

Referenced by flv_read_packet().

◆ resync()

static int resync ( AVFormatContext s)
static

◆ flv_read_packet()

static int flv_read_packet ( AVFormatContext s,
AVPacket pkt 
)
static

Definition at line 1017 of file flvdec.c.

◆ flv_read_seek()

static int flv_read_seek ( AVFormatContext s,
int  stream_index,
int64_t  ts,
int  flags 
)
static

Definition at line 1375 of file flvdec.c.

Variable Documentation

◆ options

const AVOption options[]
static
Initial value:
= {
{ "flv_metadata", "Allocate streams according to the onMetaData array", OFFSET(trust_metadata), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, VD },
{ "flv_full_metadata", "Dump full metadata of the onMetadata", OFFSET(dump_full_metadata), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, VD },
{ "flv_ignore_prevtag", "Ignore the Size of previous tag", OFFSET(trust_datasize), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, VD },
{ "missing_streams", "", OFFSET(missing_streams), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 0xFF, VD | AV_OPT_FLAG_EXPORT | AV_OPT_FLAG_READONLY },
{ NULL }
}

Definition at line 1385 of file flvdec.c.

◆ flv_class

const AVClass flv_class
static
Initial value:
= {
.class_name = "flvdec",
.item_name = av_default_item_name,
.option = options,
}

Definition at line 1393 of file flvdec.c.

◆ ff_flv_demuxer

AVInputFormat ff_flv_demuxer
Initial value:
= {
.name = "flv",
.long_name = NULL_IF_CONFIG_SMALL("FLV (Flash Video)"),
.priv_data_size = sizeof(FLVContext),
.extensions = "flv",
.priv_class = &flv_class,
}

Definition at line 1400 of file flvdec.c.

◆ live_flv_class

const AVClass live_flv_class
static
Initial value:
= {
.class_name = "live_flvdec",
.item_name = av_default_item_name,
.option = options,
}

Definition at line 1413 of file flvdec.c.

◆ ff_live_flv_demuxer

AVInputFormat ff_live_flv_demuxer
Initial value:
= {
.name = "live_flv",
.long_name = NULL_IF_CONFIG_SMALL("live RTMP FLV (Flash Video)"),
.priv_data_size = sizeof(FLVContext),
.extensions = "flv",
.priv_class = &live_flv_class,
}

Definition at line 1420 of file flvdec.c.

◆ kux_class

const AVClass kux_class
static
Initial value:
= {
.class_name = "kuxdec",
.item_name = av_default_item_name,
.option = options,
}

Definition at line 1434 of file flvdec.c.

◆ ff_kux_demuxer

AVInputFormat ff_kux_demuxer
Initial value:
= {
.name = "kux",
.long_name = NULL_IF_CONFIG_SMALL("KUX (YouKu)"),
.priv_data_size = sizeof(FLVContext),
.extensions = "kux",
.priv_class = &kux_class,
}

Definition at line 1441 of file flvdec.c.

AV_OPT_FLAG_READONLY
#define AV_OPT_FLAG_READONLY
The option may not be set through the AVOptions API, only read.
Definition: opt.h:289
flv_read_packet
static int flv_read_packet(AVFormatContext *s, AVPacket *pkt)
Definition: flvdec.c:1017
options
static const AVOption options[]
Definition: flvdec.c:1385
OFFSET
#define OFFSET(x)
Definition: flvdec.c:1383
read_seek
static int read_seek(AVFormatContext *ctx, int stream_index, int64_t timestamp, int flags)
Definition: libcdio.c:153
flv_read_seek
static int flv_read_seek(AVFormatContext *s, int stream_index, int64_t ts, int flags)
Definition: flvdec.c:1375
read_close
static av_cold int read_close(AVFormatContext *ctx)
Definition: libcdio.c:145
VD
#define VD
Definition: flvdec.c:1384
kux_class
static const AVClass kux_class
Definition: flvdec.c:1434
live_flv_probe
static int live_flv_probe(const AVProbeData *p)
Definition: flvdec.c:113
flv_read_close
static int flv_read_close(AVFormatContext *s)
Definition: flvdec.c:804
LIBAVUTIL_VERSION_INT
#define LIBAVUTIL_VERSION_INT
Definition: version.h:85
read_header
static int read_header(FFV1Context *f)
Definition: ffv1dec.c:530
NULL
#define NULL
Definition: coverity.c:32
read_probe
static int read_probe(const AVProbeData *pd)
Definition: jvdec.c:55
flv_read_header
static int flv_read_header(AVFormatContext *s)
Definition: flvdec.c:766
av_default_item_name
const char * av_default_item_name(void *ptr)
Return the context name.
Definition: log.c:191
live_flv_class
static const AVClass live_flv_class
Definition: flvdec.c:1413
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:188
FLVContext
Definition: flvdec.c:47
flv_class
static const AVClass flv_class
Definition: flvdec.c:1393
kux_probe
static int kux_probe(const AVProbeData *p)
Definition: flvdec.c:118
flv_probe
static int flv_probe(const AVProbeData *p)
Definition: flvdec.c:108
read_packet
static int read_packet(void *opaque, uint8_t *buf, int buf_size)
Definition: avio_reading.c:42
AV_OPT_FLAG_EXPORT
#define AV_OPT_FLAG_EXPORT
The option is intended for exporting values to the caller.
Definition: opt.h:284
AV_OPT_TYPE_INT
@ AV_OPT_TYPE_INT
Definition: opt.h:223
AVFMT_TS_DISCONT
#define AVFMT_TS_DISCONT
Format allows timestamp discontinuities.
Definition: avformat.h:469
AV_OPT_TYPE_BOOL
@ AV_OPT_TYPE_BOOL
Definition: opt.h:240
flags
#define flags(name, subs,...)
Definition: cbs_av1.c:565