FFmpeg
Data Structures | Macros | Enumerations | Functions | Variables
fifo.c File Reference
#include <stdatomic.h>
#include "libavutil/avassert.h"
#include "libavutil/opt.h"
#include "libavutil/time.h"
#include "libavutil/thread.h"
#include "libavutil/threadmessage.h"
#include "avformat.h"
#include "internal.h"
#include "mux.h"

Go to the source code of this file.

Data Structures

struct  FifoContext
 
struct  FifoThreadContext
 
struct  FifoMessage
 

Macros

#define FIFO_DEFAULT_QUEUE_SIZE   60
 
#define FIFO_DEFAULT_MAX_RECOVERY_ATTEMPTS   0
 
#define FIFO_DEFAULT_RECOVERY_WAIT_TIME_USEC   5000000
 
#define OFFSET(x)   offsetof(FifoContext, x)
 

Enumerations

enum  FifoMessageType { FIFO_NOOP, FIFO_WRITE_HEADER, FIFO_WRITE_PACKET, FIFO_FLUSH_OUTPUT }
 

Functions

static int fifo_thread_write_header (FifoThreadContext *ctx)
 
static int fifo_thread_flush_output (FifoThreadContext *ctx)
 
static int64_t next_duration (AVFormatContext *avf, AVPacket *pkt, int64_t *last_dts)
 
static int fifo_thread_write_packet (FifoThreadContext *ctx, AVPacket *pkt)
 
static int fifo_thread_write_trailer (FifoThreadContext *ctx)
 
static int fifo_thread_dispatch_message (FifoThreadContext *ctx, FifoMessage *msg)
 
static int is_recoverable (const FifoContext *fifo, int err_no)
 
static void free_message (void *msg)
 
static int fifo_thread_process_recovery_failure (FifoThreadContext *ctx, AVPacket *pkt, int err_no)
 
static int fifo_thread_attempt_recovery (FifoThreadContext *ctx, FifoMessage *msg, int err_no)
 
static int fifo_thread_recover (FifoThreadContext *ctx, FifoMessage *msg, int err_no)
 
static void * fifo_consumer_thread (void *data)
 
static int fifo_mux_init (AVFormatContext *avf, const AVOutputFormat *oformat, const char *filename)
 
static int fifo_init (AVFormatContext *avf)
 
static int fifo_write_header (AVFormatContext *avf)
 
static int fifo_write_packet (AVFormatContext *avf, AVPacket *pkt)
 
static int fifo_write_trailer (AVFormatContext *avf)
 
static void fifo_deinit (AVFormatContext *avf)
 

Variables

static const AVOption options []
 
static const AVClass fifo_muxer_class
 
const FFOutputFormat ff_fifo_muxer
 

Macro Definition Documentation

◆ FIFO_DEFAULT_QUEUE_SIZE

#define FIFO_DEFAULT_QUEUE_SIZE   60

Definition at line 33 of file fifo.c.

◆ FIFO_DEFAULT_MAX_RECOVERY_ATTEMPTS

#define FIFO_DEFAULT_MAX_RECOVERY_ATTEMPTS   0

Definition at line 34 of file fifo.c.

◆ FIFO_DEFAULT_RECOVERY_WAIT_TIME_USEC

#define FIFO_DEFAULT_RECOVERY_WAIT_TIME_USEC   5000000

Definition at line 35 of file fifo.c.

◆ OFFSET

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

Definition at line 671 of file fifo.c.

Enumeration Type Documentation

◆ FifoMessageType

Enumerator
FIFO_NOOP 
FIFO_WRITE_HEADER 
FIFO_WRITE_PACKET 
FIFO_FLUSH_OUTPUT 

Definition at line 111 of file fifo.c.

Function Documentation

◆ fifo_thread_write_header()

static int fifo_thread_write_header ( FifoThreadContext ctx)
static

Definition at line 123 of file fifo.c.

Referenced by fifo_thread_dispatch_message().

◆ fifo_thread_flush_output()

static int fifo_thread_flush_output ( FifoThreadContext ctx)
static

Definition at line 162 of file fifo.c.

Referenced by fifo_thread_dispatch_message().

◆ next_duration()

static int64_t next_duration ( AVFormatContext avf,
AVPacket pkt,
int64_t last_dts 
)
static

Definition at line 171 of file fifo.c.

Referenced by fifo_thread_write_packet(), and fifo_write_packet().

◆ fifo_thread_write_packet()

static int fifo_thread_write_packet ( FifoThreadContext ctx,
AVPacket pkt 
)
static

Definition at line 180 of file fifo.c.

Referenced by fifo_thread_dispatch_message().

◆ fifo_thread_write_trailer()

static int fifo_thread_write_trailer ( FifoThreadContext ctx)
static

Definition at line 223 of file fifo.c.

Referenced by fifo_consumer_thread(), and fifo_thread_attempt_recovery().

