FFmpeg
Data Structures | Macros | Enumerations | Functions | Variables
tee.c File Reference
#include "libavutil/avutil.h"
#include "libavutil/avstring.h"
#include "libavutil/mem.h"
#include "libavutil/opt.h"
#include "libavcodec/bsf.h"
#include "internal.h"
#include "avformat.h"
#include "mux.h"
#include "tee_common.h"

Go to the source code of this file.

Data Structures

struct  TeeSlave
 
struct  TeeContext
 

Macros

#define DEFAULT_SLAVE_FAILURE_POLICY   ON_SLAVE_FAILURE_ABORT
 
#define OFFSET(x)   offsetof(TeeContext, x)
 
#define CONSUME_OPTION(option, field, action)
 
#define STEAL_OPTION(option, field)
 
#define PROCESS_OPTION(option, function, on_error)
 

Enumerations

enum  SlaveFailurePolicy { ON_SLAVE_FAILURE_ABORT = 1, ON_SLAVE_FAILURE_IGNORE = 2 }
 

Functions

static int parse_slave_failure_policy_option (const char *opt, TeeSlave *tee_slave)
 
static int parse_slave_fifo_policy (const char *use_fifo, TeeSlave *tee_slave)
 
static int parse_slave_fifo_options (const char *fifo_options, TeeSlave *tee_slave)
 
static int close_slave (TeeSlave *tee_slave)
 
static void close_slaves (AVFormatContext *avf)
 
static int open_slave (AVFormatContext *avf, char *slave, TeeSlave *tee_slave)
 
static void log_slave (TeeSlave *slave, void *log_ctx, int log_level)
 
static int tee_process_slave_failure (AVFormatContext *avf, unsigned slave_idx, int err_n)
 
static int tee_write_header (AVFormatContext *avf)
 
static int tee_write_trailer (AVFormatContext *avf)
 
static int tee_write_packet (AVFormatContext *avf, AVPacket *pkt)
 

Variables

static const char *const slave_delim = "|"
 
static const char *const slave_bsfs_spec_sep = "/"
 
static const char *const slave_select_sep = ","
 
static const AVOption options []
 
static const AVClass tee_muxer_class
 
const FFOutputFormat ff_tee_muxer
 

Macro Definition Documentation

◆ DEFAULT_SLAVE_FAILURE_POLICY

#define DEFAULT_SLAVE_FAILURE_POLICY   ON_SLAVE_FAILURE_ABORT

Definition at line 38 of file tee.c.

◆ OFFSET

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

Definition at line 67 of file tee.c.

◆ CONSUME_OPTION

#define CONSUME_OPTION (   option,
  field,
  action 
)
Value:
do { \
AVDictionaryEntry *en = av_dict_get(options, option, NULL, 0); \
if (en) { \
field = en->value; \
{ action } \
av_dict_set(&options, option, NULL, 0); \
} \
} while (0)

◆ STEAL_OPTION

#define STEAL_OPTION (   option,
  field 
)
Value:
en->value = NULL; /* prevent it from being freed */)

◆ PROCESS_OPTION

#define PROCESS_OPTION (   option,
  function,
  on_error 
)
Value:
do { \
const char *value; \
CONSUME_OPTION(option, value, if ((ret = function) < 0) \
{ { on_error } goto end; }); \
} while (0)

Enumeration Type Documentation

◆ SlaveFailurePolicy

Enumerator
ON_SLAVE_FAILURE_ABORT 
ON_SLAVE_FAILURE_IGNORE 

Definition at line 33 of file tee.c.

Function Documentation

◆ parse_slave_failure_policy_option()

static int parse_slave_failure_policy_option ( const char *  opt,
TeeSlave tee_slave 
)
inlinestatic

Definition at line 83 of file tee.c.

Referenced by open_slave().

◆ parse_slave_fifo_policy()

static int parse_slave_fifo_policy ( const char *  use_fifo,
TeeSlave tee_slave 
)
static

Definition at line 100 of file tee.c.

Referenced by open_slave().

◆ parse_slave_fifo_options()

static int parse_slave_fifo_options ( const char *  fifo_options,
TeeSlave tee_slave 
)
static

Definition at line 114 of file tee.c.

Referenced by open_slave().

◆ close_slave()

static int close_slave ( TeeSlave tee_slave)
static

Definition at line 119 of file tee.c.

Referenced by close_slaves(), tee_process_slave_failure(), and tee_write_trailer().

◆ close_slaves()

static void close_slaves ( AVFormatContext avf)
static

Definition at line 145 of file tee.c.

