FFmpeg
Data Structures | Macros | Functions | Variables
mpegenc.c File Reference
#include "config_components.h"
#include <stdint.h>
#include "libavutil/attributes.h"
#include "libavutil/fifo.h"
#include "libavutil/log.h"
#include "libavutil/mathematics.h"
#include "libavutil/opt.h"
#include "libavcodec/put_bits.h"
#include "avformat.h"
#include "avio_internal.h"
#include "internal.h"
#include "mpeg.h"
#include "mux.h"

Go to the source code of this file.

Data Structures

struct  PacketDesc
 
struct  StreamInfo
 
struct  MpegMuxContext
 

Macros

#define MAX_PAYLOAD_SIZE   4096
 
#define VCD_PADDING_BITRATE_DEN   (2279 * 2294)
 
#define OFFSET(x)   offsetof(MpegMuxContext, x)
 
#define E   AV_OPT_FLAG_ENCODING_PARAM
 

Functions

static int put_pack_header (AVFormatContext *ctx, uint8_t *buf, int64_t timestamp)
 
static int put_system_header (AVFormatContext *ctx, uint8_t *buf, int only_for_stream_id)
 
static int get_system_header_size (AVFormatContext *ctx)
 
static av_cold int mpeg_mux_init (AVFormatContext *ctx)
 
static void put_timestamp (AVIOContext *pb, int id, int64_t timestamp)
 
static int get_vcd_padding_size (AVFormatContext *ctx, int64_t pts)
 
static void put_padding_packet (AVFormatContext *ctx, AVIOContext *pb, int packet_bytes)
 
static int get_nb_frames (AVFormatContext *ctx, StreamInfo *stream, int len)
 
static int fifo_avio_wrapper (void *opaque, void *buf, size_t *nb_elems)
 
static int flush_packet (AVFormatContext *ctx, int stream_index, int64_t pts, int64_t dts, int64_t scr, int trailer_size)
 
static void put_vcd_padding_sector (AVFormatContext *ctx)
 
static int remove_decoded_packets (AVFormatContext *ctx, int64_t scr)
 
static int output_packet (AVFormatContext *ctx, int flush)
 
static int mpeg_mux_write_packet (AVFormatContext *ctx, AVPacket *pkt)
 
static int mpeg_mux_end (AVFormatContext *ctx)
 
static void mpeg_mux_deinit (AVFormatContext *ctx)
 

Variables

const FFOutputFormat ff_mpeg1vcd_muxer
 
const FFOutputFormat ff_mpeg2dvd_muxer
 
const FFOutputFormat ff_mpeg2svcd_muxer
 
const FFOutputFormat ff_mpeg2vob_muxer
 
static const AVOption options []
 
static const AVClass mpeg_class
 

Macro Definition Documentation

◆ MAX_PAYLOAD_SIZE

#define MAX_PAYLOAD_SIZE   4096

Definition at line 40 of file mpegenc.c.

◆ VCD_PADDING_BITRATE_DEN

#define VCD_PADDING_BITRATE_DEN   (2279 * 2294)

◆ OFFSET

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

Definition at line 1291 of file mpegenc.c.

◆ E

Definition at line 1292 of file mpegenc.c.

Function Documentation

◆ put_pack_header()

static int put_pack_header ( AVFormatContext ctx,
uint8_t *  buf,
int64_t  timestamp 
)
static

Definition at line 95 of file mpegenc.c.

Referenced by flush_packet().

◆ put_system_header()

static int put_system_header ( AVFormatContext ctx,
uint8_t *  buf,
int  only_for_stream_id 
)
static

Definition at line 129 of file mpegenc.c.

Referenced by flush_packet().

◆ get_system_header_size()

static int get_system_header_size ( AVFormatContext ctx)
static

Definition at line 278 of file mpegenc.c.

Referenced by mpeg_mux_init().

◆ mpeg_mux_init()

static av_cold int mpeg_mux_init ( AVFormatContext ctx)
static

Definition at line 301 of file mpegenc.c.

◆ put_timestamp()

static void put_timestamp ( AVIOContext pb,
int  id,
int64_t  timestamp 
)
inlinestatic

Definition at line 579 of file mpegenc.c.

