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"
#include "libavformat/network.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 30 of file fifo_muxer.c.

Referenced by fifo_write_header_err_tst().

#define SLEEPTIME_50_MS   50000

Definition at line 31 of file fifo_muxer.c.

Referenced by fifo_overflow_drop_test().

#define SLEEPTIME_10_MS   10000

Definition at line 32 of file fifo_muxer.c.

Referenced by failing_write_packet().

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

Definition at line 120 of file fifo_muxer.c.

#define BUFFER_SIZE   64

Definition at line 356 of file fifo_muxer.c.

Referenced by run_test().

Function Documentation

static int failing_write_header ( AVFormatContext avf)
static

Definition at line 57 of file fifo_muxer.c.

static int failing_write_packet ( AVFormatContext avf,
AVPacket pkt 
)
static

Definition at line 63 of file fifo_muxer.c.

static int failing_write_trailer ( AVFormatContext avf)
static

Definition at line 98 of file fifo_muxer.c.

static void failing_deinit ( AVFormatContext avf)
static

Definition at line 104 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 166 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 188 of file fifo_muxer.c.

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

Definition at line 241 of file fifo_muxer.c.

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

Definition at line 289 of file fifo_muxer.c.

static int run_test ( const TestCase test)
static

Definition at line 358 of file fifo_muxer.c.

Referenced by main().

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

Definition at line 433 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:120
#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 121 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:86
static const AVOption options[]
Definition: fifo_muxer.c:121
av_default_item_name

Definition at line 131 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,
}
static void write_packet(OutputFile *of, AVPacket *pkt, OutputStream *ost, int unqueue)
Definition: ffmpeg.c:671
#define AVFMT_ALLOW_FLUSH
Format allows flushing.
Definition: avformat.h:495
static int flags
Definition: log.c:57
static int failing_write_trailer(AVFormatContext *avf)
Definition: fifo_muxer.c:98
static const AVClass failing_muxer_class
Definition: fifo_muxer.c:131
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
Definition: internal.h:179
static int write_trailer(AVFormatContext *s1)
Definition: v4l2enc.c:94
static int failing_write_packet(AVFormatContext *avf, AVPacket *pkt)
Definition: fifo_muxer.c:63
#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:337
static int failing_write_header(AVFormatContext *avf)
Definition: fifo_muxer.c:57
static void failing_deinit(AVFormatContext *avf)
Definition: fifo_muxer.c:104

Definition at line 138 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:31
static int fifo_write_header_err_tst(AVFormatContext *oc, AVDictionary **opts, const FailingMuxerPacketData *pkt_data)
Definition: fifo_muxer.c:241
#define AVERROR(e)
Definition: error.h:43
static int fifo_basic_test(AVFormatContext *oc, AVDictionary **opts, const FailingMuxerPacketData *pkt_data)
Definition: fifo_muxer.c:188
#define SLEEPTIME_10_MS
Definition: fifo_muxer.c:32
static int fifo_overflow_drop_test(AVFormatContext *oc, AVDictionary **opts, const FailingMuxerPacketData *data)
Definition: fifo_muxer.c:289

Definition at line 401 of file fifo_muxer.c.

Referenced by checkasm_check_h264pred(), and main().