FFmpeg
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Enumerations | Functions | Variables
flvenc.c File Reference
#include "libavutil/intreadwrite.h"
#include "libavutil/dict.h"
#include "libavutil/intfloat.h"
#include "libavutil/avassert.h"
#include "libavutil/mathematics.h"
#include "avio_internal.h"
#include "avio.h"
#include "avc.h"
#include "avformat.h"
#include "flv.h"
#include "internal.h"
#include "metadata.h"
#include "libavutil/opt.h"
#include "libavcodec/put_bits.h"
#include "libavcodec/aacenctab.h"

Go to the source code of this file.

Data Structures

struct  FLVFileposition
 
struct  FLVContext
 
struct  FLVStreamContext
 

Macros

#define READ_BLOCK
 

Enumerations

enum  FLVFlags {
  FLV_AAC_SEQ_HEADER_DETECT = (1 << 0), FLV_NO_SEQUENCE_END = (1 << 1), FLV_ADD_KEYFRAME_INDEX = (1 << 2), FLV_NO_METADATA = (1 << 3),
  FLV_NO_DURATION_FILESIZE = (1 << 4)
}
 

Functions

static int get_audio_flags (AVFormatContext *s, AVCodecParameters *par)
 
static void put_amf_string (AVIOContext *pb, const char *str)
 
static void put_avc_eos_tag (AVIOContext *pb, unsigned ts)
 
static void put_amf_double (AVIOContext *pb, double d)
 
static void put_amf_byte (AVIOContext *pb, unsigned char abyte)
 
static void put_amf_dword_array (AVIOContext *pb, uint32_t dw)
 
static void put_amf_bool (AVIOContext *pb, int b)
 
static void write_metadata (AVFormatContext *s, unsigned int ts)
 
static int unsupported_codec (AVFormatContext *s, const char *type, int codec_id)
 
static void flv_write_codec_header (AVFormatContext *s, AVCodecParameters *par)
 
static int flv_append_keyframe_info (AVFormatContext *s, FLVContext *flv, double ts, int64_t pos)
 
static int shift_data (AVFormatContext *s)
 
static int flv_write_header (AVFormatContext *s)
 
static int flv_write_trailer (AVFormatContext *s)
 
static int flv_write_packet (AVFormatContext *s, AVPacket *pkt)
 

Variables

static const AVCodecTag flv_video_codec_ids []
 
static const AVCodecTag flv_audio_codec_ids []
 
static const AVOption options []
 
static const AVClass flv_muxer_class
 
AVOutputFormat ff_flv_muxer
 

Macro Definition Documentation

#define READ_BLOCK
Value:
do { \
read_size[read_buf_id] = avio_read(read_pb, read_buf[read_buf_id], metadata_size); \
read_buf_id ^= 1; \
} while (0)
int avio_read(AVIOContext *s, unsigned char *buf, int size)
Read size bytes from AVIOContext into buf.
Definition: aviobuf.c:637

Referenced by shift_data().

Enumeration Type Documentation

enum FLVFlags
Enumerator
FLV_AAC_SEQ_HEADER_DETECT 
FLV_NO_SEQUENCE_END 
FLV_ADD_KEYFRAME_INDEX 
FLV_NO_METADATA 
FLV_NO_DURATION_FILESIZE 

Definition at line 66 of file flvenc.c.

Function Documentation

static int get_audio_flags ( AVFormatContext s,
AVCodecParameters par 
)
static

Definition at line 127 of file flvenc.c.

Referenced by flv_write_codec_header(), flv_write_header(), and flv_write_packet().

static void put_amf_string ( AVIOContext pb,
const char *  str 
)
static

Definition at line 226 of file flvenc.c.

Referenced by flv_write_packet(), flv_write_trailer(), and write_metadata().

static void put_avc_eos_tag ( AVIOContext pb,
unsigned  ts 
)
static

Definition at line 233 of file flvenc.c.

Referenced by flv_write_trailer().

static void put_amf_double ( AVIOContext pb,
double  d 
)
static

Definition at line 246 of file flvenc.c.

Referenced by flv_write_trailer(), and write_metadata().

static void put_amf_byte ( AVIOContext pb,
unsigned char  abyte 
)
static

Definition at line 252 of file flvenc.c.

Referenced by write_metadata().

static void put_amf_dword_array ( AVIOContext pb,
uint32_t  dw 
)
static

Definition at line 257 of file flvenc.c.

Referenced by flv_write_trailer().

static void put_amf_bool ( AVIOContext pb,
int  b 
)
static

Definition at line 263 of file flvenc.c.

Referenced by write_metadata().

static void write_metadata ( AVFormatContext s,
unsigned int  ts 
)
static

Definition at line 269 of file flvenc.c.

Referenced by flv_write_header(), and flv_write_packet().

static int unsupported_codec ( AVFormatContext s,
const char *  type,
int  codec_id 
)
static

Definition at line 472 of file flvenc.c.

Referenced by flv_write_header().

static void flv_write_codec_header ( AVFormatContext s,
AVCodecParameters par 
)
static

Definition at line 483 of file flvenc.c.

