21 #ifndef AVFORMAT_AVFORMAT_H
22 #define AVFORMAT_AVFORMAT_H
435 typedef struct AVFrac {
436 int64_t
val, num, den;
455 #define AVPROBE_SCORE_RETRY (AVPROBE_SCORE_MAX/4)
456 #define AVPROBE_SCORE_STREAM_RETRY (AVPROBE_SCORE_MAX/4-1)
458 #define AVPROBE_SCORE_EXTENSION 50
459 #define AVPROBE_SCORE_MIME 75
460 #define AVPROBE_SCORE_MAX 100
462 #define AVPROBE_PADDING_SIZE 32
465 #define AVFMT_NOFILE 0x0001
466 #define AVFMT_NEEDNUMBER 0x0002
467 #define AVFMT_SHOW_IDS 0x0008
468 #define AVFMT_RAWPICTURE 0x0020
470 #define AVFMT_GLOBALHEADER 0x0040
471 #define AVFMT_NOTIMESTAMPS 0x0080
472 #define AVFMT_GENERIC_INDEX 0x0100
473 #define AVFMT_TS_DISCONT 0x0200
474 #define AVFMT_VARIABLE_FPS 0x0400
475 #define AVFMT_NODIMENSIONS 0x0800
476 #define AVFMT_NOSTREAMS 0x1000
477 #define AVFMT_NOBINSEARCH 0x2000
478 #define AVFMT_NOGENSEARCH 0x4000
479 #define AVFMT_NO_BYTE_SEEK 0x8000
480 #define AVFMT_ALLOW_FLUSH 0x10000
481 #if LIBAVFORMAT_VERSION_MAJOR <= 54
482 #define AVFMT_TS_NONSTRICT 0x8020000 //we try to be compatible to the ABIs of ffmpeg and major forks
484 #define AVFMT_TS_NONSTRICT 0x20000
489 #define AVFMT_TS_NEGATIVE 0x40000
498 #define AVFMT_SEEK_TO_PTS 0x4000000
573 int64_t *dts, int64_t *wall);
713 int stream_index, int64_t timestamp,
int flags);
720 int64_t *pos, int64_t pos_limit);
783 #define AVINDEX_KEYFRAME 0x0001
789 #define AV_DISPOSITION_DEFAULT 0x0001
790 #define AV_DISPOSITION_DUB 0x0002
791 #define AV_DISPOSITION_ORIGINAL 0x0004
792 #define AV_DISPOSITION_COMMENT 0x0008
793 #define AV_DISPOSITION_LYRICS 0x0010
794 #define AV_DISPOSITION_KARAOKE 0x0020
801 #define AV_DISPOSITION_FORCED 0x0040
802 #define AV_DISPOSITION_HEARING_IMPAIRED 0x0080
803 #define AV_DISPOSITION_VISUAL_IMPAIRED 0x0100
804 #define AV_DISPOSITION_CLEAN_EFFECTS 0x0200
811 #define AV_DISPOSITION_ATTACHED_PIC 0x0400
816 #define AV_DISPOSITION_CAPTIONS 0x10000
817 #define AV_DISPOSITION_DESCRIPTIONS 0x20000
818 #define AV_DISPOSITION_METADATA 0x40000
823 #define AV_PTS_WRAP_IGNORE 0
824 #define AV_PTS_WRAP_ADD_OFFSET 1
825 #define AV_PTS_WRAP_SUB_OFFSET -1
958 #define AVSTREAM_EVENT_FLAG_METADATA_UPDATED 0x0001
971 #define MAX_STD_TIMEBASES (30*12+7+6)
1018 #define MAX_PROBE_PACKETS 2500
1035 #define MAX_REORDER_DELAY 16
1189 #define AV_PROGRAM_RUNNING 1
1223 #define AVFMTCTX_NOHEADER 0x0001
1375 #define AVFMT_FLAG_GENPTS 0x0001
1376 #define AVFMT_FLAG_IGNIDX 0x0002
1377 #define AVFMT_FLAG_NONBLOCK 0x0004
1378 #define AVFMT_FLAG_IGNDTS 0x0008
1379 #define AVFMT_FLAG_NOFILLIN 0x0010
1380 #define AVFMT_FLAG_NOPARSE 0x0020
1381 #define AVFMT_FLAG_NOBUFFER 0x0040
1382 #define AVFMT_FLAG_CUSTOM_IO 0x0080
1383 #define AVFMT_FLAG_DISCARD_CORRUPT 0x0100
1384 #define AVFMT_FLAG_FLUSH_PACKETS 0x0200
1391 #define AVFMT_FLAG_BITEXACT 0x0400
1392 #define AVFMT_FLAG_MP4A_LATM 0x8000
1393 #define AVFMT_FLAG_SORT_DTS 0x10000
1394 #define AVFMT_FLAG_PRIV_OPT 0x20000
1395 #define AVFMT_FLAG_KEEP_SIDE_DATA 0x40000
1396 #define AVFMT_FLAG_FAST_SEEK 0x80000
1517 #define FF_FDEBUG_TS 0x0001
1549 #define AVFMT_EVENT_FLAG_METADATA_UPDATED 0x0001
1565 #define AVFMT_AVOID_NEG_TS_AUTO -1
1566 #define AVFMT_AVOID_NEG_TS_MAKE_NON_NEGATIVE 1
1567 #define AVFMT_AVOID_NEG_TS_MAKE_ZERO 2
1984 const char *format_name,
const char *filename);
2045 const char *filename,
void *logctx,
2046 unsigned int offset,
unsigned int max_probe_size);
2052 const char *filename,
void *logctx,
2053 unsigned int offset,
unsigned int max_probe_size);
2140 int wanted_stream_nb,
2257 #define AVSEEK_FLAG_BACKWARD 1
2258 #define AVSEEK_FLAG_BYTE 2
2259 #define AVSEEK_FLAG_ANY 4
2260 #define AVSEEK_FLAG_FRAME 8
2412 const char *filename,
2413 const char *mime_type);
2419 const char *filename,
const char *mime_type,
2438 int64_t *dts, int64_t *wall);
2582 char *authorization,
int authorization_size,
2583 char *hostname,
int hostname_size,
2585 char *path,
int path_size,
2617 const char *path,
int number);
2653 int av_match_ext(
const char *filename,
const char *extensions);
2666 int std_compliance);
unsigned int nb_chapters
Number of chapters in AVChapter array.
unsigned int max_index_size
Maximum amount of memory in bytes to use for the index of each stream.
void av_url_split(char *proto, int proto_size, char *authorization, int authorization_size, char *hostname, int hostname_size, int *port_ptr, char *path, int path_size, const char *url)
Split a URL string into components.
int64_t interleaver_chunk_size
int64_t first_dts
Timestamp corresponding to the last dts sync point.
const char const char void * val
int audio_preload
Audio preload in microseconds.
void av_pkt_dump2(FILE *f, const AVPacket *pkt, int dump_payload, const AVStream *st)
Send a nice dump of a packet to the specified file stream.
int64_t start_time_realtime
Start time of the stream in real world time, in microseconds since the Unix epoch (00:00 1st January ...
attribute_deprecated int av_demuxer_open(AVFormatContext *ic)
char * recommended_encoder_configuration
String containing paris of key and values describing recommended encoder configuration.
This structure describes decoded (raw) audio or video data.
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.
ptrdiff_t const GLvoid * data
int av_add_index_entry(AVStream *st, int64_t pos, int64_t timestamp, int size, int distance, int flags)
Add an index entry into a sorted list.
int flush_packets
Flush the I/O context after each packet.
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.
enum AVDurationEstimationMethod duration_estimation_method
The duration field can be estimated through various ways, and this field can be used to know how the ...
int64_t start_skip_samples
If not 0, the number of samples that should be skipped from the start of the stream (the samples are ...
int avformat_open_input(AVFormatContext **ps, const char *filename, AVInputFormat *fmt, AVDictionary **options)
Open an input stream and read the header.
int64_t pts_buffer[MAX_REORDER_DELAY+1]
unsigned int max_picture_buffer
Maximum amount of memory in bytes to use for buffering frames obtained from realtime capture devices...
int event_flags
Flags for the user to detect events happening on the stream.
int av_probe_input_buffer2(AVIOContext *pb, AVInputFormat **fmt, const char *filename, void *logctx, unsigned int offset, unsigned int max_probe_size)
Probe a bytestream to determine the input format.
AVRational av_guess_sample_aspect_ratio(AVFormatContext *format, AVStream *stream, AVFrame *frame)
Guess the sample aspect ratio of a frame, based on both the stream and the frame aspect ratio...
int64_t first_discard_sample
If not 0, the first audio sample that should be discarded from the stream.
int64_t pts_wrap_reference
Internal data to check for wrapping of the time stamp.
AVRational sample_aspect_ratio
sample aspect ratio (0 if unknown)
uint8_t * dump_separator
dump format separator.
int index
stream index in AVFormatContext
int avio_flags
avio flags, used to force AVIO_FLAG_DIRECT.
AVIndexEntry * index_entries
Only used if the format does not support seeking natively.
uint8_t * av_stream_get_side_data(AVStream *stream, enum AVPacketSideDataType type, int *size)
Get side information from stream.
int event_flags
Flags for the user to detect events happening on the file.
int av_get_output_timestamp(struct AVFormatContext *s, int stream, int64_t *dts, int64_t *wall)
Get timing information for the data currently output.
AVInputFormat * av_probe_input_format3(AVProbeData *pd, int is_opened, int *score_ret)
Guess the file format.
AVPacketSideData * side_data
An array of side data that applies to the whole stream (i.e.
int av_write_uncoded_frame_query(AVFormatContext *s, int stream_index)
Test whether a muxer supports uncoded frame.
int ctx_flags
Flags signalling stream properties.
enum AVCodecID subtitle_codec_id
Forced subtitle codec_id.
int strict_std_compliance
Allow non-standard and experimental extension.
int(* open_cb)(struct AVFormatContext *s, AVIOContext **p, const char *url, int flags, const AVIOInterruptCB *int_cb, AVDictionary **options)
Called to open further IO contexts when needed for demuxing.
int64_t last_dts_for_order_check
Internal data to analyze DTS and detect faulty mpeg streams.
int64_t output_ts_offset
Output timestamp offset, in microseconds.
AVRational av_guess_frame_rate(AVFormatContext *ctx, AVStream *stream, AVFrame *frame)
Guess the frame rate, based on both the container and codec information.
unsigned int nb_stream_indexes
const struct AVCodecTag * avformat_get_mov_audio_tags(void)
int stream_identifier
Stream Identifier This is the MPEG-TS stream identifier +1 0 means unknown.
const struct AVCodecTag * avformat_get_riff_video_tags(void)
enum AVCodecID av_codec_get_id(const struct AVCodecTag *const *tags, unsigned int tag)
Get the AVCodecID for the given codec tag tag.
unsigned avformat_version(void)
Return the LIBAVFORMAT_VERSION_INT constant.
const char * avformat_license(void)
Return the libavformat license.
int id
unique ID to identify the chapter
enum AVStreamParseType need_parsing
int id
Format-specific stream ID.
struct AVStream::@141 * info
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.
int nb_side_data
The number of elements in the AVStream.side_data array.
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.
int av_codec_get_tag2(const struct AVCodecTag *const *tags, enum AVCodecID id, unsigned int *tag)
Get the codec tag for the given codec id.
AVFormatContext * avformat_alloc_context(void)
Allocate an AVFormatContext.
int inject_global_side_data
Internal data to inject global side data.
void av_pkt_dump_log2(void *avcl, int level, const AVPacket *pkt, int dump_payload, const AVStream *st)
Send a nice dump of a packet to the log.
const char * avformat_configuration(void)
Return the libavformat build-time configuration.
int flags
Flags modifying the (de)muxer behaviour.
AVProgram * av_new_program(AVFormatContext *s, int id)
int64_t max_interleave_delta
Maximum buffering duration for interleaving.
int64_t probesize2
Maximum size of the data read from input for determining the input container format.
int avformat_network_init(void)
Do global initialization of network components.
const struct AVCodecTag * avformat_get_riff_audio_tags(void)
int fps_probe_size
The number of frames used for determining the framerate in avformat_find_stream_info().
int av_sdp_create(AVFormatContext *ac[], int n_files, char *buf, int size)
Generate an SDP for an RTP session.
int av_match_ext(const char *filename, const char *extensions)
Return a positive value if the given filename has one of the given extensions, 0 otherwise.
const AVClass * avformat_get_class(void)
Get the AVClass for AVFormatContext.
enum AVDiscard discard
selects which program to discard and which to feed to the caller
const OptionDef options[]
unsigned int * stream_index
enum AVCodecID video_codec_id
Forced video codec_id.
int64_t rfps_duration_sum
unsigned int correct_ts_overflow
Correct single timestamp overflows.
struct AVOutputFormat * oformat
The output container format.
const struct AVCodecTag * avformat_get_mov_video_tags(void)
void av_dump_format(AVFormatContext *ic, int index, const char *url, int is_output)
Print detailed information about the input or output format, such as duration, bitrate, streams, container, programs, metadata, side data, codec and time base.
Callback for checking whether to abort blocking functions.
int av_find_best_stream(AVFormatContext *ic, enum AVMediaType type, int wanted_stream_nb, int related_stream, AVCodec **decoder_ret, int flags)
Find the "best" stream in the file.
AVProgram * av_find_program_from_stream(AVFormatContext *ic, AVProgram *last, int s)
Find the programs which belong to a given stream.
int max_ts_probe
Maximum number of packets to read while waiting for the first timestamp.
int format_probesize
number of bytes to read maximally to identify format.
AVCodecID
Identify the syntax and semantics of the bitstream.
AVDictionary * metadata
Metadata that applies to the whole file.
int nb_decoded_frames
Number of internally decoded frames, used internally in libavformat, do not access its lifetime diffe...
int av_index_search_timestamp(AVStream *st, int64_t timestamp, int flags)
Get the index for a specific timestamp.
const AVIOInterruptCB int_cb
void av_hex_dump(FILE *f, const uint8_t *buf, int size)
Send a nice hexadecimal dump of a buffer to the specified file stream.
int64_t pts_wrap_reference
reference dts for wrap detection
int64_t timestamp
Timestamp in AVStream.time_base units, preferably the time from which on correctly decoded frames are...
int av_read_play(AVFormatContext *s)
Start playing a network-based stream (e.g.
int skip_samples
Number of samples to skip at the start of the frame decoded from the next packet. ...
static const uint8_t offset[127][2]
AVRational avg_frame_rate
Average framerate.
New fields can be added to the end with minor version bumps.
Libavcodec external API header.
AVInputFormat * av_probe_input_format2(AVProbeData *pd, int is_opened, int *score_max)
Guess the file format.
int min_distance
Minimum distance between this and the previous keyframe, used to avoid unneeded searching.
AVCodec * audio_codec
Forced audio codec.
char * format_whitelist
',' separated list of allowed demuxers.
AVCodecContext * codec
Codec context associated with this stream.
int avformat_query_codec(const AVOutputFormat *ofmt, enum AVCodecID codec_id, int std_compliance)
Test if the given container can store a codec.
static float distance(float x, float y, int band)
const char * mime_type
mime_type, when known.
int buf_size
Size of buf except extra allocated bytes.
unsigned char * buf
Buffer must have AVPROBE_PADDING_SIZE of extra allocated bytes filled with zero.
unsigned int nb_streams
Number of elements in AVFormatContext.streams.
int64_t fps_first_dts
Those are used for average framerate estimation.
int av_read_pause(AVFormatContext *s)
Pause a network-based stream (e.g.
AVInputFormat * av_find_input_format(const char *short_name)
Find AVInputFormat based on the short name of the input format.
static void callback(void *priv_data, int index, uint8_t *buf, int buf_size, int64_t time, enum dshowDeviceType devtype)
char filename[1024]
input or output filename
int update_initial_durations_done
Internal data to prevent doing update_initial_durations() twice.
enum AVCodecID audio_codec_id
Forced audio codec_id.
enum AVCodecID av_guess_codec(AVOutputFormat *fmt, const char *short_name, const char *filename, const char *mime_type, enum AVMediaType type)
Guess the codec ID based upon muxer and filename.
typedef void(APIENTRY *FF_PFNGLACTIVETEXTUREPROC)(GLenum texture)
int av_find_default_stream_index(AVFormatContext *s)
int av_probe_input_buffer(AVIOContext *pb, AVInputFormat **fmt, const char *filename, void *logctx, unsigned int offset, unsigned int max_probe_size)
Like av_probe_input_buffer2() but returns 0 on success.
int avoid_negative_ts
Avoid negative timestamps during muxing.
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...
int probe_score
format probing score.
void av_register_input_format(AVInputFormat *format)
int64_t skip_initial_bytes
Skip initial bytes when opening stream.
AVOutputFormat * av_oformat_next(const AVOutputFormat *f)
If f is NULL, returns the first registered output format, if f is non-NULL, returns the next register...
int av_get_frame_filename(char *buf, int buf_size, const char *path, int number)
Return in 'buf' the path with 'd' replaced by a number.
static void flush(AVCodecContext *avctx)
uint8_t pts_reorder_error_count[MAX_REORDER_DELAY+1]
int ts_id
Transport stream id.
int metadata_header_padding
Number of bytes to be written as padding in a metadata header.
int64_t end
chapter start/end time in time_base units
int avformat_queue_attached_pictures(AVFormatContext *s)
void av_register_output_format(AVOutputFormat *format)
int avformat_network_deinit(void)
Undo the initialization done by avformat_network_init.
int64_t pts_reorder_error[MAX_REORDER_DELAY+1]
Internal data to generate dts from pts.
int debug
Flags to enable debugging.
AVIOContext * pb
I/O context.
main external API structure.
int io_repositioned
IO repositioned flag.
int av_filename_number_test(const char *filename)
Check whether filename actually is a numbered sequence generator.
attribute_deprecated int max_analyze_duration
uint8_t pi<< 24) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_U8, uint8_t,(*(constuint8_t *) pi-0x80)*(1.0f/(1<< 7))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_U8, uint8_t,(*(constuint8_t *) pi-0x80)*(1.0/(1<< 7))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S16, int16_t,(*(constint16_t *) pi >>8)+0x80) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S16, int16_t,*(constint16_t *) pi *(1.0f/(1<< 15))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S16, int16_t,*(constint16_t *) pi *(1.0/(1<< 15))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S32, int32_t,(*(constint32_t *) pi >>24)+0x80) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S32, int32_t,*(constint32_t *) pi *(1.0f/(1U<< 31))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S32, int32_t,*(constint32_t *) pi *(1.0/(1U<< 31))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_FLT, float, av_clip_uint8(lrintf(*(constfloat *) pi *(1<< 7))+0x80)) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_FLT, float, av_clip_int16(lrintf(*(constfloat *) pi *(1<< 15)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_FLT, float, av_clipl_int32(llrintf(*(constfloat *) pi *(1U<< 31)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_DBL, double, av_clip_uint8(lrint(*(constdouble *) pi *(1<< 7))+0x80)) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_DBL, double, av_clip_int16(lrint(*(constdouble *) pi *(1<< 15)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_DBL, double, av_clipl_int32(llrint(*(constdouble *) pi *(1U<< 31))))#defineSET_CONV_FUNC_GROUP(ofmt, ifmt) staticvoidset_generic_function(AudioConvert *ac){}voidff_audio_convert_free(AudioConvert **ac){if(!*ac) return;ff_dither_free(&(*ac) ->dc);av_freep(ac);}AudioConvert *ff_audio_convert_alloc(AVAudioResampleContext *avr, enumAVSampleFormatout_fmt, enumAVSampleFormatin_fmt, intchannels, intsample_rate, intapply_map){AudioConvert *ac;intin_planar, out_planar;ac=av_mallocz(sizeof(*ac));if(!ac) returnNULL;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);returnNULL;}returnac;}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;}elseif(in_planar) ac->func_type=CONV_FUNC_TYPE_INTERLEAVE;elseac->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);returnac;}intff_audio_convert(AudioConvert *ac, AudioData *out, AudioData *in){intuse_generic=1;intlen=in->nb_samples;intp;if(ac->dc){av_log(ac->avr, AV_LOG_TRACE,"%dsamples-audio_convert:%sto%s(dithered)\n", len, av_get_sample_fmt_name(ac->in_fmt), av_get_sample_fmt_name(ac->out_fmt));returnff_convert_dither(ac-> in
int pts_wrap_behavior
behavior on wrap detection
double(* duration_error)[2][MAX_STD_TIMEBASES]
Describe the class of an AVClass context structure.
rational number numerator/denominator
AVRational display_aspect_ratio
display aspect ratio (0 if unknown)
const AVClass * av_class
A class for logging and AVOptions.
int found_decoder
0 -> decoder has not been searched for yet.
void avformat_free_context(AVFormatContext *s)
Free an AVFormatContext and all its streams.
This structure contains the data a format has to probe a file.
int av_read_frame(AVFormatContext *s, AVPacket *pkt)
Return the next frame of a stream.
int avformat_seek_file(AVFormatContext *s, int stream_index, int64_t min_ts, int64_t ts, int64_t max_ts, int flags)
Seek to timestamp ts.
int seek2any
Force seeking to any (also non key) frames.
int64_t codec_info_duration
static int64_t pts
Global timestamp for the audio frames.
int64_t start_time
Position of the first frame of the component, in AV_TIME_BASE fractional seconds. ...
#define attribute_deprecated
int av_seek_frame(AVFormatContext *s, int stream_index, int64_t timestamp, int flags)
Seek to the keyframe at timestamp.
int64_t duration
Decoding: duration of the stream, in stream time base.
int64_t interleaver_chunk_duration
int av_interleaved_write_uncoded_frame(AVFormatContext *s, int stream_index, AVFrame *frame)
Write a uncoded frame to an output media file.
struct AVPacketList * next
int pts_wrap_behavior
Options for behavior, when a wrap is detected.
int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options)
Read packets of a media file to get stream information.
int64_t start_time
Decoding: pts of the first frame of the stream in presentation order, in stream time base...
AVCodec * video_codec
Forced video codec.
int max_chunk_size
Max chunk size in bytes Note, not all formats support this and unpredictable things may happen if it ...
int error_recognition
Error recognition; higher values will detect more errors but may misdetect some more or less valid pa...
int disposition
AV_DISPOSITION_* bit field.
int pts_wrap_bits
number of bits in pts (used for wrapping control)
AVRational time_base
time base in which the start/end timestamps are specified
av_format_control_message control_message_cb
Callback used by devices to communicate with application.
int64_t nb_frames
number of frames in this stream if known or 0
struct AVInputFormat * iformat
The input container format.
int64_t max_analyze_duration2
Maximum duration (in AV_TIME_BASE units) of the data read from input in avformat_find_stream_info().
void avformat_close_input(AVFormatContext **s)
Close an opened input AVFormatContext.
int av_write_uncoded_frame(AVFormatContext *s, int stream_index, AVFrame *frame)
Write a uncoded frame to an output media file.
int64_t codec_info_duration_fields
unsigned int index_entries_allocated_size
int64_t mux_ts_offset
Timestamp offset added to timestamps before muxing NOT PART OF PUBLIC API.
int skip_to_keyframe
Indicates that everything up to the next keyframe should be discarded.
enum AVCodecID data_codec_id
Forced Data codec_id.
AVCodec * subtitle_codec
Forced subtitle codec.
AVCodec * data_codec
Forced data codec.
char * codec_whitelist
',' separated list of allowed decoders.
int max_chunk_duration
Max chunk time in microseconds.
struct AVCodecParserContext * parser
void * priv_data
Format private data.
int codec_info_nb_frames
Number of frames that have been demuxed during av_find_stream_info()
uint8_t pi<< 24) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_U8, uint8_t,(*(constuint8_t *) pi-0x80)*(1.0f/(1<< 7))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_U8, uint8_t,(*(constuint8_t *) pi-0x80)*(1.0/(1<< 7))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S16, int16_t,(*(constint16_t *) pi >>8)+0x80) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S16, int16_t,*(constint16_t *) pi *(1.0f/(1<< 15))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S16, int16_t,*(constint16_t *) pi *(1.0/(1<< 15))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S32, int32_t,(*(constint32_t *) pi >>24)+0x80) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S32, int32_t,*(constint32_t *) pi *(1.0f/(1U<< 31))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S32, int32_t,*(constint32_t *) pi *(1.0/(1U<< 31))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_FLT, float, av_clip_uint8(lrintf(*(constfloat *) pi *(1<< 7))+0x80)) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_FLT, float, av_clip_int16(lrintf(*(constfloat *) pi *(1<< 15)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_FLT, float, av_clipl_int32(llrintf(*(constfloat *) pi *(1U<< 31)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_DBL, double, av_clip_uint8(lrint(*(constdouble *) pi *(1<< 7))+0x80)) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_DBL, double, av_clip_int16(lrint(*(constdouble *) pi *(1<< 15)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_DBL, double, av_clipl_int32(llrint(*(constdouble *) pi *(1U<< 31))))#defineSET_CONV_FUNC_GROUP(ofmt, ifmt) staticvoidset_generic_function(AudioConvert *ac){}voidff_audio_convert_free(AudioConvert **ac){if(!*ac) return;ff_dither_free(&(*ac) ->dc);av_freep(ac);}AudioConvert *ff_audio_convert_alloc(AVAudioResampleContext *avr, enumAVSampleFormatout_fmt, enumAVSampleFormatin_fmt, intchannels, intsample_rate, intapply_map){AudioConvert *ac;intin_planar, out_planar;ac=av_mallocz(sizeof(*ac));if(!ac) returnNULL;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);returnNULL;}returnac;}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;}elseif(in_planar) ac->func_type=CONV_FUNC_TYPE_INTERLEAVE;elseac->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);returnac;}intff_audio_convert(AudioConvert *ac, AudioData *out, AudioData *in){intuse_generic=1;intlen=in->nb_samples;intp;if(ac->dc){av_log(ac->avr, AV_LOG_TRACE,"%dsamples-audio_convert:%sto%s(dithered)\n", len, av_get_sample_fmt_name(ac->in_fmt), av_get_sample_fmt_name(ac->out_fmt));returnff_convert_dither(ac-> out
int av_write_trailer(AVFormatContext *s)
Write the stream trailer to an output media file and free the file private data.
int bit_rate
Total stream bitrate in bit/s, 0 if not available.
int64_t duration
Duration of the stream, in AV_TIME_BASE fractional seconds.
int avformat_flush(AVFormatContext *s)
Discard all internally buffered data.
void av_hex_dump_log(void *avcl, int level, const uint8_t *buf, int size)
Send a nice hexadecimal dump of a buffer to the log.
AVRational time_base
This is the fundamental unit of time (in seconds) in terms of which frame timestamps are represented...
#define MKTAG(a, b, c, d)
unsigned int av_codec_get_tag(const struct AVCodecTag *const *tags, enum AVCodecID id)
Get the codec tag for the given codec id id.
enum AVDiscard discard
Selects which packets can be discarded at will and do not need to be demuxed.
AVRational r_frame_rate
Real base framerate of the stream.
AVInputFormat * av_probe_input_format(AVProbeData *pd, int is_opened)
Guess the file format.
int request_probe
stream probing state -1 -> probing finished 0 -> no probing requested rest -> perform probing with re...
Following API allows user to probe device capabilities (supported codecs, pixel formats, sample formats, resolutions, channel counts, etc).
int use_wallclock_as_timestamps
forces the use of wallclock timestamps as pts/dts of packets This has undefined results in the presen...
This structure stores compressed data.
void av_register_all(void)
Initialize libavformat and register all the muxers, demuxers and protocols.
AVPacket attached_pic
For streams with AV_DISPOSITION_ATTACHED_PIC disposition, this packet will contain the attached pictu...
struct AVPacketList * last_in_packet_buffer
last packet in packet_buffer for this stream when muxing.
AVInputFormat * av_iformat_next(const AVInputFormat *f)
If f is NULL, returns the first registered input format, if f is non-NULL, returns the next registere...
int64_t last_discard_sample
The sample after last sample that is intended to be discarded after first_discard_sample.