Referenced by tee_write_header().

◆ open_slave()

static int open_slave ( AVFormatContext avf,
char *  slave,
TeeSlave tee_slave 
)
static

Definition at line 155 of file tee.c.

Referenced by tee_write_header().

◆ log_slave()

static void log_slave ( TeeSlave slave,
void *  log_ctx,
int  log_level 
)
static

Definition at line 408 of file tee.c.

Referenced by tee_write_header().

◆ tee_process_slave_failure()

static int tee_process_slave_failure ( AVFormatContext avf,
unsigned  slave_idx,
int  err_n 
)
static

Definition at line 427 of file tee.c.

Referenced by tee_write_header(), tee_write_packet(), and tee_write_trailer().

◆ tee_write_header()

static int tee_write_header ( AVFormatContext avf)
static

Definition at line 449 of file tee.c.

◆ tee_write_trailer()

static int tee_write_trailer ( AVFormatContext avf)
static

Definition at line 515 of file tee.c.

◆ tee_write_packet()

static int tee_write_packet ( AVFormatContext avf,
AVPacket pkt 
)
static

Definition at line 531 of file tee.c.

Variable Documentation

◆ slave_delim

const char* const slave_delim = "|"
static

Definition at line 63 of file tee.c.

Referenced by tee_write_header().

◆ slave_bsfs_spec_sep

const char* const slave_bsfs_spec_sep = "/"
static

Definition at line 64 of file tee.c.

Referenced by open_slave().

◆ slave_select_sep

const char* const slave_select_sep = ","
static

Definition at line 65 of file tee.c.

Referenced by open_slave().

◆ options

const AVOption options[]
static
Initial value:
= {
{"use_fifo", "Use fifo pseudo-muxer to separate actual muxers from encoder",
OFFSET(use_fifo), AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, AV_OPT_FLAG_ENCODING_PARAM},
{"fifo_options", "fifo pseudo-muxer options", OFFSET(fifo_options),
{NULL}
}

Definition at line 68 of file tee.c.

◆ tee_muxer_class

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

Definition at line 76 of file tee.c.

◆ ff_tee_muxer

const FFOutputFormat ff_tee_muxer
Initial value:
= {
.p.name = "tee",
.p.long_name = NULL_IF_CONFIG_SMALL("Multiple muxer tee"),
.priv_data_size = sizeof(TeeContext),
.p.priv_class = &tee_muxer_class,
.flags_internal = FF_OFMT_FLAG_ALLOW_FLUSH,
}

Definition at line 605 of file tee.c.

OFFSET
#define OFFSET(x)
Definition: tee.c:67
tee_write_trailer
static int tee_write_trailer(AVFormatContext *avf)
Definition: tee.c:515
tee_write_packet
static int tee_write_packet(AVFormatContext *avf, AVPacket *pkt)
Definition: tee.c:531
av_dict_get
AVDictionaryEntry * av_dict_get(const AVDictionary *m, const char *key, const AVDictionaryEntry *prev, int flags)
Get a dictionary entry with matching key.
Definition: dict.c:62
on_error
static void on_error(FFAMediaCodec *codec, void *userdata, int error, const char *detail)
Definition: mediacodecenc.c:243
tee_muxer_class
static const AVClass tee_muxer_class
Definition: tee.c:76
field
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this field
Definition: writing_filters.txt:78
option
option
Definition: libkvazaar.c:320
LIBAVUTIL_VERSION_INT
#define LIBAVUTIL_VERSION_INT
Definition: version.h:85
NULL
#define NULL
Definition: coverity.c:32
write_trailer
static int write_trailer(AVFormatContext *s1)
Definition: v4l2enc.c:101
AV_OPT_TYPE_DICT
@ AV_OPT_TYPE_DICT
Underlying C type is AVDictionary*.
Definition: opt.h:290
av_default_item_name
const char * av_default_item_name(void *ptr)
Return the context name.
Definition: log.c:237
options
Definition: swscale.c:42
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:352
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
TeeContext
Definition: tee.c:54
options
static const AVOption options[]
Definition: tee.c:68
value
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf default value
Definition: writing_filters.txt:86
CONSUME_OPTION
#define CONSUME_OPTION(option, field, action)
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
ret
ret
Definition: filter_design.txt:187
tee_write_header
static int tee_write_header(AVFormatContext *avf)
Definition: tee.c:449
AV_OPT_TYPE_BOOL
@ AV_OPT_TYPE_BOOL
Underlying C type is int.
Definition: opt.h:327
write_header
static void write_header(FFV1Context *f)
Definition: ffv1enc.c:348