FFmpeg
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Functions | Variables
fifo_muxer.c File Reference
#include <stdlib.h>
#include "libavutil/opt.h"
#include "libavutil/time.h"
#include "libavutil/avassert.h"
#include "libavformat/avformat.h"
#include "libavformat/url.h"

Go to the source code of this file.

Data Structures

struct  FailingMuxerPacketData
 
struct  FailingMuxerContext
 
struct  TestCase
 

Macros

#define MAX_TST_PACKETS   128
 
#define SLEEPTIME_50_MS   50000
 
#define SLEEPTIME_10_MS   10000
 
#define OFFSET(x)   offsetof(FailingMuxerContext, x)
 
#define BUFFER_SIZE   64
 

Functions

static int failing_write_header (AVFormatContext *avf)
 
static int failing_write_packet (AVFormatContext *avf, AVPacket *pkt)
 
static int failing_write_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)
 
static int fifo_basic_test (AVFormatContext *oc, AVDictionary **opts, const FailingMuxerPacketData *pkt_data)
 
static int fifo_write_header_err_tst (AVFormatContext *oc, AVDictionary **opts, const FailingMuxerPacketData *pkt_data)
 
static int fifo_overflow_drop_test (AVFormatContext *oc, AVDictionary **opts, const FailingMuxerPacketData *data)
 
static int run_test (const TestCase *test)
 
int main (int argc, char *argv[])
 

Variables

static const AVOption options []
 
static const AVClass failing_muxer_class
 
AVOutputFormat tst_failing_muxer
 
const TestCase tests []
 

Macro Definition Documentation

#define MAX_TST_PACKETS   128

Definition at line 29 of file fifo_muxer.c.

Referenced by fifo_write_header_err_tst().

#define SLEEPTIME_50_MS   50000

Definition at line 30 of file fifo_muxer.c.

Referenced by fifo_overflow_drop_test().

#define SLEEPTIME_10_MS   10000

Definition at line 31 of file fifo_muxer.c.

Referenced by failing_write_packet().

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

Definition at line 119 of file fifo_muxer.c.

#define BUFFER_SIZE   64

Definition at line 352 of file fifo_muxer.c.

Referenced by run_test().

Function Documentation

static int failing_write_header ( AVFormatContext avf)
static

Definition at line 56 of file fifo_muxer.c.

static int failing_write_packet ( AVFormatContext avf,
AVPacket pkt 
)
static

Definition at line 62 of file fifo_muxer.c.

static int failing_write_trailer ( AVFormatContext avf)
static

Definition at line 97 of file fifo_muxer.c.

static void failing_deinit ( AVFormatContext avf)
static

Definition at line 103 of file fifo_muxer.c.

static int prepare_packet ( AVPacket pkt,
const FailingMuxerPacketData pkt_data,
int64_t  pts 
)
static
static int initialize_fifo_tst_muxer_chain ( AVFormatContext **  oc)
static

Definition at line 162 of file fifo_muxer.c.

Referenced by run_test().

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

Definition at line 184 of file fifo_muxer.c.

static int fifo_write_header_err_tst ( AVFormatContext oc,
AVDictionary **  opts,
const FailingMuxerPacketData pkt_data 
)
static

Definition at line 237 of file fifo_muxer.c.

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

Definition at line 285 of file fifo_muxer.c.

static int run_test ( const TestCase test)
static

Definition at line 354 of file fifo_muxer.c.

Referenced by main().

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

Definition at line 429 of file fifo_muxer.c.

Variable Documentation

const AVOption options[]
static
Initial value:
= {
{"write_header_ret", "write_header() return value", OFFSET(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", OFFSET(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", OFFSET(print_deinit_summary),
{NULL}
}
#define OFFSET(x)
Definition: fifo_muxer.c:119
#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:275

Definition at line 120 of file fifo_muxer.c.

const AVClass failing_muxer_class
static
Initial value:
= {
.class_name = "Failing test muxer",
.item_name = av_default_item_name,
.option = options,
}
#define LIBAVUTIL_VERSION_INT
Definition: version.h:85
static const AVOption options[]
Definition: fifo_muxer.c:120
av_default_item_name

Definition at line 130 of file fifo_muxer.c.

AVOutputFormat tst_failing_muxer
Initial value:
= {
.name = "fail",
.long_name = NULL_IF_CONFIG_SMALL("Failing test muxer"),
.priv_data_size = sizeof(FailingMuxerContext),
.deinit = failing_deinit,
.priv_class = &failing_muxer_class,
}
#define AVFMT_ALLOW_FLUSH
Format allows flushing.
Definition: avformat.h:495
static int failing_write_trailer(AVFormatContext *avf)
Definition: fifo_muxer.c:97
static const AVClass failing_muxer_class
Definition: fifo_muxer.c:130
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
Definition: internal.h:176
static int write_trailer(AVFormatContext *s1)
Definition: v4l2enc.c:94
static int failing_write_packet(AVFormatContext *avf, AVPacket *pkt)
Definition: fifo_muxer.c:62
static void write_packet(OutputFile *of, AVPacket *pkt, OutputStream *ost)
Definition: ffmpeg.c:645
static int flags
Definition: cpu.c:47
#define AVFMT_NOFILE
Demuxer will use avio_open, no opened file should be provided by the caller.
Definition: avformat.h:478
static void write_header(FFV1Context *f)
Definition: ffv1enc.c:344
static int failing_write_header(AVFormatContext *avf)
Definition: fifo_muxer.c:56
static void failing_deinit(AVFormatContext *avf)
Definition: fifo_muxer.c:103

Definition at line 137 of file fifo_muxer.c.

const TestCase tests[]
Initial value:
= {
{fifo_basic_test, "nonfail test", NULL,1, 0, 0, {0, 0, 0}},
{fifo_write_header_err_tst, "write header error test", NULL, 0, -1, 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}
}
#define NULL
Definition: coverity.c:32
#define SLEEPTIME_50_MS
Definition: fifo_muxer.c:30
static int fifo_write_header_err_tst(AVFormatContext *oc, AVDictionary **opts, const FailingMuxerPacketData *pkt_data)
Definition: fifo_muxer.c:237
#define AVERROR(e)
Definition: error.h:43
static int fifo_basic_test(AVFormatContext *oc, AVDictionary **opts, const FailingMuxerPacketData *pkt_data)
Definition: fifo_muxer.c:184
#define SLEEPTIME_10_MS
Definition: fifo_muxer.c:31
static int fifo_overflow_drop_test(AVFormatContext *oc, AVDictionary **opts, const FailingMuxerPacketData *data)
Definition: fifo_muxer.c:285

Definition at line 397 of file fifo_muxer.c.

Referenced by checkasm_check_h264pred(), and main().