⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 avformat.h

📁 ts流的解复用
💻 H
📖 第 1 页 / 共 2 页
字号:
#ifndef __AVFORMAT_H__#define __AVFORMAT_H__#include "type.h"#include "avcodec.h"#include "ringbuffer.h"struct AVFormatContext;/** * the exact value of the fractional number is: 'val + num / den'. * num is assumed to be such as 0 <= num < den * @deprecated Use AVRational instead*/typedef struct AVFrac {    int64_t val, num, den;} AVFrac;// attribute_deprecated;enum AVDiscard{    /* We leave some space between them for extensions (drop some     * keyframes for intra-only or drop just some bidir frames). */    AVDISCARD_NONE   =-16, ///< discard nothing    AVDISCARD_DEFAULT=  0, ///< discard useless packets like 0 size packets in avi    AVDISCARD_NONREF =  8, ///< discard all non reference    AVDISCARD_BIDIR  = 16, ///< discard all bidirectional frames    AVDISCARD_NONKEY = 32, ///< discard all frames except keyframes    AVDISCARD_ALL    = 48, ///< discard all};enum AVStreamParseType {    AVSTREAM_PARSE_NONE,    AVSTREAM_PARSE_FULL,       /**< full parsing and repack */    AVSTREAM_PARSE_HEADERS,    /**< only parse headers, don't repack */    AVSTREAM_PARSE_TIMESTAMPS, /**< full parsing and interpolation of timestamps for frames not starting on packet boundary */};typedef struct AVPacket {    /**     * Presentation time stamp in time_base units.     * This is the time at which the decompressed packet will be presented     * to the user.     * Can be AV_NOPTS_VALUE if it is not stored in the file.     * pts MUST be larger or equal to dts as presentation can not happen before     * decompression, unless one wants to view hex dumps. Some formats misuse     * the terms dts and pts/cts to mean something different, these timestamps     * must be converted to true pts/dts before they are stored in AVPacket.     */    int64_t pts;    /**     * Decompression time stamp in time_base units.     * This is the time at which the packet is decompressed.     * Can be AV_NOPTS_VALUE if it is not stored in the file.     */    int64_t dts;    uint8_t *data;    int   size;    int   stream_index;    int   flags;    int   duration;                         ///< presentation duration in time_base units (0 if not available)    void  (*destruct)(struct AVPacket *);    void  *priv;    int64_t pos;                            ///< byte position in stream, -1 if unknown} AVPacket;/** * Bytestream IO 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(ByteIOContext) must not be used outside libav*. */typedef struct {    unsigned char *buffer;    int buffer_size;    unsigned char *buf_ptr, *buf_end;    void *opaque;    int (*read_packet)(void *opaque, uint8_t *buf, int buf_size);    int (*write_packet)(void *opaque, uint8_t *buf, int buf_size);    offset_t (*seek)(void *opaque, offset_t offset, int whence);    offset_t pos; /**< position in the file of the current buffer */    int must_flush; /**< true if the next seek should flush */    int eof_reached; /**< true if eof reached */    int write_flag;  /**< true if open for writing */    int is_streamed;    int max_packet_size;    unsigned long checksum;    unsigned char *checksum_ptr;    unsigned long (*update_checksum)(unsigned long checksum, const uint8_t *buf, unsigned int size);    int error;         ///< contains the error code or 0 if no error happened    int (*read_pause)(void *opaque, int pause);    offset_t (*read_seek)(void *opaque,                     int stream_index, int64_t timestamp, int flags);} ByteIOContext;/* frame parsing */typedef struct AVCodecParserContext {    void *priv_data;    struct AVCodecParser *parser;    int64_t frame_offset; /* offset of the current frame */    int64_t cur_offset; /* current offset                           (incremented by each av_parser_parse()) */    int64_t last_frame_offset; /* offset of the last frame */    /* video info */    int pict_type; /* XXX: Put it back in AVCodecContext. */    int repeat_pict; /* XXX: Put it back in AVCodecContext. */    int64_t pts;     /* pts of the current frame */    int64_t dts;     /* dts of the current frame */    /* private data */    int64_t last_pts;    int64_t last_dts;    int fetch_timestamp;#define AV_PARSER_PTS_NB 4    int cur_frame_start_index;    int64_t cur_frame_offset[AV_PARSER_PTS_NB];    int64_t cur_frame_pts[AV_PARSER_PTS_NB];    int64_t cur_frame_dts[AV_PARSER_PTS_NB];    int flags;#define PARSER_FLAG_COMPLETE_FRAMES           0x0001    int64_t offset;      ///< byte offset from starting packet start    int64_t last_offset;} AVCodecParserContext;typedef struct AVCodecParser {    int codec_ids[5]; /* several codec IDs are permitted */    int priv_data_size;    int (*parser_init)(AVCodecParserContext *s);    int (*parser_parse)(AVCodecParserContext *s,                        AVCodecContext *avctx,                        const uint8_t **poutbuf, int *poutbuf_size,                        const uint8_t *buf, int buf_size);    void (*parser_close)(AVCodecParserContext *s);    int (*split)(AVCodecContext *avctx, const uint8_t *buf, int buf_size);    struct AVCodecParser *next;} AVCodecParser;/** * 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;/** * Stream structure. * 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(AVStream) must not be used outside libav*. */typedef struct AVStream {    int index;    /**< stream index in AVFormatContext */    int id;       /**< format specific stream id */    AVCodecContext *codec; /**< codec context */    /**     * Real base frame rate of the stream.     * This is the lowest frame rate with which all timestamps can be     * represented accurately (it is the least common multiple of all     * frame rates in the stream), Note, this value is just a guess!     * For example if the timebase is 1/90000 and all frames have either     * approximately 3600 or 1800 timer ticks then r_frame_rate will be 50/1.     */    AVRational r_frame_rate;    void *priv_data;    /* internal data used in av_find_stream_info() */    int64_t first_dts;    /** encoding: PTS generation when outputing stream */    struct AVFrac pts;    /**     * This is the fundamental unit of time (in seconds) in terms     * of which frame timestamps are represented. For fixed-fps content,     * timebase should be 1/frame rate and timestamp increments should be     * identically 1.     */    AVRational time_base;    int pts_wrap_bits; /**< number of bits in pts (used for wrapping control) */    /* ffmpeg.c private use */    int stream_copy; /**< if set, just copy stream */    enum AVDiscard discard; ///< selects which packets can be discarded at will and do not need to be demuxed    //FIXME move stuff to a flags field?    /** quality, as it has been removed from AVCodecContext and put in AVVideoFrame     * MN: dunno if that is the right place for it */    float quality;    /**     * Decoding: pts of the first frame of the stream, in stream time base.     * Only set this if you are absolutely 100% sure that the value you set     * it to really is the pts of the first frame.     * This may be undefined (AV_NOPTS_VALUE).     * @note The ASF header does NOT contain a correct start_time the ASF     * demuxer must NOT set this.     */    int64_t start_time;    /**     * Decoding: duration of the stream, in stream time base.     * If a source file does not specify a duration, but does specify     * a bitrate, this value will be estimates from bit rate and file size.     */    int64_t duration;    char language[4]; /** ISO 639 3-letter language code (empty string if undefined) */    /* av_read_frame() support */    enum AVStreamParseType need_parsing;    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

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -