FFmpeg
Data Structures | Macros | Functions | Variables
fifo_muxer.c File Reference
#include <stdlib.h>
#include "libavutil/opt.h"
#include "libavutil/time.h"
#include "libavformat/avformat.h"
#include "libavformat/mux.h"
#include "libavformat/network.h"
#include "libavformat/url.h"
#include "libavformat/fifo.c"

Go to the source code of this file.

Data Structures

struct  FailingMuxerPacketData
 
struct  FifoTestMuxerContext
 
struct  TestCase
 

Macros

#define FIFO_TEST
 
#define MAX_TST_PACKETS   128
 
#define SLEEPTIME_50_MS   50000
 
#define SLEEPTIME_10_MS   10000
 
#define OFF(x)   offsetof(FifoTestMuxerContext, x)
 
#define BUFFER_SIZE   64
 

Functions

static int fifo_test_header (AVFormatContext *avf)
 
static int fifo_test_packet (AVFormatContext *avf, AVPacket *pkt)
 
static int fifo_test_trailer (AVFormatContext *avf)
 
static void failing_deinit (AVFormatContext *avf)
 
static int prepare_packet (AVPacket *pkt, const FailingMuxerPacketData *pkt_data, int64_t pts)
 
static int initialize_fifo_tst_muxer_chain (AVFormatContext **oc, AVPacket **pkt)
 
static int fifo_basic_test (AVFormatContext *oc, AVDictionary **opts, AVPacket *pkt, const FailingMuxerPacketData *pkt_data)
 
static int fifo_overflow_drop_test (AVFormatContext *oc, AVDictionary **opts, AVPacket *pkt, const FailingMuxerPacketData *data)
 
static int run_test (const TestCase *test)
 
int main (int argc, char *argv[])
 

Variables

static const AVOption fifo_test_options []
 
static const AVClass failing_muxer_class
 
const FFOutputFormat ff_fifo_test_muxer
 
const TestCase tests []
 

Macro Definition Documentation

◆ FIFO_TEST

#define FIFO_TEST

Definition at line 39 of file fifo_muxer.c.

◆ MAX_TST_PACKETS

#define MAX_TST_PACKETS   128

Definition at line 42 of file fifo_muxer.c.

◆ SLEEPTIME_50_MS

#define SLEEPTIME_50_MS   50000

Definition at line 43 of file fifo_muxer.c.

◆ SLEEPTIME_10_MS

#define SLEEPTIME_10_MS   10000

Definition at line 44 of file fifo_muxer.c.

◆ OFF

#define OFF (   x)    offsetof(FifoTestMuxerContext, x)

Definition at line 130 of file fifo_muxer.c.

◆ BUFFER_SIZE

#define BUFFER_SIZE   64

Definition at line 320 of file fifo_muxer.c.

Function Documentation

◆ fifo_test_header()

static int fifo_test_header ( AVFormatContext avf)
static

Definition at line 66 of file fifo_muxer.c.

◆ fifo_test_packet()

static int fifo_test_packet ( AVFormatContext avf,
AVPacket pkt 
)
static

Definition at line 72 of file fifo_muxer.c.

◆ fifo_test_trailer()

static int fifo_test_trailer ( AVFormatContext avf)
static

Definition at line 107 of file fifo_muxer.c.

◆ failing_deinit()

static void failing_deinit ( AVFormatContext avf)
static

Definition at line 113 of file fifo_muxer.c.

◆ prepare_packet()

static int prepare_packet ( AVPacket pkt,
const FailingMuxerPacketData pkt_data,
int64_t  pts 
)
static

Definition at line 166 of file fifo_muxer.c.

Referenced by fifo_basic_test(), and fifo_overflow_drop_test().

◆ initialize_fifo_tst_muxer_chain()

static int initialize_fifo_tst_muxer_chain ( AVFormatContext **  oc,
AVPacket **  pkt 
)
static

Definition at line 179 of file fifo_muxer.c.

Referenced by run_test().

◆ fifo_basic_test()

static int fifo_basic_test ( AVFormatContext oc,
AVDictionary **  opts,
AVPacket pkt,
const FailingMuxerPacketData pkt_data 
)
static

Definition at line 205 of file fifo_muxer.c.

◆ fifo_overflow_drop_test()

static int fifo_overflow_drop_test ( AVFormatContext oc,
AVDictionary **  opts,
AVPacket pkt,
const FailingMuxerPacketData data 
)
static

Definition at line 254 of file fifo_muxer.c.

◆ run_test()

static int run_test ( const TestCase test)
static

Definition at line 322 of file fifo_muxer.c.

Referenced by main().

◆ main()

int main ( int  argc,
char *  argv[] 
)

Definition at line 395 of file fifo_muxer.c.

Variable Documentation

◆ fifo_test_options