◆ fifo_thread_dispatch_message()

static int fifo_thread_dispatch_message ( FifoThreadContext ctx,
FifoMessage msg 
)
static

Definition at line 239 of file fifo.c.

Referenced by fifo_consumer_thread(), and fifo_thread_attempt_recovery().

◆ is_recoverable()

static int is_recoverable ( const FifoContext fifo,
int  err_no 
)
static

Definition at line 266 of file fifo.c.

Referenced by fifo_thread_attempt_recovery().

◆ free_message()

static void free_message ( void *  msg)
static

Definition at line 285 of file fifo.c.

Referenced by fifo_init(), and fifo_thread_attempt_recovery().

◆ fifo_thread_process_recovery_failure()

static int fifo_thread_process_recovery_failure ( FifoThreadContext ctx,
AVPacket pkt,
int  err_no 
)
static

Definition at line 293 of file fifo.c.

Referenced by fifo_thread_attempt_recovery().

◆ fifo_thread_attempt_recovery()

static int fifo_thread_attempt_recovery ( FifoThreadContext ctx,
FifoMessage msg,
int  err_no 
)
static

Definition at line 325 of file fifo.c.

Referenced by fifo_thread_recover().

◆ fifo_thread_recover()

static int fifo_thread_recover ( FifoThreadContext ctx,
FifoMessage msg,
int  err_no 
)
static

Definition at line 396 of file fifo.c.

Referenced by fifo_consumer_thread().

◆ fifo_consumer_thread()

static void* fifo_consumer_thread ( void *  data)
static

Definition at line 422 of file fifo.c.

Referenced by fifo_write_header().

◆ fifo_mux_init()

static int fifo_mux_init ( AVFormatContext avf,
const AVOutputFormat oformat,
const char *  filename 
)
static

Definition at line 485 of file fifo.c.

Referenced by fifo_init().

◆ fifo_init()

static int fifo_init ( AVFormatContext avf)
static

Definition at line 517 of file fifo.c.

◆ fifo_write_header()

static int fifo_write_header ( AVFormatContext avf)
static

Definition at line 563 of file fifo.c.

◆ fifo_write_packet()

static int fifo_write_packet ( AVFormatContext avf,
AVPacket pkt 
)
static

Definition at line 578 of file fifo.c.

◆ fifo_write_trailer()

static int fifo_write_trailer ( AVFormatContext avf)
static

Definition at line 622 of file fifo.c.

◆ fifo_deinit()

static void fifo_deinit ( AVFormatContext avf)
static

Definition at line 661 of file fifo.c.

Variable Documentation

◆ options

const AVOption options[]
static

Definition at line 672 of file fifo.c.

◆ fifo_muxer_class

const AVClass fifo_muxer_class
static
Initial value:
= {
.class_name = "Fifo muxer",
.item_name = av_default_item_name,
.option = options,
}

Definition at line 709 of file fifo.c.

◆ ff_fifo_muxer

const FFOutputFormat ff_fifo_muxer
Initial value:
= {
.p.name = "fifo",
.p.long_name = NULL_IF_CONFIG_SMALL("FIFO queue pseudo-muxer"),
.p.priv_class = &fifo_muxer_class,
.priv_data_size = sizeof(FifoContext),
.flags_internal = FF_OFMT_FLAG_ALLOW_FLUSH,
}

Definition at line 716 of file fifo.c.

fifo_init
static int fifo_init(AVFormatContext *avf)
Definition: fifo.c:517
fifo_deinit
static void fifo_deinit(AVFormatContext *avf)
Definition: fifo.c:661
FifoContext
Definition: fifo.c:37
fifo_write_packet
static int fifo_write_packet(AVFormatContext *avf, AVPacket *pkt)
Definition: fifo.c:578
deinit
static void deinit(AVFormatContext *s)
Definition: chromaprint.c:52
options
static const AVOption options[]
Definition: fifo.c:672
LIBAVUTIL_VERSION_INT
#define LIBAVUTIL_VERSION_INT
Definition: version.h:85
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
fifo_write_header
static int fifo_write_header(AVFormatContext *avf)
Definition: fifo.c:563
init
int(* init)(AVBSFContext *ctx)
Definition: dts2pts.c:368
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:94
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
write_packet
static int write_packet(Muxer *mux, OutputStream *ost, AVPacket *pkt)
Definition: ffmpeg_mux.c:209
AVFMT_TS_NEGATIVE
#define AVFMT_TS_NEGATIVE
Format allows muxing negative timestamps.
Definition: avformat.h:494
fifo_muxer_class
static const AVClass fifo_muxer_class
Definition: fifo.c:709
fifo_write_trailer
static int fifo_write_trailer(AVFormatContext *avf)
Definition: fifo.c:622
write_header
static void write_header(FFV1Context *f)
Definition: ffv1enc.c:348