21 #ifndef AVFORMAT_AVFORMAT_H 22 #define AVFORMAT_AVFORMAT_H 447 typedef struct AVFrac {
448 int64_t val, num, den;
467 #define AVPROBE_SCORE_RETRY (AVPROBE_SCORE_MAX/4) 468 #define AVPROBE_SCORE_STREAM_RETRY (AVPROBE_SCORE_MAX/4-1) 470 #define AVPROBE_SCORE_EXTENSION 50 471 #define AVPROBE_SCORE_MIME 75
472 #define AVPROBE_SCORE_MAX 100
474 #define AVPROBE_PADDING_SIZE 32 477 #define AVFMT_NOFILE 0x0001 478 #define AVFMT_NEEDNUMBER 0x0002 479 #define AVFMT_SHOW_IDS 0x0008 480 #define AVFMT_RAWPICTURE 0x0020 482 #define AVFMT_GLOBALHEADER 0x0040 483 #define AVFMT_NOTIMESTAMPS 0x0080 484 #define AVFMT_GENERIC_INDEX 0x0100 485 #define AVFMT_TS_DISCONT 0x0200 486 #define AVFMT_VARIABLE_FPS 0x0400 487 #define AVFMT_NODIMENSIONS 0x0800 488 #define AVFMT_NOSTREAMS 0x1000 489 #define AVFMT_NOBINSEARCH 0x2000 490 #define AVFMT_NOGENSEARCH 0x4000 491 #define AVFMT_NO_BYTE_SEEK 0x8000 492 #define AVFMT_ALLOW_FLUSH 0x10000 493 #if LIBAVFORMAT_VERSION_MAJOR <= 54 494 #define AVFMT_TS_NONSTRICT 0x8020000 //we try to be compatible to the ABIs of ffmpeg and major forks 496 #define AVFMT_TS_NONSTRICT 0x20000 501 #define AVFMT_TS_NEGATIVE 0x40000 510 #define AVFMT_SEEK_TO_PTS 0x4000000 523 const char *long_name;
524 const char *mime_type;
525 const char *extensions;
542 const struct AVCodecTag *
const *codec_tag;
582 int (*query_codec)(
enum AVCodecID id,
int std_compliance);
585 int64_t *dts, int64_t *wall);
590 void *data,
size_t data_size);
658 const char *long_name;
672 const char *extensions;
674 const struct AVCodecTag *
const *codec_tag;
683 const char *mime_type;
744 int stream_index, int64_t timestamp,
int flags);
751 int64_t *pos, int64_t pos_limit);
771 int (*read_seek2)(
struct AVFormatContext *s,
int stream_index, int64_t min_ts, int64_t ts, int64_t max_ts,
int flags);
814 #define AVINDEX_KEYFRAME 0x0001 820 #define AV_DISPOSITION_DEFAULT 0x0001 821 #define AV_DISPOSITION_DUB 0x0002 822 #define AV_DISPOSITION_ORIGINAL 0x0004 823 #define AV_DISPOSITION_COMMENT 0x0008 824 #define AV_DISPOSITION_LYRICS 0x0010 825 #define AV_DISPOSITION_KARAOKE 0x0020 832 #define AV_DISPOSITION_FORCED 0x0040 833 #define AV_DISPOSITION_HEARING_IMPAIRED 0x0080 834 #define AV_DISPOSITION_VISUAL_IMPAIRED 0x0100 835 #define AV_DISPOSITION_CLEAN_EFFECTS 0x0200 842 #define AV_DISPOSITION_ATTACHED_PIC 0x0400 847 #define AV_DISPOSITION_CAPTIONS 0x10000 848 #define AV_DISPOSITION_DESCRIPTIONS 0x20000 849 #define AV_DISPOSITION_METADATA 0x40000 854 #define AV_PTS_WRAP_IGNORE 0 855 #define AV_PTS_WRAP_ADD_OFFSET 1
856 #define AV_PTS_WRAP_SUB_OFFSET -1
989 #define AVSTREAM_EVENT_FLAG_METADATA_UPDATED 0x0001 1002 #define MAX_STD_TIMEBASES (30*12+30+3+6) 1005 int64_t duration_gcd;
1007 int64_t rfps_duration_sum;
1009 int64_t codec_info_duration;
1010 int64_t codec_info_duration_fields;
1019 int64_t last_duration;
1024 int64_t fps_first_dts;
1025 int fps_first_dts_idx;
1026 int64_t fps_last_dts;
1027 int fps_last_dts_idx;
1043 int64_t last_IP_pts;
1044 int last_IP_duration;
1054 int codec_info_nb_frames;
1065 #define MAX_REORDER_DELAY 16 1070 int nb_index_entries;
1071 unsigned int index_entries_allocated_size;
1091 int stream_identifier;
1093 int64_t interleaver_chunk_size;
1094 int64_t interleaver_chunk_duration;
1108 int skip_to_keyframe;
1122 int64_t start_skip_samples;
1130 int64_t first_discard_sample;
1137 int64_t last_discard_sample;
1143 int nb_decoded_frames;
1149 int64_t mux_ts_offset;
1154 int64_t pts_wrap_reference;
1166 int pts_wrap_behavior;
1171 int update_initial_durations_done;
1182 int64_t last_dts_for_order_check;
1183 uint8_t dts_ordered;
1184 uint8_t dts_misordered;
1189 int inject_global_side_data;
1196 char *recommended_encoder_configuration;
1205 struct FFFrac *priv_pts;
1221 #define AV_PROGRAM_RUNNING 1 1233 unsigned int *stream_index;
1234 unsigned int nb_stream_indexes;
1251 int64_t pts_wrap_reference;
1252 int pts_wrap_behavior;
1255 #define AVFMTCTX_NOHEADER 0x0001 1270 void *data,
size_t data_size);
1351 unsigned int nb_streams;
1371 char filename[1024];
1399 unsigned int packet_size;
1407 #define AVFMT_FLAG_GENPTS 0x0001 1408 #define AVFMT_FLAG_IGNIDX 0x0002
1409 #define AVFMT_FLAG_NONBLOCK 0x0004
1410 #define AVFMT_FLAG_IGNDTS 0x0008
1411 #define AVFMT_FLAG_NOFILLIN 0x0010
1412 #define AVFMT_FLAG_NOPARSE 0x0020
1413 #define AVFMT_FLAG_NOBUFFER 0x0040
1414 #define AVFMT_FLAG_CUSTOM_IO 0x0080
1415 #define AVFMT_FLAG_DISCARD_CORRUPT 0x0100
1416 #define AVFMT_FLAG_FLUSH_PACKETS 0x0200
1423 #define AVFMT_FLAG_BITEXACT 0x0400 1424 #define AVFMT_FLAG_MP4A_LATM 0x8000 1425 #define AVFMT_FLAG_SORT_DTS 0x10000
1426 #define AVFMT_FLAG_PRIV_OPT 0x20000
1427 #define AVFMT_FLAG_KEEP_SIDE_DATA 0x40000
1428 #define AVFMT_FLAG_FAST_SEEK 0x80000
1430 #if FF_API_PROBESIZE_32 1434 unsigned int probesize;
1440 int max_analyze_duration;
1446 unsigned int nb_programs;
1477 unsigned int max_index_size;
1483 unsigned int max_picture_buffer;
1496 unsigned int nb_chapters;
1520 int64_t start_time_realtime;
1534 int error_recognition;
1551 #define FF_FDEBUG_TS 0x0001 1569 int64_t max_interleave_delta;
1575 int strict_std_compliance;
1583 #define AVFMT_EVENT_FLAG_METADATA_UPDATED 0x0001 1598 int avoid_negative_ts;
1599 #define AVFMT_AVOID_NEG_TS_AUTO -1 1600 #define AVFMT_AVOID_NEG_TS_MAKE_NON_NEGATIVE 1
1601 #define AVFMT_AVOID_NEG_TS_MAKE_ZERO 2
1623 int max_chunk_duration;
1639 int use_wallclock_as_timestamps;
1661 int64_t skip_initial_bytes;
1668 unsigned int correct_ts_overflow;
1698 int format_probesize;
1706 char *codec_whitelist;
1714 char *format_whitelist;
1728 int io_repositioned;
1767 int metadata_header_padding;
1785 int64_t output_ts_offset;
1794 #if FF_API_PROBESIZE_32 1795 int64_t max_analyze_duration2;
1797 int64_t max_analyze_duration;
1806 #if FF_API_PROBESIZE_32 1820 uint8_t *dump_separator;
2033 const char *format_name,
const char *filename);
2094 const char *url,
void *logctx,
2095 unsigned int offset,
unsigned int max_probe_size);
2101 const char *url,
void *logctx,
2102 unsigned int offset,
unsigned int max_probe_size);
2189 int wanted_stream_nb,
2306 #define AVSEEK_FLAG_BACKWARD 1 2307 #define AVSEEK_FLAG_BYTE 2
2308 #define AVSEEK_FLAG_ANY 4
2309 #define AVSEEK_FLAG_FRAME 8
2461 const char *filename,
2462 const char *mime_type);
2468 const char *filename,
const char *mime_type,
2487 int64_t *dts, int64_t *wall);
2513 void av_hex_dump(FILE *f,
const uint8_t *buf,
int size);
2527 void av_hex_dump_log(
void *avcl,
int level,
const uint8_t *buf,
int size);
2608 int size,
int distance,
int flags);
2631 char *authorization,
int authorization_size,
2632 char *hostname,
int hostname_size,
2634 char *path,
int path_size,
2666 const char *path,
int number);
2702 int av_match_ext(
const char *filename,
const char *extensions);
2715 int std_compliance);
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.
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.
attribute_deprecated int av_demuxer_open(AVFormatContext *ic)
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.
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 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.
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...
uint8_t * av_stream_get_side_data(AVStream *stream, enum AVPacketSideDataType type, int *size)
Get side information from stream.
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.
int av_write_uncoded_frame_query(AVFormatContext *s, int stream_index)
Test whether a muxer supports uncoded frame.
AVRational av_guess_frame_rate(AVFormatContext *ctx, AVStream *stream, AVFrame *frame)
Guess the frame rate, based on both the container and codec information.
const struct AVCodecTag * avformat_get_mov_audio_tags(void)
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 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.
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.
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)
int avformat_network_init(void)
Do global initialization of network components.
const struct AVCodecTag * avformat_get_riff_audio_tags(void)
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.
int av_probe_input_buffer2(AVIOContext *pb, AVInputFormat **fmt, const char *url, void *logctx, unsigned int offset, unsigned int max_probe_size)
Probe a bytestream to determine the input 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.
int av_probe_input_buffer(AVIOContext *pb, AVInputFormat **fmt, const char *url, void *logctx, unsigned int offset, unsigned int max_probe_size)
Like av_probe_input_buffer2() but returns 0 on success.
AVProgram * av_find_program_from_stream(AVFormatContext *ic, AVProgram *last, int s)
Find the programs which belong to a given stream.
AVCodecID
Identify the syntax and semantics of the bitstream.
int av_index_search_timestamp(AVStream *st, int64_t timestamp, int flags)
Get the index for a specific timestamp.
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.
struct AVCodecParser * parser
struct AVDictionary AVDictionary
int av_read_play(AVFormatContext *s)
Start playing a network-based stream (e.g.
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 avformat_query_codec(const AVOutputFormat *ofmt, enum AVCodecID codec_id, int std_compliance)
Test if the given container can store a codec.
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.
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.
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.
int max_streams
The maximum number of streams.
int av_find_default_stream_index(AVFormatContext *s)
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...
void av_register_input_format(AVInputFormat *format)
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 int read_packet(void *opaque, uint8_t *buf, int buf_size)
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.
AVIOContext * pb
I/O context.
main external API structure.
int av_filename_number_test(const char *filename)
Check whether filename actually is a numbered sequence generator.
Describe the class of an AVClass context structure.
rational number numerator/denominator
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.
static int64_t pts
Global timestamp for the audio frames.
#define attribute_deprecated
int av_seek_frame(AVFormatContext *s, int stream_index, int64_t timestamp, int flags)
Seek to the keyframe at timestamp.
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 avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options)
Read packets of a media file to get stream information.
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.
int avformat_open_input(AVFormatContext **ps, const char *url, AVInputFormat *fmt, AVDictionary **options)
Open an input stream and read the header.
int av_write_trailer(AVFormatContext *s)
Write the stream trailer to an output media file and free the file private data.
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.
#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.
AVInputFormat * av_probe_input_format(AVProbeData *pd, int is_opened)
Guess the file format.
Following API allows user to probe device capabilities (supported codecs, pixel formats, sample formats, resolutions, channel counts, etc).
This structure stores compressed data.
void av_register_all(void)
Initialize libavformat and register all the muxers, demuxers and protocols.
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...