FFmpeg
Loading...
Searching...
No Matches
flvdec.c File Reference
#include "libavutil/attributes.h"
#include "libavutil/avassert.h"
#include "libavutil/avstring.h"
#include "libavutil/channel_layout.h"
#include "libavutil/dict.h"
#include "libavutil/mem.h"
#include "libavutil/opt.h"
#include "libavutil/internal.h"
#include "libavutil/intfloat.h"
#include "libavutil/intreadwrite.h"
#include "libavutil/mastering_display_metadata.h"
#include "avformat.h"
#include "demux.h"
#include "internal.h"
#include "flv.h"

Go to the source code of this file.

Data Structures

struct  FLVMasteringMeta
 
struct  FLVMetaVideoColor
 
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
 
#define TYPE_ONTEXTDATA   1
 
#define TYPE_ONCAPTION   2
 
#define TYPE_ONCAPTIONINFO   3
 
#define TYPE_UNKNOWN   9
 
#define OFFSET(x)
 
#define VD   AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_DECODING_PARAM
 

Enumerations

enum  FLVMetaColorInfoFlag { FLV_COLOR_INFO_FLAG_NONE = 0 , FLV_COLOR_INFO_FLAG_GOT = 1 , FLV_COLOR_INFO_FLAG_PARSING = 2 }
 

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, int track_idx)
 
static int flv_same_audio_codec (AVCodecParameters *apar, int flags, uint32_t codec_fourcc)
 
static int flv_set_audio_codec (AVFormatContext *s, AVStream *astream, AVCodecParameters *apar, int flv_codecid)
 
static int flv_same_video_codec (AVCodecParameters *vpar, uint32_t flv_codecid)
 
static int flv_set_video_codec (AVFormatContext *s, AVStream *vstream, uint32_t 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, int multitrack)
 
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_parse_video_color_info (AVFormatContext *s, AVStream *st, int64_t next_pos)
 
static int flv_update_video_color_info (AVFormatContext *s, AVStream *st)
 
static int flv_parse_mod_ex_data (AVFormatContext *s, int *pkt_type, int *size, int64_t *dts)
 
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_kux_class
 
const FFInputFormat ff_flv_demuxer
 
const FFInputFormat ff_live_flv_demuxer
 
const FFInputFormat ff_kux_demuxer
 

Macro Definition Documentation

◆ VALIDATE_INDEX_TS_THRESH

#define VALIDATE_INDEX_TS_THRESH   2500

Definition at line 43 of file flvdec.c.

Referenced by flv_read_packet().

◆ RESYNC_BUFFER_SIZE

#define RESYNC_BUFFER_SIZE   (1<<20)

Definition at line 45 of file flvdec.c.

Referenced by resync().

◆ MAX_DEPTH

#define MAX_DEPTH   16

arbitrary limit to prevent unbounded recursion

Definition at line 47 of file flvdec.c.

Referenced by amf_parse_object(), amf_skip_tag(), amf_tag_skip(), make_eval_expr(), and parse_primary().

◆ TYPE_ONTEXTDATA

#define TYPE_ONTEXTDATA   1

Definition at line 855 of file flvdec.c.

Referenced by flv_read_metabody(), and flv_read_packet().

◆ TYPE_ONCAPTION

#define TYPE_ONCAPTION   2

Definition at line 856 of file flvdec.c.

Referenced by flv_read_metabody(), and flv_read_packet().

◆ TYPE_ONCAPTIONINFO

#define TYPE_ONCAPTIONINFO   3

Definition at line 857 of file flvdec.c.

Referenced by flv_read_metabody().

◆ TYPE_UNKNOWN

#define TYPE_UNKNOWN   9

Definition at line 858 of file flvdec.c.

Referenced by flv_read_metabody(), and flv_read_packet().

◆ OFFSET

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

Definition at line 1975 of file flvdec.c.

◆ VD

Definition at line 1976 of file flvdec.c.

Enumeration Type Documentation

◆ FLVMetaColorInfoFlag

Enumerator
FLV_COLOR_INFO_FLAG_NONE 
FLV_COLOR_INFO_FLAG_GOT 
FLV_COLOR_INFO_FLAG_PARSING 

Definition at line 71 of file flvdec.c.

Function Documentation

◆ probe()

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

Definition at line 125 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 144 of file flvdec.c.

◆ live_flv_probe()

static int live_flv_probe ( const AVProbeData * p)
static

Definition at line 149 of file flvdec.c.

◆ kux_probe()

static int kux_probe ( const AVProbeData * p)
static

Definition at line 154 of file flvdec.c.

◆ add_keyframes_index()

static void add_keyframes_index ( AVFormatContext * s)
static

Definition at line 168 of file flvdec.c.

Referenced by amf_parse_object(), and create_stream().

◆ create_stream()

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

Definition at line 199 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,
uint32_t codec_fourcc )
static

Definition at line 233 of file flvdec.c.

Referenced by flv_read_packet().

◆ flv_set_audio_codec()

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

Definition at line 305 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,
uint32_t flv_codecid )
static

Definition at line 394 of file flvdec.c.

Referenced by flv_read_packet().

