36 #define DEFAULT_SLAVE_FAILURE_POLICY ON_SLAVE_FAILURE_ABORT
97 if (tee_slave->
bsfs) {
132 char *subselect =
NULL, *next_subselect =
NULL, *first_subselect =
NULL, *tmp_select =
NULL;
137 #define STEAL_OPTION(option, field) do { \
138 if ((entry = av_dict_get(options, option, NULL, 0))) { \
139 field = entry->value; \
140 entry->value = NULL; \
141 av_dict_set(&options, option, NULL, 0); \
152 "Invalid onfail option value, valid options are 'abort' and 'ignore'\n");
159 tee_slave->
avf = avf2;
183 first_subselect = tmp_select;
184 next_subselect =
NULL;
186 first_subselect =
NULL;
191 "Invalid stream specifier '%s' for output '%s'\n",
234 if (!tee_slave->
bsfs) {
241 const char *spec = entry->
key + strlen(
"bsfs");
245 "Specifier separator in '%s' is '%c', but only characters '%s' "
257 "Invalid stream specifier '%s' in bsfs option '%s' for slave "
258 "output '%s'\n", spec, entry->
key, filename);
264 "output '%s'\n", spec, entry->
value, i, filename);
265 if (tee_slave->
bsfs[i]) {
267 "Duplicate bsfs specification associated to stream %d of slave "
268 "output '%s', filters will be ignored\n", i, filename);
274 "Error parsing bitstream filter sequence '%s' associated to "
275 "stream %d of slave output '%s'\n", entry->
value, i, filename);
286 if (target_stream < 0)
289 if (!tee_slave->
bsfs[target_stream]) {
294 "Failed to create pass-through bitstream filter: %s\n",
309 "Failed to initialize bitstream filter(s): %s\n",
335 av_log(log_ctx, log_level,
"filename:'%s' format:%s\n",
340 const char *bsf_name;
342 av_log(log_ctx, log_level,
" stream:%d codec:%s type:%s",
348 av_log(log_ctx, log_level,
" bsfs: %s\n", bsf_name);
368 av_log(avf,
AV_LOG_ERROR,
"Slave muxer #%u failed: %s, continuing with %u/%u slaves.\n",
377 unsigned nb_slaves = 0, i;
378 const char *filename = avf->
filename;
379 char **slaves =
NULL;
403 for (i = 0; i < nb_slaves; i++) {
421 "to any slave.\n", i);
427 for (i = 0; i < nb_slaves; i++)
437 int ret_all = 0, ret;
443 if (!ret_all && ret < 0)
457 int ret_all = 0, ret;
470 if (!ret_all && ret < 0)
495 if (!ret_all && ret < 0)
504 }
else if (ret < 0) {
517 if (!ret_all && ret < 0)
531 .priv_class = &tee_muxer_class,
void av_bsf_free(AVBSFContext **ctx)
Free a bitstream filter context and everything associated with it; write NULL into the supplied point...
static int tee_write_packet(AVFormatContext *avf, AVPacket *pkt)
const AVClass * priv_class
A class for the private data, used to declare bitstream filter private AVOptions. ...
int av_interleaved_write_frame(AVFormatContext *s, AVPacket *pkt)
Write a packet to an output media file ensuring correct interleaving.
AVIOInterruptCB interrupt_callback
Custom interrupt callbacks for the I/O layer.
#define AV_LOG_WARNING
Something somehow does not look correct.
#define LIBAVUTIL_VERSION_INT
static int tee_write_trailer(AVFormatContext *avf)
enum AVCodecID codec_id
Specific type of the encoded data (the codec used).
const struct AVBitStreamFilter * filter
The bitstream filter this context is an instance of.
The bitstream filter state.
static const char *const slave_bsfs_spec_sep
Convenience header that includes libavutil's core.
static void log_slave(TeeSlave *slave, void *log_ctx, int log_level)
int av_dict_copy(AVDictionary **dst, const AVDictionary *src, int flags)
Copy entries from one AVDictionary struct into another.
SlaveFailurePolicy on_fail
int av_bsf_get_null_filter(AVBSFContext **bsf)
Get null/pass-through bitstream filter.
static int tee_process_slave_failure(AVFormatContext *avf, unsigned slave_idx, int err_n)
static const char *const slave_delim
int av_bsf_init(AVBSFContext *ctx)
Prepare the filter for use, after all the parameters and options have been set.
void * av_calloc(size_t nmemb, size_t size)
Non-inlined equivalent of av_mallocz_array().
const char * class_name
The name of the class; usually it is the same name as the context structure type to which the AVClass...
int av_bsf_receive_packet(AVBSFContext *ctx, AVPacket *pkt)
Retrieve a filtered packet.
AVOutputFormat ff_tee_muxer
static int close_slave(TeeSlave *tee_slave)
static av_cold int end(AVCodecContext *avctx)
static void close_slaves(AVFormatContext *avf)
int avformat_match_stream_specifier(AVFormatContext *s, AVStream *st, const char *spec)
Check if the stream st contained in s is matched by the stream specifier spec.
AVStream * avformat_new_stream(AVFormatContext *s, const AVCodec *c)
Add a new stream to a media file.
AVStream ** streams
A list of all streams in the file.
AVDictionaryEntry * av_dict_get(const AVDictionary *m, const char *key, const AVDictionaryEntry *prev, int flags)
Get a dictionary entry with matching key.
int flags
Flags modifying the (de)muxer behaviour.
#define AV_LOG_VERBOSE
Detailed information.
int av_dynarray_add_nofree(void *tab_ptr, int *nb_ptr, void *elem)
Add an element to a dynamic array.
const OptionDef options[]
static int open_slave(AVFormatContext *avf, char *slave, TeeSlave *tee_slave)
static const char *const slave_select_sep
struct AVOutputFormat * oformat
The output container format.
int av_packet_ref(AVPacket *dst, const AVPacket *src)
Setup a new reference to the data described by a given packet.
int avcodec_parameters_copy(AVCodecParameters *dst, const AVCodecParameters *src)
Copy the contents of src to dst.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
AVDictionary * metadata
Metadata that applies to the whole file.
void av_packet_rescale_ts(AVPacket *pkt, AVRational tb_src, AVRational tb_dst)
Convert valid timing fields (timestamps / durations) in a packet from one timebase to another...
#define DEFAULT_SLAVE_FAILURE_POLICY
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
AVBSFContext ** bsfs
bitstream filters per stream
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
int * stream_map
map from input to output streams indexes, disabled output streams are set to -1
void av_dict_free(AVDictionary **pm)
Free all the memory allocated for an AVDictionary struct and all keys and values. ...
enum AVMediaType codec_type
General type of the encoded data.
AVRational time_base_in
The timebase used for the timestamps of the input packets.
static void * av_mallocz_array(size_t nmemb, size_t size)
char * av_get_token(const char **buf, const char *term)
Unescape the given string until a non escaped terminating char, and return the token corresponding to...
unsigned int nb_streams
Number of elements in AVFormatContext.streams.
char filename[1024]
input or output filename
int ff_tee_parse_slave_options(void *log, char *slave, AVDictionary **options, char **filename)
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.
static const AVClass tee_muxer_class
int av_strcasecmp(const char *a, const char *b)
Locale-independent case-insensitive compare.
AVRational time_base_out
The timebase used for the timestamps of the output packets.
static int write_trailer(AVFormatContext *s1)
int av_bsf_send_packet(AVBSFContext *ctx, AVPacket *pkt)
Submit a packet for filtering.
#define av_err2str(errnum)
Convenience macro, the return value should be used only directly in function arguments but never stan...
const char *(* item_name)(void *ctx)
A pointer to a function which returns the name of a context instance ctx associated with the class...
const char * avcodec_get_name(enum AVCodecID id)
Get the name of a codec.
char * av_strdup(const char *s)
Duplicate a string.
AVIOContext * pb
I/O context.
int av_dict_set(AVDictionary **pm, const char *key, const char *value, int flags)
Set the given entry in *pm, overwriting an existing entry.
static void write_packet(OutputFile *of, AVPacket *pkt, OutputStream *ost)
static const char * format
Describe the class of an AVClass context structure.
void avformat_free_context(AVFormatContext *s)
Free an AVFormatContext and all its streams.
const char * av_get_media_type_string(enum AVMediaType media_type)
Return a string describing the media_type enum, NULL if media_type is unknown.
char * av_strtok(char *s, const char *delim, char **saveptr)
Split the string into several tokens which can be accessed by successive calls to av_strtok()...
int av_bsf_list_parse_str(const char *str, AVBSFContext **bsf)
Parse string describing list of bitstream filters and create single AVBSFContext describing the whole...
#define AVERROR_OPTION_NOT_FOUND
Option not found.
void * priv_data
Format private data.
static void write_header(FFV1Context *f)
int av_write_trailer(AVFormatContext *s)
Write the stream trailer to an output media file and free the file private data.
#define AV_DICT_IGNORE_SUFFIX
Return first entry in a dictionary whose first part corresponds to the search key, ignoring the suffix of the found key string.
AVCodecParameters * codecpar
static int parse_slave_failure_policy_option(const char *opt, TeeSlave *tee_slave)
AVRational time_base
This is the fundamental unit of time (in seconds) in terms of which frame timestamps are represented...
int(* io_open)(struct AVFormatContext *s, AVIOContext **pb, const char *url, int flags, AVDictionary **options)
This structure stores compressed data.
AVCodecParameters * par_in
Parameters of the input stream.
void(* io_close)(struct AVFormatContext *s, AVIOContext *pb)
A callback for closing the streams opened with AVFormatContext.io_open().
static int tee_write_header(AVFormatContext *avf)
#define STEAL_OPTION(option, field)