21 #ifndef AVFORMAT_AVFORMAT_H
22 #define AVFORMAT_AVFORMAT_H
203 #include "libavcodec/avcodec.h"
204 #include "libavutil/dict.h"
205 #include "libavutil/log.h"
208 #include "libavformat/version.h"
340 #define AVPROBE_SCORE_RETRY (AVPROBE_SCORE_MAX/4)
341 #define AVPROBE_SCORE_EXTENSION 50
342 #define AVPROBE_SCORE_MAX 100
344 #define AVPROBE_PADDING_SIZE 32
347 #define AVFMT_NOFILE 0x0001
348 #define AVFMT_NEEDNUMBER 0x0002
349 #define AVFMT_SHOW_IDS 0x0008
350 #define AVFMT_RAWPICTURE 0x0020
352 #define AVFMT_GLOBALHEADER 0x0040
353 #define AVFMT_NOTIMESTAMPS 0x0080
354 #define AVFMT_GENERIC_INDEX 0x0100
355 #define AVFMT_TS_DISCONT 0x0200
356 #define AVFMT_VARIABLE_FPS 0x0400
357 #define AVFMT_NODIMENSIONS 0x0800
358 #define AVFMT_NOSTREAMS 0x1000
359 #define AVFMT_NOBINSEARCH 0x2000
360 #define AVFMT_NOGENSEARCH 0x4000
361 #define AVFMT_NO_BYTE_SEEK 0x8000
362 #define AVFMT_ALLOW_FLUSH 0x10000
363 #if LIBAVFORMAT_VERSION_MAJOR <= 54
364 #define AVFMT_TS_NONSTRICT 0x8020000 //we try to be compatible to the ABIs of ffmpeg and major forks
366 #define AVFMT_TS_NONSTRICT 0x20000
371 #define AVFMT_TS_NEGATIVE 0x40000
380 #define AVFMT_SEEK_TO_PTS 0x4000000
455 int64_t *dts, int64_t *wall);
556 int stream_index, int64_t timestamp,
int flags);
563 int64_t *pos, int64_t pos_limit);
608 #define AVINDEX_KEYFRAME 0x0001
614 #define AV_DISPOSITION_DEFAULT 0x0001
615 #define AV_DISPOSITION_DUB 0x0002
616 #define AV_DISPOSITION_ORIGINAL 0x0004
617 #define AV_DISPOSITION_COMMENT 0x0008
618 #define AV_DISPOSITION_LYRICS 0x0010
619 #define AV_DISPOSITION_KARAOKE 0x0020
626 #define AV_DISPOSITION_FORCED 0x0040
627 #define AV_DISPOSITION_HEARING_IMPAIRED 0x0080
628 #define AV_DISPOSITION_VISUAL_IMPAIRED 0x0100
629 #define AV_DISPOSITION_CLEAN_EFFECTS 0x0200
636 #define AV_DISPOSITION_ATTACHED_PIC 0x0400
641 #define AV_DISPOSITION_CAPTIONS 0x10000
642 #define AV_DISPOSITION_DESCRIPTIONS 0x20000
643 #define AV_DISPOSITION_METADATA 0x40000
648 #define AV_PTS_WRAP_IGNORE 0
649 #define AV_PTS_WRAP_ADD_OFFSET 1
650 #define AV_PTS_WRAP_SUB_OFFSET -1
754 #define MAX_STD_TIMEBASES (60*12+6)
795 #define MAX_PROBE_PACKETS 2500
812 #define MAX_REORDER_DELAY 16
896 #define AV_PROGRAM_RUNNING 1
930 #define AVFMTCTX_NOHEADER 0x0001
1037 #define AVFMT_FLAG_GENPTS 0x0001
1038 #define AVFMT_FLAG_IGNIDX 0x0002
1039 #define AVFMT_FLAG_NONBLOCK 0x0004
1040 #define AVFMT_FLAG_IGNDTS 0x0008
1041 #define AVFMT_FLAG_NOFILLIN 0x0010
1042 #define AVFMT_FLAG_NOPARSE 0x0020
1043 #define AVFMT_FLAG_NOBUFFER 0x0040
1044 #define AVFMT_FLAG_CUSTOM_IO 0x0080
1045 #define AVFMT_FLAG_DISCARD_CORRUPT 0x0100
1046 #define AVFMT_FLAG_FLUSH_PACKETS 0x0200
1047 #define AVFMT_FLAG_MP4A_LATM 0x8000
1048 #define AVFMT_FLAG_SORT_DTS 0x10000
1049 #define AVFMT_FLAG_PRIV_OPT 0x20000
1050 #define AVFMT_FLAG_KEEP_SIDE_DATA 0x40000
1158 #define FF_FDEBUG_TS 0x0001
1296 #define RAW_PACKET_BUFFER_SIZE 2500000
1479 #if FF_API_ALLOC_OUTPUT_CONTEXT
1486 const char *filename);
1506 const char *format_name,
const char *filename);
1565 const char *filename,
void *logctx,
1566 unsigned int offset,
unsigned int max_probe_size);
1572 const char *filename,
void *logctx,
1573 unsigned int offset,
unsigned int max_probe_size);
1599 #if FF_API_FORMAT_PARAMETERS
1680 int wanted_stream_nb,
1685 #if FF_API_READ_PACKET
1785 #if FF_API_CLOSE_INPUT_FILE
1805 #if FF_API_NEW_STREAM
1820 #if FF_API_SET_PTS_INFO
1825 void av_set_pts_info(
AVStream *
s,
int pts_wrap_bits,
1826 unsigned int pts_num,
unsigned int pts_den);
1829 #define AVSEEK_FLAG_BACKWARD 1
1830 #define AVSEEK_FLAG_BYTE 2
1831 #define AVSEEK_FLAG_ANY 4
1832 #define AVSEEK_FLAG_FRAME 8
1925 const char *filename,
1926 const char *mime_type);
1932 const char *filename,
const char *mime_type,
1951 int64_t *dts, int64_t *wall);
2090 char *authorization,
int authorization_size,
2091 char *hostname,
int hostname_size,
2093 char *path,
int path_size,
2115 const char *path,
int number);
2150 int av_match_ext(
const char *filename,
const char *extensions);
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
struct AVPacketList * raw_packet_buffer_end
AVOutputFormat * av_oformat_next(AVOutputFormat *f)
If f is NULL, returns the first registered output format, if f is non-NULL, returns the next register...
int audio_preload
Audio preload in microseconds.
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)
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.
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.
struct AVPacketList * packet_buffer_end
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.
AVInputFormat * av_probe_input_format2(AVProbeData *pd, int is_opened, int *score_max)
Guess the file format.
enum AVDurationEstimationMethod duration_estimation_method
The duration field can be estimated through various ways, and this field can be used to know how the ...
int avformat_open_input(AVFormatContext **ps, const char *filename, AVInputFormat *fmt, AVDictionary **options)
Open an input stream and read the header.
int avformat_query_codec(AVOutputFormat *ofmt, enum AVCodecID codec_id, int std_compliance)
Test if the given container can store a codec.
unsigned int max_picture_buffer
Maximum amount of memory in bytes to use for buffering frames obtained from realtime capture devices...
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...
AVCodecContext * codec
Codec context associated with this 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)
int index
stream index in AVFormatContext
int avio_flags
avio flags, used to force AVIO_FLAG_DIRECT.
void av_pkt_dump2(FILE *f, AVPacket *pkt, int dump_payload, AVStream *st)
Send a nice dump of a packet to the specified file 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.
unsigned int skip_initial_bytes
Skip initial bytes when opening stream.
struct AVCodecTag * avformat_get_riff_video_tags(void)
int64_t data_offset
offset of the first packet
int ctx_flags
Format-specific flags, see AVFMTCTX_xx.
enum AVCodecID subtitle_codec_id
Forced subtitle codec_id.
AVCodec * audio_codec
Forced audio codec.
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
int64_t pts_buffer[MAX_REORDER_DELAY+1]
int stream_identifier
Stream Identifier This is the MPEG-TS stream identifier +1 0 means unknown.
AVInputFormat * av_probe_input_format(AVProbeData *pd, int is_opened)
Guess the file format.
struct AVPacketList * last_in_packet_buffer
last packet in packet_buffer for this stream when muxing.
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.
static const uint8_t offset[511][2]
int id
unique ID to identify the chapter
unsigned char * buf
Buffer must have AVPROBE_PADDING_SIZE of extra allocated bytes filled with zero.
enum AVStreamParseType need_parsing
int id
Format-specific stream ID.
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 av_codec_get_tag2(const struct AVCodecTag *const *tags, enum AVCodecID id, unsigned int *tag)
Get the codec tag for the given codec id.
int avformat_network_init(void)
Do global initialization of network components.
AVIndexEntry * index_entries
Only used if the format does not support seeking natively.
int fps_probe_size
decoding: number of frames used to probe fps
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.
enum AVDiscard discard
selects which program to discard and which to feed to the caller
AVStream * avformat_new_stream(AVFormatContext *s, const AVCodec *c)
Add a new stream to a media file.
const OptionDef options[]
int64_t offset
Offset to remap timestamps to be non-negative.
enum AVCodecID video_codec_id
Forced video codec_id.
unsigned int correct_ts_overflow
Correct single timestamp overflows.
AVCodec * video_codec
Forced video codec.
void av_dump_format(AVFormatContext *ic, int index, const char *url, int is_output)
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.
AVInputFormat * av_iformat_next(AVInputFormat *f)
If f is NULL, returns the first registered input format, if f is non-NULL, returns the next registere...
AVCodecID
Identify the syntax and semantics of the bitstream.
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){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));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=av_sample_fmt_is_planar(in_fmt);out_planar=av_sample_fmt_is_planar(out_fmt);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);ff_audio_convert_init_arm(ac);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_dlog(ac->avr,"%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 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.
AVRational offset_timebase
Timebase for the timestamp offset.
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
void * priv_data
Format private data.
char filename[1024]
input or output filename
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.
struct AVInputFormat * iformat
Can only be iformat or oformat, not both at the same time.
#define attribute_deprecated
int skip_samples
Number of samples to skip at the start of the frame decoded from the next packet. ...
AVRational avg_frame_rate
Average framerate.
New fields can be added to the end with minor version bumps.
int min_distance
Minimum distance between this and the previous keyframe, used to avoid unneeded searching.
The exact value of the fractional number is: 'val + num / den'.
static float distance(float x, float y, int band)
int buf_size
Size of buf except extra allocated bytes.
unsigned int nb_streams
A list of all streams in the file.
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.
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.
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.
AVProgram * av_new_program(AVFormatContext *s, int id)
int probe_score
format probing score.
void av_register_input_format(AVInputFormat *format)
unsigned int probesize
decoding: size of data to probe; encoding: unused.
struct AVPacketList * parse_queue_end
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)
int ts_id
Transport stream id.
int raw_packet_buffer_remaining_size
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.
struct AVPacketList * raw_packet_buffer
Raw packets from the demuxer, prior to parsing and decoding.
int debug
Flags to enable debugging.
typedef void(RENAME(mix_any_func_type))
int64_t reference_dts
Timestamp corresponding to the last dts sync point.
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.
int pts_wrap_behavior
behavior on wrap detection
AVIOContext * pb
I/O context.
double(* duration_error)[2][MAX_STD_TIMEBASES]
Describe the class of an AVClass context structure.
#define MKTAG(a, b, c, d)
rational number numerator/denominator
struct AVCodecTag * avformat_get_riff_audio_tags(void)
struct AVStream::@29 * info
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
int64_t start_time
Decoding: position of the first frame of the component, in AV_TIME_BASE fractional seconds...
AVInputFormat * av_probe_input_format3(AVProbeData *pd, int is_opened, int *score_ret)
Guess the file format.
int av_seek_frame(AVFormatContext *s, int stream_index, int64_t timestamp, int flags)
Seek to the keyframe at timestamp.
struct AVCodecParserContext * parser
int64_t duration
Decoding: duration of the stream, in stream time base.
const AVClass * av_class
A class for logging and AVOptions.
int64_t interleaver_chunk_duration
const AVClass * avformat_get_class(void)
Get the AVClass for AVFormatContext.
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...
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.
AVFormatContext * avformat_alloc_context(void)
Allocate an AVFormatContext.
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
int64_t nb_frames
number of frames in this stream if known or 0
int max_analyze_duration
decoding: maximum time (in AV_TIME_BASE units) during which the input should be analyzed in avformat_...
void avformat_close_input(AVFormatContext **s)
Close an opened input AVFormatContext.
int64_t codec_info_duration_fields
struct AVPacketList * packet_buffer
This buffer is only needed when packets were already buffered but not decoded, for example to get the...
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.
struct AVOutputFormat * oformat
struct AVFrac pts
encoding: pts generation when outputting stream
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){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));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=av_sample_fmt_is_planar(in_fmt);out_planar=av_sample_fmt_is_planar(out_fmt);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);ff_audio_convert_init_arm(ac);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_dlog(ac->avr,"%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
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 max_chunk_duration
Max chunk time in microseconds.
int codec_info_nb_frames
Number of frames that have been demuxed during av_find_stream_info()
const char * avformat_configuration(void)
Return the libavformat build-time configuration.
AVProgram * av_find_program_from_stream(AVFormatContext *ic, AVProgram *last, int s)
Find the programs which belong to a given stream.
int av_write_trailer(AVFormatContext *s)
Write the stream trailer to an output media file and free the file private data.
int bit_rate
Decoding: total stream bitrate in bit/s, 0 if not available.
int64_t duration
Decoding: duration of the stream, in AV_TIME_BASE fractional seconds.
AVCodec * subtitle_codec
Forced subtitle codec.
void av_pkt_dump_log2(void *avcl, int level, AVPacket *pkt, int dump_payload, AVStream *st)
Send a nice dump of a packet to the log.
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...
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.
struct AVPacketList * parse_queue
Packets split by the parser get queued here.
int request_probe
stream probing state -1 -> probing finished 0 -> no probing requested rest -> perform probing with re...
unsigned int * stream_index
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...
const char * avformat_license(void)
Return the libavformat license.
AVInputFormat * av_find_input_format(const char *short_name)
Find AVInputFormat based on the short name of the input format.
struct AVPacketList * next