◆ flv_set_video_codec()

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

Definition at line 427 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 523 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 618 of file flvdec.c.

Referenced by amf_parse_object(), flv_parse_video_color_info(), and flv_read_metabody().

◆ flv_read_metabody()

static int flv_read_metabody ( AVFormatContext * s,
int64_t next_pos )
static

Definition at line 860 of file flvdec.c.

Referenced by flv_read_packet().

◆ flv_read_header()

static int flv_read_header ( AVFormatContext * s)
static

Definition at line 917 of file flvdec.c.

◆ flv_read_close()

static int flv_read_close ( AVFormatContext * s)
static

Definition at line 956 of file flvdec.c.

◆ flv_get_extradata()

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

Definition at line 971 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,
int multitrack )
static

Definition at line 983 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 1032 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 1047 of file flvdec.c.

Referenced by amf_skip_tag(), and 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 1098 of file flvdec.c.

Referenced by flv_read_packet().

◆ resync()

static int resync ( AVFormatContext * s)
static

◆ flv_parse_video_color_info()

static int flv_parse_video_color_info ( AVFormatContext * s,
AVStream * st,
int64_t next_pos )
static

Definition at line 1209 of file flvdec.c.

Referenced by flv_read_packet().

◆ flv_update_video_color_info()

static int flv_update_video_color_info ( AVFormatContext * s,
AVStream * st )
static

Definition at line 1246 of file flvdec.c.

Referenced by flv_read_packet().

◆ flv_parse_mod_ex_data()

static int flv_parse_mod_ex_data ( AVFormatContext * s,
int * pkt_type,
int * size,
int64_t * dts )
static

Definition at line 1323 of file flvdec.c.

Referenced by flv_read_packet().

◆ flv_read_packet()

static int flv_read_packet ( AVFormatContext * s,
AVPacket * pkt )
static

Definition at line 1379 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 1967 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 },
{ NULL }
}
#define VD
Definition amfdec.c:787
#define NULL
Definition coverity.c:32
#define OFFSET(x)
@ AV_OPT_TYPE_BOOL
Underlying C type is int.
Definition opt.h:326

Definition at line 1977 of file flvdec.c.

◆ flv_kux_class

const AVClass flv_kux_class
static
Initial value:
= {
.class_name = "(live) flv/kux demuxer",
.item_name = av_default_item_name,
.option = options,
}
const char * av_default_item_name(void *ptr)
Return the context name.
Definition log.c:241
#define LIBAVUTIL_VERSION_INT
Definition version.h:85

Definition at line 1984 of file flvdec.c.

◆ ff_flv_demuxer

const FFInputFormat ff_flv_demuxer
Initial value:
= {
.p.name = "flv",
.p.long_name = NULL_IF_CONFIG_SMALL("FLV (Flash Video)"),
.p.extensions = "flv",
.p.priv_class = &flv_kux_class,
.priv_data_size = sizeof(FLVContext),
}
static int read_packet(void *opaque, uint8_t *buf, int buf_size)
static int read_probe(const AVProbeData *p)
Definition cdg.c:30
static int read_header(FFV1Context *f, RangeCoder *c)
Definition ffv1dec.c:578
static int flv_read_header(AVFormatContext *s)
Definition flvdec.c:917
static int flv_read_packet(AVFormatContext *s, AVPacket *pkt)
Definition flvdec.c:1379
static const AVClass flv_kux_class
Definition flvdec.c:1984
static int flv_probe(const AVProbeData *p)
Definition flvdec.c:144
static int flv_read_close(AVFormatContext *s)
Definition flvdec.c:956
static int flv_read_seek(AVFormatContext *s, int stream_index, int64_t ts, int flags)
Definition flvdec.c:1967
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
Definition internal.h:88
static av_cold int read_close(AVFormatContext *ctx)
Definition libcdio.c:143
static int read_seek(AVFormatContext *ctx, int stream_index, int64_t timestamp, int flags)
Definition libcdio.c:151

Definition at line 1991 of file flvdec.c.

◆ ff_live_flv_demuxer

const FFInputFormat ff_live_flv_demuxer
Initial value:
= {
.p.name = "live_flv",
.p.long_name = NULL_IF_CONFIG_SMALL("live RTMP FLV (Flash Video)"),
.p.extensions = "flv",
.p.priv_class = &flv_kux_class,
.p.flags = AVFMT_TS_DISCONT,
.priv_data_size = sizeof(FLVContext),
}
#define AVFMT_TS_DISCONT
Format allows timestamp discontinuities.
Definition avformat.h:500
static int live_flv_probe(const AVProbeData *p)
Definition flvdec.c:149

Definition at line 2004 of file flvdec.c.

◆ ff_kux_demuxer

const FFInputFormat ff_kux_demuxer
Initial value:
= {
.p.name = "kux",
.p.long_name = NULL_IF_CONFIG_SMALL("KUX (YouKu)"),
.p.extensions = "kux",
.p.priv_class = &flv_kux_class,
.priv_data_size = sizeof(FLVContext),
}
static int kux_probe(const AVProbeData *p)
Definition flvdec.c:154

Definition at line 2018 of file flvdec.c.