Go to the documentation of this file.
29 #define MAX_TST_PACKETS 128
30 #define SLEEPTIME_50_MS 50000
31 #define SLEEPTIME_10_MS 10000
46 memcpy(
pkt->
data, pkt_data,
sizeof(*pkt_data));
61 fprintf(stderr,
"Failed to create format context: %s\n",
68 fprintf(stderr,
"Failed to create stream: %s\n",
87 fprintf(stderr,
"Unexpected write_header failure: %s\n",
92 for (
i = 0;
i < 15;
i++ ) {
95 fprintf(stderr,
"Failed to prepare test packet: %s\n",
97 goto write_trailer_and_fail;
102 fprintf(stderr,
"Unexpected write_frame error: %s\n",
104 goto write_trailer_and_fail;
110 fprintf(stderr,
"Unexpected write_frame error during flushing: %s\n",
112 goto write_trailer_and_fail;
117 fprintf(stderr,
"Unexpected write_trailer error during flushing: %s\n",
123 write_trailer_and_fail:
133 int64_t write_pkt_start, write_pkt_end,
duration;
137 fprintf(stderr,
"Unexpected write_header failure: %s\n",
143 for (
i = 0;
i < 6;
i++ ) {
146 fprintf(stderr,
"Failed to prepare test packet: %s\n",
158 duration = write_pkt_end - write_pkt_start;
160 fprintf(stderr,
"Writing packets to fifo muxer took too much time while testing"
161 "buffer overflow with drop_pkts_on_overflow was on.\n");
167 fprintf(stderr,
"Unexpected write_packet error: %s\n",
av_err2str(
ret));
173 fprintf(stderr,
"Unexpected write_trailer error: %s\n",
av_err2str(
ret));
195 #define BUFFER_SIZE 64
207 fprintf(stderr,
"Muxer initialization failed: %s\n",
av_err2str(
ret));
214 fprintf(stderr,
"Failed to parse options: %s\n",
av_err2str(
ret));
220 "print_deinit_summary=%d:write_header_ret=%d:write_trailer_ret=%d",
221 (
int)
test->print_summary_on_deinit,
test->write_header_ret,
222 test->write_trailer_ret);
225 if (
ret < 0 || ret1 < 0) {
226 fprintf(stderr,
"Failed to set options for test muxer: %s\n",
234 printf(
"%s: %s\n",
test->test_name,
ret < 0 ?
"fail" :
"ok");
249 {
fifo_basic_test,
"recovery test",
"attempt_recovery=1:recovery_wait_time=0",
250 0, 0, 0, {
AVERROR(ETIMEDOUT), 3, 0}},
270 int main(
int argc,
char *argv[])
272 int i,
ret, ret_all = 0;
276 if (!ret_all &&
ret < 0)
void av_packet_unref(AVPacket *pkt)
Wipe the packet.
int64_t av_gettime_relative(void)
Get the current time in microseconds since some unspecified starting point.
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
AVStream * avformat_new_stream(AVFormatContext *s, const AVCodec *c)
Add a new stream to a media file.
static int run_test(const TestCase *test)
static int fifo_overflow_drop_test(AVFormatContext *oc, AVDictionary **opts, AVPacket *pkt, const FailingMuxerPacketData *data)
int64_t duration
Duration of this packet in AVStream->time_base units, 0 if unknown.
void av_packet_free(AVPacket **pkt)
Free the packet, if the packet is reference counted, it will be unreferenced first.
static int fifo_basic_test(AVFormatContext *oc, AVDictionary **opts, AVPacket *pkt, const FailingMuxerPacketData *pkt_data)
int av_new_packet(AVPacket *pkt, int size)
Allocate the payload of a packet and initialize its fields with default values.
av_warn_unused_result int avformat_write_header(AVFormatContext *s, AVDictionary **options)
Allocate the stream private data and write the stream header to an output media file.
uint8_t print_summary_on_deinit
int av_write_frame(AVFormatContext *s, AVPacket *pkt)
Write a packet to an output media file.
static int initialize_fifo_tst_muxer_chain(AVFormatContext **oc, AVPacket **pkt)
#define av_err2str(errnum)
Convenience macro, the return value should be used only directly in function arguments but never stan...
FailingMuxerPacketData pkt_data
printf("static const uint8_t my_array[100] = {\n")
int64_t dts
Decompression timestamp in AVStream->time_base units; the time at which the packet is decompressed.
AVPacket * av_packet_alloc(void)
Allocate an AVPacket and set its fields to default values.
void av_dict_free(AVDictionary **pm)
Free all the memory allocated for an AVDictionary struct and all keys and values.
int av_write_trailer(AVFormatContext *s)
Write the stream trailer to an output media file and free the file private data.
int main(int argc, char *argv[])
#define i(width, name, range_min, range_max)
int64_t pts
Presentation timestamp in AVStream->time_base units; the time at which the decompressed packet will b...
the frame and frame reference mechanism is intended to as much as expensive copies of that data while still allowing the filters to produce correct results The data is stored in buffers represented by AVFrame structures Several references can point to the same frame buffer
void avformat_free_context(AVFormatContext *s)
Free an AVFormatContext and all its streams.
int av_dict_parse_string(AVDictionary **pm, const char *str, const char *key_val_sep, const char *pairs_sep, int flags)
Parse the key/value pairs list and add the parsed entries to a dictionary.
int(* test_func)(AVFormatContext *, AVDictionary **, AVPacket *, const FailingMuxerPacketData *pkt_data)
static int prepare_packet(AVPacket *pkt, const FailingMuxerPacketData *pkt_data, int64_t pts)
This structure stores compressed data.
int av_dict_set(AVDictionary **pm, const char *key, const char *value, int flags)
Set the given entry in *pm, overwriting an existing entry.
#define AVERROR_BUG
Internal bug, also see AVERROR_BUG2.