ffmpeg重要结构体之AVCodec
2015-11-12 17:18
288 查看
ffmpeg重要结构体之AVFrame
ffmpeg重要结构体之AVFormatContext
ffmpeg重要结构体之AVCodecContext
ffmpeg重要结构体之AVCodec
ffmpeg重要结构体之AVIOContext
ffmpeg重要结构体之AVStream
ffmpeg重要结构体之AVPacket
AVCodec结构体是有关codec的结构体。在文件"libavcodec/avcodec.h" 中。
解码某AVC码流文件,过程中有下图:
其中解码相关的变量都很直观:
const char *name:Codec的名字,此例子中为h264。
enum AVMediaType type:媒体类型:视频。
enum AVCodecID id:Codec的ID,比如AV_CODEC_ID_H264。
重要的是其中的几个函数指针:decode()等,将在以后介绍。
ffmpeg重要结构体之AVFormatContext
ffmpeg重要结构体之AVCodecContext
ffmpeg重要结构体之AVCodec
ffmpeg重要结构体之AVIOContext
ffmpeg重要结构体之AVStream
ffmpeg重要结构体之AVPacket
AVCodec结构体是有关codec的结构体。在文件"libavcodec/avcodec.h" 中。
typedef struct AVCodec { /** * Name of the codec implementation. * The name is globally unique among encoders and among decoders (but an * encoder and a decoder can share the same name). * This is the primary way to find a codec from the user perspective. */ const char *name; /** * Descriptive name for the codec, meant to be more human readable than name. * You should use the NULL_IF_CONFIG_SMALL() macro to define it. */ const char *long_name; enum AVMediaType type; enum AVCodecID id; /** * Codec capabilities. * see AV_CODEC_CAP_* */ int capabilities; const AVRational *supported_framerates; ///< array of supported framerates, or NULL if any, array is terminated by {0,0} const enum AVPixelFormat *pix_fmts; ///< array of supported pixel formats, or NULL if unknown, array is terminated by -1 const int *supported_samplerates; ///< array of supported audio samplerates, or NULL if unknown, array is terminated by 0 const enum AVSampleFormat *sample_fmts; ///< array of supported sample formats, or NULL if unknown, array is terminated by -1 const uint64_t *channel_layouts; ///< array of support channel layouts, or NULL if unknown. array is terminated by 0 uint8_t max_lowres; ///< maximum value for lowres supported by the decoder, no direct access, use av_codec_get_max_lowres() const AVClass *priv_class; ///< AVClass for the private context const AVProfile *profiles; ///< array of recognized profiles, or NULL if unknown, array is terminated by {FF_PROFILE_UNKNOWN} /***************************************************************** * No fields below this line are part of the public API. They * may not be used outside of libavcodec and can be changed and * removed at will. * New public fields should be added right above. ***************************************************************** */ int priv_data_size; struct AVCodec *next; /** * @name Frame-level threading support functions * @{ */ /** * If defined, called on thread contexts when they are created. * If the codec allocates writable tables in init(), re-allocate them here. * priv_data will be set to a copy of the original. */ int (*init_thread_copy)(AVCodecContext *); /** * Copy necessary context variables from a previous thread context to the current one. * If not defined, the next thread will start automatically; otherwise, the codec * must call ff_thread_finish_setup(). * * dst and src will (rarely) point to the same context, in which case memcpy should be skipped. */ int (*update_thread_context)(AVCodecContext *dst, const AVCodecContext *src); /** @} */ /** * Private codec-specific defaults. */ const AVCodecDefault *defaults; /** * Initialize codec static data, called from avcodec_register(). */ void (*init_static_data)(struct AVCodec *codec); int (*init)(AVCodecContext *); int (*encode_sub)(AVCodecContext *, uint8_t *buf, int buf_size, const struct AVSubtitle *sub); /** * Encode data to an AVPacket. * * @param avctx codec context * @param avpkt output AVPacket (may contain a user-provided buffer) * @param[in] frame AVFrame containing the raw data to be encoded * @param[out] got_packet_ptr encoder sets to 0 or 1 to indicate that a * non-empty packet was returned in avpkt. * @return 0 on success, negative error code on failure */ int (*encode2)(AVCodecContext *avctx, AVPacket *avpkt, const AVFrame *frame, int *got_packet_ptr); int (*decode)(AVCodecContext *, void *outdata, int *outdata_size, AVPacket *avpkt); int (*close)(AVCodecContext *); /** * Flush buffers. * Will be called when seeking */ void (*flush)(AVCodecContext *); /** * Internal codec capabilities. * See FF_CODEC_CAP_* in internal.h */ int caps_internal; } AVCodec;
解码某AVC码流文件,过程中有下图:
其中解码相关的变量都很直观:
const char *name:Codec的名字,此例子中为h264。
enum AVMediaType type:媒体类型:视频。
enum AVCodecID id:Codec的ID,比如AV_CODEC_ID_H264。
重要的是其中的几个函数指针:decode()等,将在以后介绍。
相关文章推荐
- android ProgressBar和SeekBar简单应用
- FriendlyARM Tiny210开发板硬件基础 第二篇--汇编调用c语言
- 【es6】let和const
- 2015年10月31日 学习计划
- python库:fuzzywuzzy
- Android 5.0 权限管理, apk安装失败
- css3 @media 用法
- STM32低功耗模式--STOP模式
- Activity启动模式
- 解析Java异常的栈轨迹及其相关方法
- python+opencv实操-图像基本操作
- wget 详解
- 【转】LNMMP动静分离
- Android M App Links: 实现, 缺陷以及解决办法
- Android 中this、 getApplicationContext()、getApplication()之间的区别
- iptables中的 -m tcp的意思
- Delphi 设置WebBrowser 代理服务器 与 UserAgent
- iOS备忘录之IOS开发的一些网站(看看还是不错的)
- 【es6】变量解构赋值
- 源码解读Mybatis List列表In查询实现的注意事项