Referenced by flv_write_header(), and flv_write_packet().

static int flv_append_keyframe_info ( AVFormatContext s,
FLVContext flv,
double  ts,
int64_t  pos 
)
static

Definition at line 546 of file flvenc.c.

Referenced by flv_write_packet().

static int shift_data ( AVFormatContext s)
static

Definition at line 573 of file flvenc.c.

Referenced by flv_write_trailer().

static int flv_write_header ( AVFormatContext s)
static

Definition at line 653 of file flvenc.c.

static int flv_write_trailer ( AVFormatContext s)
static

Definition at line 766 of file flvenc.c.

static int flv_write_packet ( AVFormatContext s,
AVPacket pkt 
)
static

Definition at line 870 of file flvenc.c.

Variable Documentation

const AVCodecTag flv_video_codec_ids[]
static
const AVCodecTag flv_audio_codec_ids[]
static
Initial value:
= {
}
preferred ID for decoding MPEG audio layer 1, 2 or 3
Definition: avcodec.h:557
#define FLV_AUDIO_CODECID_OFFSET
Definition: flv.h:34

Definition at line 52 of file flvenc.c.

const AVOption options[]
static
Initial value:
= {
{ "flvflags", "FLV muxer flags", 0x42, AV_OPT_TYPE_FLAGS, {.i64 = 0}, INT_MIN, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM, "flvflags" },
{ "aac_seq_header_detect", "Put AAC sequence header based on stream data", 0, AV_OPT_TYPE_CONST, {.i64 = FLV_AAC_SEQ_HEADER_DETECT}, INT_MIN, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM, "flvflags" },
{ "no_sequence_end", "disable sequence end for FLV", 0, AV_OPT_TYPE_CONST, {.i64 = FLV_NO_SEQUENCE_END}, INT_MIN, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM, "flvflags" },
{ "no_metadata", "disable metadata for FLV", 0, AV_OPT_TYPE_CONST, {.i64 = FLV_NO_METADATA}, INT_MIN, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM, "flvflags" },
{ "no_duration_filesize", "disable duration and filesize zero value metadata for FLV", 0, AV_OPT_TYPE_CONST, {.i64 = FLV_NO_DURATION_FILESIZE}, INT_MIN, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM, "flvflags" },
{ "add_keyframe_index", "Add keyframe index metadata", 0, AV_OPT_TYPE_CONST, {.i64 = FLV_ADD_KEYFRAME_INDEX}, INT_MIN, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM, "flvflags" },
{ NULL },
}
#define NULL
Definition: coverity.c:32
#define AV_OPT_FLAG_ENCODING_PARAM
a generic parameter which can be set by the user for muxing or encoding
Definition: opt.h:276

Definition at line 1069 of file flvenc.c.

const AVClass flv_muxer_class
static
Initial value:
= {
.class_name = "flv muxer",
.item_name = av_default_item_name,
.option = options,
}
#define LIBAVUTIL_VERSION_INT
Definition: version.h:86
static const AVOption options[]
Definition: flvenc.c:1069
av_default_item_name

Definition at line 1079 of file flvenc.c.

AVOutputFormat ff_flv_muxer
Initial value:
= {
.name = "flv",
.long_name = NULL_IF_CONFIG_SMALL("FLV (Flash Video)"),
.mime_type = "video/x-flv",
.extensions = "flv",
.priv_data_size = sizeof(FLVContext),
.audio_codec = CONFIG_LIBMP3LAME ? AV_CODEC_ID_MP3 : AV_CODEC_ID_ADPCM_SWF,
.video_codec = AV_CODEC_ID_FLV1,
.codec_tag = (const AVCodecTag* const []) {
},
.priv_class = &flv_muxer_class,
}
static void write_packet(OutputFile *of, AVPacket *pkt, OutputStream *ost, int unqueue)
Definition: ffmpeg.c:671
static const AVCodecTag flv_audio_codec_ids[]
Definition: flvenc.c:52
static const AVClass flv_muxer_class
Definition: flvenc.c:1079
#define AVFMT_TS_NONSTRICT
Format does not require strictly increasing timestamps, but they must still be monotonic.
Definition: avformat.h:496
static const AVCodecTag flv_video_codec_ids[]
Definition: flvenc.c:39
static int flv_write_trailer(AVFormatContext *s)
Definition: flvenc.c:766
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
Definition: internal.h:179
preferred ID for decoding MPEG audio layer 1, 2 or 3
Definition: avcodec.h:557
static int flv_write_packet(AVFormatContext *s, AVPacket *pkt)
Definition: flvenc.c:870
static int write_trailer(AVFormatContext *s1)
Definition: v4l2enc.c:94
#define AVFMT_GLOBALHEADER
Format wants global header.
Definition: avformat.h:485
static int flv_write_header(AVFormatContext *s)
Definition: flvenc.c:653
#define AVFMT_VARIABLE_FPS
Format allows variable fps.
Definition: avformat.h:489
static void write_header(FFV1Context *f)
Definition: ffv1enc.c:337

Definition at line 1086 of file flvenc.c.