const AVOption fifo_test_options[]
static
Initial value:
= {
{"write_header_ret", "write_header() return value", OFF(write_header_ret),
AV_OPT_TYPE_INT, {.i64 = 0}, INT_MIN, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM},
{"write_trailer_ret", "write_trailer() return value", OFF(write_trailer_ret),
AV_OPT_TYPE_INT, {.i64 = 0}, INT_MIN, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM},
{"print_deinit_summary", "print summary when deinitializing muxer", OFF(print_deinit_summary),
{NULL}
}

Definition at line 131 of file fifo_muxer.c.

◆ failing_muxer_class

const AVClass failing_muxer_class
static
Initial value:
= {
.class_name = "Fifo test muxer",
.item_name = av_default_item_name,
.option = fifo_test_options,
}

Definition at line 141 of file fifo_muxer.c.

◆ ff_fifo_test_muxer

const FFOutputFormat ff_fifo_test_muxer
Initial value:
= {
.p.name = "fifo_test",
.p.long_name = NULL_IF_CONFIG_SMALL("Fifo test muxer"),
.priv_data_size = sizeof(FifoTestMuxerContext),
.p.priv_class = &failing_muxer_class,
.p.flags = AVFMT_NOFILE,
.flags_internal = FF_OFMT_FLAG_ALLOW_FLUSH,
}

Definition at line 148 of file fifo_muxer.c.

Referenced by fifo_init().

◆ tests

const TestCase tests[]
Initial value:
= {
{fifo_basic_test, "nonfail test", NULL,1, 0, 0, {0, 0, 0}},
{fifo_basic_test, "recovery test", "attempt_recovery=1:recovery_wait_time=0",
0, 0, 0, {AVERROR(ETIMEDOUT), 3, 0}},
{fifo_basic_test, "overflow without packet dropping","queue_size=3",
1, 0, 0, {0, 0, SLEEPTIME_10_MS}},
{fifo_overflow_drop_test, "overflow with packet dropping", "queue_size=3:drop_pkts_on_overflow=1",
0, 0, 0, {0, 0, SLEEPTIME_50_MS}},
{NULL}
}

Definition at line 367 of file fifo_muxer.c.

Referenced by check_add_put_clamped(), check_inv_trans_adding(), check_loop_filter(), checkasm_check_h264pred(), and main().

FifoTestMuxerContext
Definition: fifo_muxer.c:54
fifo_test_packet
static int fifo_test_packet(AVFormatContext *avf, AVPacket *pkt)
Definition: fifo_muxer.c:72
AVERROR
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining all references to the list are updated That means that if a filter requires that its input and output have the same format amongst a supported all it has to do is use a reference to the same list of formats query_formats can leave some formats unset and return AVERROR(EAGAIN) to cause the negotiation mechanism toagain later. That can be used by filters with complex requirements to use the format negotiated on one link to set the formats supported on another. Frame references ownership and permissions
deinit
static void deinit(AVFormatContext *s)
Definition: chromaprint.c:50
fifo_overflow_drop_test
static int fifo_overflow_drop_test(AVFormatContext *oc, AVDictionary **opts, AVPacket *pkt, const FailingMuxerPacketData *data)
Definition: fifo_muxer.c:254
fifo_test_header
static int fifo_test_header(AVFormatContext *avf)
Definition: fifo_muxer.c:66
fifo_basic_test
static int fifo_basic_test(AVFormatContext *oc, AVDictionary **opts, AVPacket *pkt, const FailingMuxerPacketData *pkt_data)
Definition: fifo_muxer.c:205
failing_deinit
static void failing_deinit(AVFormatContext *avf)
Definition: fifo_muxer.c:113
fifo_test_options
static const AVOption fifo_test_options[]
Definition: fifo_muxer.c:131
SLEEPTIME_10_MS
#define SLEEPTIME_10_MS
Definition: fifo_muxer.c:44
failing_muxer_class
static const AVClass failing_muxer_class
Definition: fifo_muxer.c:141
LIBAVUTIL_VERSION_INT
#define LIBAVUTIL_VERSION_INT
Definition: version.h:85
OFF
#define OFF(x)
Definition: fifo_muxer.c:130
NULL
#define NULL
Definition: coverity.c:32
write_trailer
static int write_trailer(AVFormatContext *s1)
Definition: v4l2enc.c:101
av_default_item_name
const char * av_default_item_name(void *ptr)
Return the context name.
Definition: log.c:237
AV_OPT_FLAG_ENCODING_PARAM
#define AV_OPT_FLAG_ENCODING_PARAM
A generic parameter which can be set by the user for muxing or encoding.
Definition: opt.h:269
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:106
FF_OFMT_FLAG_ALLOW_FLUSH
#define FF_OFMT_FLAG_ALLOW_FLUSH
This flag indicates that the muxer stores data internally and supports flushing it.
Definition: mux.h:38
AVFMT_NOFILE
#define AVFMT_NOFILE
Demuxer will use avio_open, no opened file should be provided by the caller.
Definition: avformat.h:468
fifo_test_trailer
static int fifo_test_trailer(AVFormatContext *avf)
Definition: fifo_muxer.c:107
write_packet
static int write_packet(Muxer *mux, OutputStream *ost, AVPacket *pkt)
Definition: ffmpeg_mux.c:209
AV_OPT_TYPE_INT
@ AV_OPT_TYPE_INT
Definition: opt.h:235
AV_OPT_TYPE_BOOL
@ AV_OPT_TYPE_BOOL
Definition: opt.h:251
write_header
static void write_header(FFV1Context *f)
Definition: ffv1enc.c:346
SLEEPTIME_50_MS
#define SLEEPTIME_50_MS
Definition: fifo_muxer.c:43