30 #define FIFO_DEFAULT_QUEUE_SIZE 60 31 #define FIFO_DEFAULT_MAX_RECOVERY_ATTEMPTS 0 32 #define FIFO_DEFAULT_RECOVERY_WAIT_TIME_USEC 5000000 // 5 seconds 142 if (format_options) {
273 " timestamp, recovery will be attempted immediately");
282 "Maximal number of %d recovery attempts reached.\n",
297 int64_t time_since_recovery;
399 fifo_thread_ctx.
avf =
avf;
407 if (ret < 0 || fifo_thread_ctx.recovery_nr > 0) {
446 const char *filename)
489 " only when drop_pkts_on_overflow is also turned on\n");
574 }
else if (ret < 0) {
614 #define OFFSET(x) offsetof(FifoContext, x) 640 {
"recovery_wait_streamtime",
"Use stream time instead of real time while waiting for recovery",
665 .priv_class = &fifo_muxer_class,
static void write_packet(OutputFile *of, AVPacket *pkt, OutputStream *ost, int unqueue)
int(* io_open)(struct AVFormatContext *s, AVIOContext **pb, const char *url, int flags, AVDictionary **options)
A callback for opening new IO streams.
static av_always_inline int pthread_mutex_destroy(pthread_mutex_t *mutex)
#define pthread_mutex_lock(a)
AVIOInterruptCB interrupt_callback
Custom interrupt callbacks for the I/O layer.
void av_thread_message_queue_set_err_recv(AVThreadMessageQueue *mq, int err)
Set the receiving error code.
int av_write_frame(AVFormatContext *s, AVPacket *pkt)
Write a packet to an output media file.
static av_cold int init(AVFilterContext *ctx)
#define AV_LOG_WARNING
Something somehow does not look correct.
#define LIBAVUTIL_VERSION_INT
void av_thread_message_queue_set_free_func(AVThreadMessageQueue *mq, void(*free_func)(void *msg))
Set the optional free message callback function which will be called if an operation is removing mess...
const char * av_default_item_name(void *ptr)
Return the context name.
int av_dict_copy(AVDictionary **dst, const AVDictionary *src, int flags)
Copy entries from one AVDictionary struct into another.
uint8_t drop_until_keyframe
int av_usleep(unsigned usec)
Sleep for a period of time.
pthread_mutex_t overflow_flag_lock
AVDictionary * format_options
const char * class_name
The name of the class; usually it is the same name as the context structure type to which the AVClass...
#define av_assert0(cond)
assert() equivalent, that is always enabled.
int max_recovery_attempts
int av_thread_message_queue_recv(AVThreadMessageQueue *mq, void *msg, unsigned flags)
Receive a message from the queue.
static av_cold int end(AVCodecContext *avctx)
int drop_pkts_on_overflow
int av_thread_message_queue_send(AVThreadMessageQueue *mq, void *msg, unsigned flags)
Send a message on the queue.
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 AVERROR_EOF
End of file.
#define AV_LOG_VERBOSE
Detailed information.
#define AV_OPT_FLAG_ENCODING_PARAM
a generic parameter which can be set by the user for muxing or encoding
int av_packet_ref(AVPacket *dst, const AVPacket *src)
Setup a new reference to the data described by a given packet.
int recovery_wait_streamtime
#define AV_PKT_FLAG_KEY
The packet contains a keyframe.
int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq)
Rescale a 64-bit integer by 2 rational numbers.
#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...
void av_thread_message_flush(AVThreadMessageQueue *mq)
Flush the message queue.
int64_t recovery_wait_time
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
volatile uint8_t overflow_flag
char * url
input or output URL.
void av_dict_free(AVDictionary **pm)
Free all the memory allocated for an AVDictionary struct and all keys and values. ...
simple assert() macros that are a bit more flexible than ISO C assert().
int flags
A combination of AV_PKT_FLAG values.
unsigned int nb_streams
Number of elements in AVFormatContext.streams.
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 int write_trailer(AVFormatContext *s1)
#define av_err2str(errnum)
Convenience macro, the return value should be used only directly in function arguments but never stan...
static av_always_inline int pthread_join(pthread_t thread, void **value_ptr)
static av_always_inline int pthread_mutex_init(pthread_mutex_t *mutex, const pthread_mutexattr_t *attr)
AVOutputFormat * av_guess_format(const char *short_name, const char *filename, const char *mime_type)
Return the output format in the list of registered output formats which best matches the provided par...
#define pthread_mutex_unlock(a)
#define AVERROR_EXIT
Immediate exit was requested; the called function should not be restarted.
int restart_with_keyframe
#define AVERROR_PATCHWELCOME
Not yet implemented in FFmpeg, patches welcome.
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.
static av_always_inline int pthread_create(pthread_t *thread, const pthread_attr_t *attr, void *(*start_routine)(void *), void *arg)
#define AV_LOG_INFO
Standard information.
void av_thread_message_queue_set_err_send(AVThreadMessageQueue *mq, int err)
Set the sending error code.
#define AV_TIME_BASE_Q
Internal time base represented as fractional value.
AVIOContext * pb
I/O context.
void av_packet_unref(AVPacket *pkt)
Wipe the packet.
void(* io_close)(struct AVFormatContext *s, AVIOContext *pb)
A callback for closing the streams opened with AVFormatContext.io_open().
Perform non-blocking operation.
Describe the class of an AVClass context structure.
Rational number (pair of numerator and denominator).
int av_thread_message_queue_alloc(AVThreadMessageQueue **mq, unsigned nelem, unsigned elsize)
Allocate a new message queue.
AVThreadMessageQueue * queue
void avformat_free_context(AVFormatContext *s)
Free an AVFormatContext and all its streams.
int64_t av_gettime_relative(void)
Get the current time in microseconds since some unspecified starting point.
void av_thread_message_queue_free(AVThreadMessageQueue **mq)
Free a message queue.
char * format_options_str
void av_init_packet(AVPacket *pkt)
Initialize optional fields of a packet with default values.
int overflow_flag_lock_initialized
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.
#define AVERROR_MUXER_NOT_FOUND
Muxer not found.
AVRational time_base
This is the fundamental unit of time (in seconds) in terms of which frame timestamps are represented...
This structure stores compressed data.
int64_t pts
Presentation timestamp in AVStream->time_base units; the time at which the decompressed packet will b...
#define AV_NOPTS_VALUE
Undefined timestamp value.