102 #if FF_API_LAVF_BITEXACT && FF_API_LAVF_AVCTX 120 #if FF_API_LAVF_CODEC_TB && FF_API_LAVF_AVCTX 124 "timebase hint to the muxer is deprecated. Set " 125 "AVStream.time_base instead.\n");
131 #if FF_API_LAVF_AVCTX 136 "parameters to muxers is deprecated, use AVStream.codecpar " 179 "(%d/%d) and encoder layer (%d/%d)\n",
208 "Tag %s/0x%08x incompatible with output codec id '%d'\n",
279 #if FF_API_COMPUTE_PKT_FIELDS2 && FF_API_LAVF_AVCTX 284 int delay =
FFMAX(st->codec->has_b_frames, !!st->codec->max_b_frames);
287 if (!s->
internal->missing_ts_warning &&
291 "Timestamps are unset in a packet for stream %d. " 292 "This is deprecated and will stop working in the future. " 293 "Fix your code to set the timestamps properly\n", st->
index);
294 s->
internal->missing_ts_warning = 1;
297 av_log(s,
AV_LOG_TRACE,
"compute_pkt_fields2: pts:%" PRId64
" dts:%" PRId64
" cur_dts:%" PRId64
" b:%d size:%d st:%d\n",
329 "Application provided invalid, non monotonically increasing dts to muxer in stream %d: %" PRId64
" >= %" PRId64
"\n",
335 "pts %" PRId64
" < dts %" PRId64
" in stream %d\n",
381 "Packets poorly interleaved, failed to avoid negative " 382 "timestamp %"PRId64
" in stream %d.\n" 383 "Try -max_interleave_delta 0 as a possible workaround.\n",
389 if (s->
pb && ret >= 0) {
426 #if !FF_API_COMPUTE_PKT_FIELDS2 && FF_API_LAVF_AVCTX 443 "Timestamps are unset in a packet for stream %d\n", st->
index);
453 "Application provided invalid, non monotonically increasing " 454 "dts to muxer in stream %d: %" PRId64
" >= %" PRId64
"\n",
459 if (pkt->
pts < pkt->
dts) {
484 #if FF_API_COMPUTE_PKT_FIELDS2 && FF_API_LAVF_AVCTX 520 while (!compare(s, &(*next_point)->pkt, pkt))
521 next_point = &(*next_point)->
next;
527 assert(!*next_point);
532 this_pktl->
next = *next_point;
535 *next_point = this_pktl;
559 int stream_count = 0;
569 int64_t delta_dts = INT64_MIN;
584 delta_dts =
FFMAX(delta_dts, last_dts - top_dts);
590 "Delay between the first packet and last packet in the " 591 "muxing queue is %"PRId64
" > %"PRId64
": forcing output\n",
671 #if FF_API_COMPUTE_PKT_FIELDS2 && FF_API_LAVF_AVCTX 674 av_log(s,
AV_LOG_TRACE,
"av_interleaved_write_frame size:%d dts:%" PRId64
" pts:%" PRId64
"\n",
693 memset(pkt, 0,
sizeof(*pkt));
#define AV_CODEC_PROP_REORDER
Codec supports frame reordering.
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
static int check_packet(AVFormatContext *s, AVPacket *pkt)
int av_interleaved_write_frame(AVFormatContext *s, AVPacket *pkt)
Write a packet to an output media file ensuring correct interleaving.
int avformat_write_header(AVFormatContext *s, AVDictionary **options)
Allocate the stream private data and write the stream header to an output media file.
int av_write_frame(AVFormatContext *s, AVPacket *pkt)
Write a packet to an output media file.
#define AV_LOG_WARNING
Something somehow does not look correct.
int reorder
Set to 1 if the codec allows reordering, so pts can be different from dts.
int64_t pts_buffer[MAX_REORDER_DELAY+1]
AVRational sample_aspect_ratio
Video only.
void av_opt_set_defaults(void *s)
Set the values of all AVOption fields to their default values.
enum AVCodecID codec_id
Specific type of the encoded data (the codec used).
AVRational sample_aspect_ratio
sample aspect ratio (0 if unknown)
int index
stream index in AVFormatContext
int ff_interleave_packet_per_dts(AVFormatContext *s, AVPacket *out, AVPacket *pkt, int flush)
Interleave a packet per dts in an output media file.
av_log(ac->avr, AV_LOG_TRACE, "%d samples - audio_convert: %s to %s (%s)\, len, av_get_sample_fmt_name(ac->in_fmt), av_get_sample_fmt_name(ac->out_fmt), use_generic ? ac->func_descr_generic :ac->func_descr)
AVIndexEntry * index_entries
Only used if the format does not support seeking natively.
AVFormatInternal * internal
An opaque field for libavformat internal usage.
static int av_cmp_q(AVRational a, AVRational b)
Compare two rationals.
int av_dict_copy(AVDictionary **dst, const AVDictionary *src, int flags)
Copy entries from one AVDictionary struct into another.
size_t av_get_codec_tag_string(char *buf, size_t buf_size, unsigned int codec_tag)
Put a string representing the codec tag codec_tag in buf.
int strict_std_compliance
Allow non-standard and experimental extension.
This struct describes the properties of an encoded stream.
void av_freep(void *arg)
Free a memory block which has been allocated with av_malloc(z)() or av_realloc() and set the pointer ...
Trailer data, which doesn't contain actual content, but only for finalizing the output file...
#define AV_LOG_TRACE
Extremely verbose debugging, useful for libav* development.
int64_t duration
Duration of this packet in AVStream->time_base units, 0 if unknown.
void avio_write_marker(AVIOContext *s, int64_t time, enum AVIODataMarkerType type)
Mark the written bytestream as a specific type.
AVStream ** streams
A list of all streams in the file.
int flags
Flags modifying the (de)muxer behaviour.
int64_t max_interleave_delta
Maximum buffering duration for interleaving.
static int interleave_packet(AVFormatContext *s, AVPacket *out, AVPacket *in, int flush)
Interleave an AVPacket correctly so it can be muxed.
struct AVOutputFormat * oformat
The output container format.
const OptionDef options[]
int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq)
Rescale a 64-bit integer by 2 rational numbers.
AVCodecID
Identify the syntax and semantics of the bitstream.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
AVDictionary * metadata
Metadata that applies to the whole file.
int av_get_bits_per_sample(enum AVCodecID codec_id)
Return codec bits per sample.
void av_free(void *ptr)
Free a memory block which has been allocated with av_malloc(z)() or av_realloc(). ...
static int validate_codec_tag(AVFormatContext *s, AVStream *st)
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
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.
const AVCodecDescriptor * avcodec_descriptor_get(enum AVCodecID id)
int av_compare_ts(int64_t ts_a, AVRational tb_a, int64_t ts_b, AVRational tb_b)
Compare 2 timestamps each in its own timebases.
int props
Codec properties, a combination of AV_CODEC_PROP_* flags.
static int write_packet(AVFormatContext *s, AVPacket *pkt)
common internal API header
unsigned int nb_streams
Number of elements in AVFormatContext.streams.
int block_align
Audio only.
This is any, unlabelled data.
int void avio_flush(AVIOContext *s)
#define AV_CODEC_FLAG_BITEXACT
Use only bitexact stuff (except (I)DCT).
int64_t av_rescale(int64_t a, int64_t b, int64_t c)
Rescale a 64-bit integer with rounding to nearest.
internal header for RIFF based (de)muxers do NOT include this in end user applications ...
int avoid_negative_ts
Avoid negative timestamps during muxing.
Usually treated as AVMEDIA_TYPE_DATA.
static int init_muxer(AVFormatContext *s, AVDictionary **options)
Opaque data information usually sparse.
int ff_interleaved_peek(AVFormatContext *s, int stream, AVPacket *pkt, int add_offset)
Find the next packet in the interleaving queue for the given stream.
AVStreamInternal * internal
An opaque field for libavformat internal usage.
#define AV_TIME_BASE_Q
Internal time base represented as fractional value.
int av_opt_set_dict(void *obj, AVDictionary **options)
AVIOContext * pb
I/O context.
void av_packet_unref(AVPacket *pkt)
Wipe the packet.
int av_dict_set(AVDictionary **pm, const char *key, const char *value, int flags)
Set the given entry in *pm, overwriting an existing entry.
uint8_t pi<< 24) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_U8, uint8_t,(*(const uint8_t *) pi - 0x80) *(1.0f/(1<< 7))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_U8, uint8_t,(*(const uint8_t *) pi - 0x80) *(1.0/(1<< 7))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S16, int16_t,(*(const int16_t *) pi >> 8)+0x80) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S16, int16_t, *(const int16_t *) pi *(1.0f/(1<< 15))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S16, int16_t, *(const int16_t *) pi *(1.0/(1<< 15))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S32, int32_t,(*(const int32_t *) pi >> 24)+0x80) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S32, int32_t, *(const int32_t *) pi *(1.0f/(1U<< 31))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S32, int32_t, *(const int32_t *) pi *(1.0/(1U<< 31))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_FLT, float, av_clip_uint8(lrintf(*(const float *) pi *(1<< 7))+0x80)) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_FLT, float, av_clip_int16(lrintf(*(const float *) pi *(1<< 15)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_FLT, float, av_clipl_int32(llrintf(*(const float *) pi *(1U<< 31)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_DBL, double, av_clip_uint8(lrint(*(const double *) pi *(1<< 7))+0x80)) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_DBL, double, av_clip_int16(lrint(*(const double *) pi *(1<< 15)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_DBL, double, av_clipl_int32(llrint(*(const double *) pi *(1U<< 31)))) #define SET_CONV_FUNC_GROUP(ofmt, ifmt) static void set_generic_function(AudioConvert *ac) { } void ff_audio_convert_free(AudioConvert **ac) { if(! *ac) return;ff_dither_free(&(*ac) ->dc);av_freep(ac);} AudioConvert *ff_audio_convert_alloc(AVAudioResampleContext *avr, enum AVSampleFormat out_fmt, enum AVSampleFormat in_fmt, int channels, int sample_rate, int apply_map) { AudioConvert *ac;int in_planar, out_planar;ac=av_mallocz(sizeof(*ac));if(!ac) return NULL;ac->avr=avr;ac->out_fmt=out_fmt;ac->in_fmt=in_fmt;ac->channels=channels;ac->apply_map=apply_map;if(avr->dither_method !=AV_RESAMPLE_DITHER_NONE &&av_get_packed_sample_fmt(out_fmt)==AV_SAMPLE_FMT_S16 &&av_get_bytes_per_sample(in_fmt) > 2) { ac->dc=ff_dither_alloc(avr, out_fmt, in_fmt, channels, sample_rate, apply_map);if(!ac->dc) { av_free(ac);return NULL;} return ac;} in_planar=ff_sample_fmt_is_planar(in_fmt, channels);out_planar=ff_sample_fmt_is_planar(out_fmt, channels);if(in_planar==out_planar) { ac->func_type=CONV_FUNC_TYPE_FLAT;ac->planes=in_planar ? ac->channels :1;} else if(in_planar) ac->func_type=CONV_FUNC_TYPE_INTERLEAVE;else ac->func_type=CONV_FUNC_TYPE_DEINTERLEAVE;set_generic_function(ac);if(ARCH_AARCH64) ff_audio_convert_init_aarch64(ac);if(ARCH_ARM) ff_audio_convert_init_arm(ac);if(ARCH_X86) ff_audio_convert_init_x86(ac);return ac;} int ff_audio_convert(AudioConvert *ac, AudioData *out, AudioData *in) { int use_generic=1;int len=in->nb_samples;int p;if(ac->dc) { av_log(ac->avr, AV_LOG_TRACE, "%d samples - audio_convert: %s to %s (dithered)\", len, av_get_sample_fmt_name(ac->in_fmt), av_get_sample_fmt_name(ac->out_fmt));return ff_convert_dither(ac-> in
Describe the class of an AVClass context structure.
#define FF_COMPLIANCE_NORMAL
unsigned int avpriv_toupper4(unsigned int x)
rational number numerator/denominator
int avcodec_parameters_from_context(AVCodecParameters *par, const AVCodecContext *codec)
Fill the parameters struct based on the values from the supplied codec context.
int error
contains the error code or 0 if no error happened
This struct describes the properties of a single codec described by an AVCodecID. ...
int sample_rate
Audio only.
int ff_interleave_add_packet(AVFormatContext *s, AVPacket *pkt, int(*compare)(AVFormatContext *, AVPacket *, AVPacket *))
Add packet to AVFormatContext->packet_buffer list, determining its interleaved position using compare...
void av_opt_free(void *obj)
Free all allocated objects in obj.
#define FF_DISABLE_DEPRECATION_WARNINGS
common internal api header.
struct AVPacketList * next
static av_cold void flush(AVCodecContext *avctx)
Flush (reset) the frame ID after seeking.
void av_init_packet(AVPacket *pkt)
Initialize optional fields of a packet with default values.
int64_t nb_frames
number of frames in this stream if known or 0
int av_packet_ref(AVPacket *dst, AVPacket *src)
Setup a new reference to the data described by a given packet.
static int interleave_compare_dts(AVFormatContext *s, AVPacket *next, AVPacket *pkt)
#define FF_ENABLE_DEPRECATION_WARNINGS
void * priv_data
Format private data.
int ff_write_chained(AVFormatContext *dst, int dst_stream, AVPacket *pkt, AVFormatContext *src)
Write a packet to another muxer than the one the user originally intended.
int64_t dts
Decompression timestamp in AVStream->time_base units; the time at which the packet is decompressed...
int av_write_trailer(AVFormatContext *s)
Write the stream trailer to an output media file and free the file private data.
static void comp(unsigned char *dst, int dst_stride, unsigned char *src, int src_stride, int add)
unbuffered private I/O API
AVCodecParameters * codecpar
uint32_t codec_tag
Additional information about the codec (corresponds to the AVI FOURCC).
#define FFSWAP(type, a, b)
AVRational time_base
This is the fundamental unit of time (in seconds) in terms of which frame timestamps are represented...
unsigned int av_codec_get_tag(const struct AVCodecTag *const *tags, enum AVCodecID id)
Get the codec tag for the given codec id id.
This structure stores compressed data.
void * av_mallocz(size_t size)
Allocate a block of size bytes with alignment suitable for all memory accesses (including vectors if ...
static int prepare_input_packet(AVFormatContext *s, AVPacket *pkt)
int64_t pts
Presentation timestamp in AVStream->time_base units; the time at which the decompressed packet will b...
struct AVPacketList * last_in_packet_buffer
last packet in packet_buffer for this stream when muxing.
Header data; this needs to be present for the stream to be decodeable.
#define AV_NOPTS_VALUE
Undefined timestamp value.