Referenced by flush_packet().

◆ get_vcd_padding_size()

static int get_vcd_padding_size ( AVFormatContext ctx,
int64_t  pts 
)
static

Definition at line 588 of file mpegenc.c.

Referenced by output_packet().

◆ put_padding_packet()

static void put_padding_packet ( AVFormatContext ctx,
AVIOContext pb,
int  packet_bytes 
)
static

Definition at line 611 of file mpegenc.c.

Referenced by flush_packet().

◆ get_nb_frames()

static int get_nb_frames ( AVFormatContext ctx,
StreamInfo stream,
int  len 
)
static

Definition at line 627 of file mpegenc.c.

Referenced by flush_packet().

◆ fifo_avio_wrapper()

static int fifo_avio_wrapper ( void *  opaque,
void *  buf,
size_t *  nb_elems 
)
static

Definition at line 642 of file mpegenc.c.

Referenced by flush_packet().

◆ flush_packet()

static int flush_packet ( AVFormatContext ctx,
int  stream_index,
int64_t  pts,
int64_t  dts,
int64_t  scr,
int  trailer_size 
)
static

Definition at line 649 of file mpegenc.c.

Referenced by output_packet().

◆ put_vcd_padding_sector()

static void put_vcd_padding_sector ( AVFormatContext ctx)
static

Definition at line 957 of file mpegenc.c.

Referenced by output_packet().

◆ remove_decoded_packets()

static int remove_decoded_packets ( AVFormatContext ctx,
int64_t  scr 
)
static

Definition at line 980 of file mpegenc.c.

Referenced by output_packet().

◆ output_packet()

static int output_packet ( AVFormatContext ctx,
int  flush 
)
static
Examples
transcode_aac.c.

Definition at line 1009 of file mpegenc.c.

Referenced by encode_audio_frame(), mpeg_mux_end(), and mpeg_mux_write_packet().

◆ mpeg_mux_write_packet()

static int mpeg_mux_write_packet ( AVFormatContext ctx,
AVPacket pkt 
)
static

Definition at line 1155 of file mpegenc.c.

◆ mpeg_mux_end()

static int mpeg_mux_end ( AVFormatContext ctx)
static

Definition at line 1250 of file mpegenc.c.

◆ mpeg_mux_deinit()

static void mpeg_mux_deinit ( AVFormatContext ctx)
static

Definition at line 1276 of file mpegenc.c.

Variable Documentation

◆ ff_mpeg1vcd_muxer

const FFOutputFormat ff_mpeg1vcd_muxer

Referenced by mpeg_mux_init().

◆ ff_mpeg2dvd_muxer

const FFOutputFormat ff_mpeg2dvd_muxer

Referenced by mpeg_mux_init().

◆ ff_mpeg2svcd_muxer

const FFOutputFormat ff_mpeg2svcd_muxer

Referenced by mpeg_mux_init().

◆ ff_mpeg2vob_muxer

const FFOutputFormat ff_mpeg2vob_muxer

Referenced by mpeg_mux_init().

◆ options

const AVOption options[]
static
Initial value:
= {
{ "muxrate", NULL, OFFSET(user_mux_rate), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, ((1<<22) - 1) * (8 * 50), E },
{ "preload", "Initial demux-decode delay in microseconds.", OFFSET(preload), AV_OPT_TYPE_INT, { .i64 = 500000 }, 0, INT_MAX, E },
{ NULL },
}

Definition at line 1293 of file mpegenc.c.

◆ mpeg_class

const AVClass mpeg_class
static
Initial value:
= {
.class_name = "mpeg/(s)vcd/vob/dvd muxer",
.item_name = av_default_item_name,
.option = options,
}

Definition at line 1299 of file mpegenc.c.

LIBAVUTIL_VERSION_INT
#define LIBAVUTIL_VERSION_INT
Definition: version.h:85
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
E
#define E
Definition: mpegenc.c:1292
OFFSET
#define OFFSET(x)
Definition: mpegenc.c:1291
AV_OPT_TYPE_INT
@ AV_OPT_TYPE_INT
Definition: opt.h:225
options
static const AVOption options[]
Definition: mpegenc.c:1293