📄 avformat.h.svn-base
字号:
struct AVCodecParserContext *parser; int64_t cur_dts; int last_IP_duration; int64_t last_IP_pts; /* av_seek_frame() support */ AVIndexEntry *index_entries; /**< only used if the format does not support seeking natively */ int nb_index_entries; unsigned int index_entries_allocated_size; int64_t nb_frames; ///< number of frames in this stream if known or 0#define MAX_REORDER_DELAY 4 int64_t pts_buffer[MAX_REORDER_DELAY+1]; char *filename; /**< source filename of the stream */} AVStream;#define AV_PROGRAM_RUNNING 1/** * New fields can be added to the end with minor version bumps. * Removal, reordering and changes to existing fields require a major * version bump. * sizeof(AVProgram) must not be used outside libav*. */typedef struct AVProgram { int id; char *provider_name; ///< Network name for DVB streams char *name; ///< Service name for DVB streams int flags; enum AVDiscard discard; ///< selects which program to discard and which to feed to the caller unsigned int *stream_index; unsigned int nb_stream_indexes;} AVProgram;#define AVFMTCTX_NOHEADER 0x0001 /**< signal that no header is present (streams are added dynamically) */#define MAX_STREAMS 20/** * format I/O context. * New fields can be added to the end with minor version bumps. * Removal, reordering and changes to existing fields require a major * version bump. * sizeof(AVFormatContext) must not be used outside libav*. */typedef struct AVFormatContext { const AVClass *av_class; /**< set by av_alloc_format_context */ /* can only be iformat or oformat, not both at the same time */ struct AVInputFormat *iformat; struct AVOutputFormat *oformat; void *priv_data; ByteIOContext *pb; unsigned int nb_streams; AVStream *streams[MAX_STREAMS]; char filename[1024]; /**< input or output filename */ /* stream info */ int64_t timestamp; char title[512]; char author[512]; char copyright[512]; char comment[512]; char album[512]; int year; /**< ID3 year, 0 if none */ int track; /**< track number, 0 if none */ char genre[32]; /**< ID3 genre */ int ctx_flags; /**< format specific flags, see AVFMTCTX_xx */ /* private data for pts handling (do not modify directly) */ /** This buffer is only needed when packets were already buffered but not decoded, for example to get the codec parameters in mpeg streams */ struct AVPacketList *packet_buffer; /** decoding: position of the first frame of the component, in AV_TIME_BASE fractional seconds. NEVER set this value directly: it is deduced from the AVStream values. */ int64_t start_time; /** decoding: duration of the stream, in AV_TIME_BASE fractional seconds. NEVER set this value directly: it is deduced from the AVStream values. */ int64_t duration; /** decoding: total file size. 0 if unknown */ int64_t file_size; /** decoding: total stream bitrate in bit/s, 0 if not available. Never set it directly if the file_size and the duration are known as ffmpeg can compute it automatically. */ int bit_rate; /* av_read_frame() support */ AVStream *cur_st; const uint8_t *cur_ptr; int cur_len; AVPacket cur_pkt; /* av_seek_frame() support */ int64_t data_offset; /** offset of the first packet */ int index_built; int mux_rate; int packet_size; int preload; int max_delay;#define AVFMT_NOOUTPUTLOOP -1#define AVFMT_INFINITEOUTPUTLOOP 0 /** number of times to loop output in formats that support it */ int loop_output; int flags;#define AVFMT_FLAG_GENPTS 0x0001 ///< generate pts if missing even if it requires parsing future frames#define AVFMT_FLAG_IGNIDX 0x0002 ///< ignore index#define AVFMT_FLAG_NONBLOCK 0x0004 ///< do not block when reading packets from input int loop_input; /** decoding: size of data to probe; encoding unused */ unsigned int probesize; /** * maximum duration in AV_TIME_BASE units over which the input should be analyzed in av_find_stream_info() */ int max_analyze_duration; const uint8_t *key; int keylen; unsigned int nb_programs; AVProgram **programs; /** * Forced video codec_id. * demuxing: set by user */ enum CodecID video_codec_id; /** * Forced audio codec_id. * demuxing: set by user */ enum CodecID audio_codec_id; /** * Forced subtitle codec_id. * demuxing: set by user */ enum CodecID subtitle_codec_id; /** * Maximum amount of memory in bytes to use per stream for the index. * If the needed index exceeds this size entries will be discarded as * needed to maintain a smaller size. This can lead to slower or less * accurate seeking (depends on demuxer). * Demuxers for which a full in memory index is mandatory will ignore * this. * muxing : unused * demuxing: set by user */ unsigned int max_index_size;} AVFormatContext;typedef struct AVPacketList { AVPacket pkt; struct AVPacketList *next;} AVPacketList;#if LIBAVFORMAT_VERSION_INT < (53<<16)extern AVInputFormat *first_iformat;extern AVOutputFormat *first_oformat;#endifAVInputFormat *av_iformat_next(AVInputFormat *f);AVOutputFormat *av_oformat_next(AVOutputFormat *f);enum CodecID av_guess_image2_codec(const char *filename);/* XXX: use automatic init with either ELF sections or C file parser *//* modules *//* utils.c */void av_register_input_format(AVInputFormat *format);void av_register_output_format(AVOutputFormat *format);AVOutputFormat *guess_stream_format(const char *short_name, const char *filename, const char *mime_type);AVOutputFormat *guess_format(const char *short_name, const char *filename, const char *mime_type);/** * Guesses the codec id based upon muxer and filename. */enum CodecID av_guess_codec(AVOutputFormat *fmt, const char *short_name, const char *filename, const char *mime_type, enum CodecType type);/** * Send a nice hexadecimal dump of a buffer to the specified file stream. * * @param f The file stream pointer where the dump should be sent to. * @param buf buffer * @param size buffer size * * @see av_hex_dump_log, av_pkt_dump, av_pkt_dump_log */void av_hex_dump(FILE *f, uint8_t *buf, int size);/** * Send a nice hexadecimal dump of a buffer to the log. * * @param avcl A pointer to an arbitrary struct of which the first field is a * pointer to an AVClass struct. * @param level The importance level of the message, lower values signifying * higher importance. * @param buf buffer * @param size buffer size * * @see av_hex_dump, av_pkt_dump, av_pkt_dump_log */void av_hex_dump_log(void *avcl, int level, uint8_t *buf, int size);/** * Send a nice dump of a packet to the specified file stream. * * @param f The file stream pointer where the dump should be sent to. * @param pkt packet to dump * @param dump_payload true if the payload must be displayed too */void av_pkt_dump(FILE *f, AVPacket *pkt, int dump_payload);/** * Send a nice dump of a packet to the log. * * @param avcl A pointer to an arbitrary struct of which the first field is a * pointer to an AVClass struct. * @param level The importance level of the message, lower values signifying * higher importance. * @param pkt packet to dump * @param dump_payload true if the payload must be displayed too */void av_pkt_dump_log(void *avcl, int level, AVPacket *pkt, int dump_payload);void av_register_all(void);/** codec tag <-> codec id */enum CodecID av_codec_get_id(const struct AVCodecTag **tags, unsigned int tag);unsigned int av_codec_get_tag(const struct AVCodecTag **tags, enum CodecID id);/* media file input *//** * finds AVInputFormat based on input format's short name. */AVInputFormat *av_find_input_format(const char *short_name);/** * Guess file format. * * @param is_opened whether the file is already opened, determines whether * demuxers with or without AVFMT_NOFILE are probed */AVInputFormat *av_probe_input_format(AVProbeData *pd, int is_opened);/** * Allocates all the structures needed to read an input stream. * This does not open the needed codecs for decoding the stream[s]. */int av_open_input_stream(AVFormatContext **ic_ptr, ByteIOContext *pb, const char *filename, AVInputFormat *fmt, AVFormatParameters *ap);/** * Open a media file as input. The codecs are not opened. Only the file * header (if present) is read. * * @param ic_ptr the opened media file handle is put here * @param filename filename to open. * @param fmt if non NULL, force the file format to use * @param buf_size optional buffer size (zero if default is OK) * @param ap additional parameters needed when opening the file (NULL if default) * @return 0 if OK. AVERROR_xxx otherwise. */int av_open_input_file(AVFormatContext **ic_ptr, const char *filename, AVInputFormat *fmt, int buf_size, AVFormatParameters *ap);/** * Allocate an AVFormatContext. * Can be freed with av_free() but do not forget to free everything you * explicitly allocated as well! */AVFormatContext *av_alloc_format_context(void);/** * Read packets of a media file to get stream information. This * is useful for file formats with no headers such as MPEG. This * function also computes the real frame rate in case of mpeg2 repeat * frame mode. * The logical file position is not changed by this function; * examined packets may be buffered for later processing. * * @param ic media file handle * @return >=0 if OK. AVERROR_xxx if error. * @todo Let user decide somehow what information is needed so we do not waste time getting stuff the user does not need. */int av_find_stream_info(AVFormatContext *ic);/** * Read a transport packet from a media file. * * This function is obsolete and should never be used. * Use av_read_frame() instead. * * @param s media file handle * @param pkt is filled * @return 0 if OK. AVERROR_xxx if error. */int av_read_packet(AVFormatContext *s, AVPacket *pkt);/** * Return the next frame of a stream. * * The returned packet is valid * until the next av_read_frame() or until av_close_input_file() and * must be freed with av_free_packet. For video, the packet contains * exactly one frame. For audio, it contains an integer number of * frames if each frame has a known fixed size (e.g. PCM or ADPCM * data). If the audio frames have a variable size (e.g. MPEG audio), * then it contains one frame. * * pkt->pts, pkt->dts and pkt->duration are always set to correct * values in AVStream.timebase units (and guessed if the format cannot * provided them). pkt->pts can be AV_NOPTS_VALUE if the video format * has B frames, so it is better to rely on pkt->dts if you do not * decompress the payload. * * @return 0 if OK, < 0 if error or end of file.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -