FFmpeg源代码简单分析-架构图-编码

参考链接

  • FFmpeg源代码结构图 - 编码_雷霄骅的博客-CSDN博客_ffmpeg 源码

函数背景色

  • 函数在图中以方框的形式表现出来。不同的背景色标志了该函数不同的作用:
    • 粉红色背景函数:FFmpeg的API函数。
    • 白色背景的函数:FFmpeg的内部函数。
    • 黄色背景的函数:URLProtocol结构体中的函数,包含了读写各种协议的功能。
    • 绿色背景的函数:AVOutputFormat结构体中的函数,包含了读写各种封装格式的功能。
    • 蓝色背景的函数:AVCodec结构体中的函数,包含了编解码的功能。

区域

  • 整个关系图可以分为以下几个区域:
    • 左边区域——架构函数区域:这些函数并不针对某一特定的视频格式。
    • 右上方黄色区域——协议处理函数区域:不同的协议(RTP,RTMP,FILE)会调用不同的协议处理函数。
    • 右边中间绿色区域——封装格式处理函数区域:不同的封装格式(MKV,FLV,MPEG2TS,AVI)会调用不同的封装格式处理函数。
    • 右边下方蓝色区域——编解码函数区域:不同的编码标准(HEVC,H.264,MPEG2)会调用不同的编解码函数。

箭头线

  • 为了把调用关系表示的更明显,图中的箭头线也使用了不同的颜色:
    • 红色的箭头线:标志了编码的流程。
    • 其他颜色的箭头线:标志了函数之间的调用关系。其中:
      • 调用URLProtocol结构体中的函数用黄色箭头线标识;
      • 调用AVOutputFormat结构体中的函数用绿色箭头线标识;
      • 调用AVCodec结构体中的函数用蓝色箭头线标识。

函数所在的文件

  • 每个函数标识了它所在的文件路径。

模块介绍

  • 和解码重合的内容,请参考下面的链接
  • ​​​​​​FFmpeg源代码简单分析-架构图-解码_MY CUP OF TEA的博客-CSDN博客

右中区域(AVOutputFormat封装格式处理函数)

  • AVOutputFormat包含如下封装格式处理函数指针:
    • write_header():写文件头
    • write_packet():写一帧数据
    • write_trailer():写文件尾
  • 参考链接:FFmpeg: AVOutputFormat Struct Reference
typedef struct AVOutputFormat {const char *name;/*** Descriptive name for the format, meant to be more human-readable* than name. You should use the NULL_IF_CONFIG_SMALL() macro* to define it.*/const char *long_name;const char *mime_type;const char *extensions; /**< comma-separated filename extensions *//* output support */enum AVCodecID audio_codec;    /**< default audio codec */enum AVCodecID video_codec;    /**< default video codec */enum AVCodecID subtitle_codec; /**< default subtitle codec *//*** can use flags: AVFMT_NOFILE, AVFMT_NEEDNUMBER,* AVFMT_GLOBALHEADER, AVFMT_NOTIMESTAMPS, AVFMT_VARIABLE_FPS,* AVFMT_NODIMENSIONS, AVFMT_NOSTREAMS, AVFMT_ALLOW_FLUSH,* AVFMT_TS_NONSTRICT, AVFMT_TS_NEGATIVE*/int flags;/*** List of supported codec_id-codec_tag pairs, ordered by "better* choice first". The arrays are all terminated by AV_CODEC_ID_NONE.*/const struct AVCodecTag * const *codec_tag;const AVClass *priv_class; ///< AVClass for the private context/****************************************************************** No fields below this line are part of the public API. They* may not be used outside of libavformat and can be changed and* removed at will.* New public fields should be added right above.******************************************************************//*** size of private data so that it can be allocated in the wrapper*/int priv_data_size;/*** Internal flags. See FF_FMT_FLAG_* in internal.h.*/int flags_internal;int (*write_header)(struct AVFormatContext *);/*** Write a packet. If AVFMT_ALLOW_FLUSH is set in flags,* pkt can be NULL in order to flush data buffered in the muxer.* When flushing, return 0 if there still is more data to flush,* or 1 if everything was flushed and there is no more buffered* data.*/int (*write_packet)(struct AVFormatContext *, AVPacket *pkt);int (*write_trailer)(struct AVFormatContext *);/*** A format-specific function for interleavement.* If unset, packets will be interleaved by dts.** @param s           An AVFormatContext for output. pkt will be added to*                    resp. taken from its packet buffer.* @param[in,out] pkt A packet to be interleaved if has_packet is set;*                    also used to return packets. If no packet is returned*                    (e.g. on error), pkt is blank on return.* @param flush       1 if no further packets are available as input and*                    all remaining packets should be output.* @param has_packet  If set, pkt contains a packet to be interleaved*                    on input; otherwise pkt is blank on input.* @return 1 if a packet was output, 0 if no packet could be output,*         < 0 if an error occurred*/int (*interleave_packet)(struct AVFormatContext *s, AVPacket *pkt,int flush, int has_packet);/*** Test if the given codec can be stored in this container.** @return 1 if the codec is supported, 0 if it is not.*         A negative number if unknown.*         MKTAG('A', 'P', 'I', 'C') if the codec is only supported as AV_DISPOSITION_ATTACHED_PIC*/int (*query_codec)(enum AVCodecID id, int std_compliance);void (*get_output_timestamp)(struct AVFormatContext *s, int stream,int64_t *dts, int64_t *wall);/*** Allows sending messages from application to device.*/int (*control_message)(struct AVFormatContext *s, int type,void *data, size_t data_size);/*** Write an uncoded AVFrame.** See av_write_uncoded_frame() for details.** The library will free *frame afterwards, but the muxer can prevent it* by setting the pointer to NULL.*/int (*write_uncoded_frame)(struct AVFormatContext *, int stream_index,AVFrame **frame, unsigned flags);/*** Returns device list with it properties.* @see avdevice_list_devices() for more details.*/int (*get_device_list)(struct AVFormatContext *s, struct AVDeviceInfoList *device_list);enum AVCodecID data_codec; /**< default data codec *//*** Initialize format. May allocate data here, and set any AVFormatContext or* AVStream parameters that need to be set before packets are sent.* This method must not write output.** Return 0 if streams were fully configured, 1 if not, negative AVERROR on failure** Any allocations made here must be freed in deinit().*/int (*init)(struct AVFormatContext *);/*** Deinitialize format. If present, this is called whenever the muxer is being* destroyed, regardless of whether or not the header has been written.** If a trailer is being written, this is called after write_trailer().** This is called if init() fails as well.*/void (*deinit)(struct AVFormatContext *);/*** Set up any necessary bitstream filtering and extract any extra data needed* for the global header.** @note pkt might have been directly forwarded by a meta-muxer; therefore*       pkt->stream_index as well as the pkt's timebase might be invalid.* Return 0 if more packets from this stream must be checked; 1 if not.*/int (*check_bitstream)(struct AVFormatContext *s, struct AVStream *st,const AVPacket *pkt);
} AVOutputFormat;

注意事项 

  • 【例子】不同的封装格式对应着上述接口有不同的实现函数,举几个例子:
  • FLV封装格式对应的AVOutputFormat结构体ff_flv_muxer:
    • write_header() -> flv_write_header()
    • write_packet() –> flv_write_packet()
    • write_trailer() -> flv_write_trailer()
  • 参考链接:FFmpeg: libavformat/flvenc.c File Reference
= {.name           = "flv",.long_name      = NULL_IF_CONFIG_SMALL("FLV (Flash Video)"),.mime_type      = "video/x-flv",.extensions     = "flv",.priv_data_size = sizeof(FLVContext),.audio_codec    = CONFIG_LIBMP3LAME ? AV_CODEC_ID_MP3 : AV_CODEC_ID_ADPCM_SWF,.video_codec    = AV_CODEC_ID_FLV1,.write_header   = flv_write_header,.write_packet   = flv_write_packet,.write_trailer  = flv_write_trailer,.codec_tag      = (const * const []) {flv_video_codec_ids, flv_audio_codec_ids, 0},.flags          = AVFMT_GLOBALHEADER | AVFMT_VARIABLE_FPS |AVFMT_TS_NONSTRICT,
}
  • MKV封装格式对应的AVOutputFormat结构体ff_matroska_muxer:
    • write_header() -> mkv_write_header()
    • write_packet() –> mkv_write_flush_packet()
    • write_trailer() -> mkv_write_trailer()
  • 结构体ff_matroska_muxer 已经不存在
  • 参考链接:FFmpeg: libavformat/matroskaenc.c Source File
 const AVOutputFormat ff_matroska_muxer = {.name              = "matroska",.long_name         = NULL_IF_CONFIG_SMALL("Matroska"),.mime_type         = "video/x-matroska",.extensions        = "mkv",.priv_data_size    = sizeof(MatroskaMuxContext),.audio_codec       = CONFIG_LIBVORBIS_ENCODER ?AV_CODEC_ID_VORBIS : AV_CODEC_ID_AC3,.video_codec       = CONFIG_LIBX264_ENCODER ?AV_CODEC_ID_H264 : AV_CODEC_ID_MPEG4,.init              = mkv_init,.deinit            = mkv_deinit,.write_header      = mkv_write_header,.write_packet      = mkv_write_flush_packet,.write_trailer     = mkv_write_trailer,.flags             = AVFMT_GLOBALHEADER | AVFMT_VARIABLE_FPS |AVFMT_TS_NONSTRICT | AVFMT_ALLOW_FLUSH,.codec_tag         = (const AVCodecTag* const []){ff_codec_bmp_tags, ff_codec_wav_tags,additional_audio_tags, additional_video_tags, additional_subtitle_tags, 0},.subtitle_codec    = AV_CODEC_ID_ASS,.query_codec       = mkv_query_codec,.check_bitstream   = mkv_check_bitstream,.priv_class        = &matroska_webm_class,};#endif
  • MPEG2TS封装格式对应的AVOutputFormat结构体ff_mpegts_muxer:
    • write_header() -> mpegts_write_header()
    • write_packet() –> mpegts_write_packet()
    • write_trailer() -> mpegts_write_end()
  • 参考链接:FFmpeg: libavformat/mpegtsenc.c File Reference
= {.name           = "mpegts",.long_name      = NULL_IF_CONFIG_SMALL("MPEG-TS (MPEG-2 Transport Stream)"),.mime_type      = "video/MP2T",.extensions     = "ts,m2t,m2ts,mts",.priv_data_size = sizeof(MpegTSWrite),.audio_codec    = AV_CODEC_ID_MP2,.video_codec    = AV_CODEC_ID_MPEG2VIDEO,.write_header   = mpegts_write_header,.write_packet   = mpegts_write_packet,.write_trailer  = mpegts_write_end,.flags          = AVFMT_ALLOW_FLUSH | AVFMT_VARIABLE_FPS,.priv_class     = &mpegts_muxer_class,
}
  • AVI封装格式对应的AVOutputFormat结构体ff_avi_muxer:
    • write_header() -> avi_write_header()
    • write_packet() –> avi_write_packet()
    • write_trailer() -> avi_write_trailer()
  • 参考链接:FFmpeg: libavformat/avienc.c File Reference
= {.name           = "avi",.long_name      = NULL_IF_CONFIG_SMALL("AVI (Audio Video Interleaved)"),.mime_type      = "video/x-msvideo",.extensions     = "avi",.priv_data_size = sizeof(AVIContext),.audio_codec    = CONFIG_LIBMP3LAME ? AV_CODEC_ID_MP3 : AV_CODEC_ID_AC3,.video_codec    = AV_CODEC_ID_MPEG4,.write_header   = avi_write_header,.write_packet   = avi_write_packet,.write_trailer  = avi_write_trailer,.codec_tag      = (const AVCodecTag * const []) {ff_codec_bmp_tags, ff_codec_wav_tags, 0},
}

右下区域(AVCodec编解码函数)

  • AVCodec包含如下编解码函数指针:
    • init():初始化
    • encode2():编码一帧数据
    • close():关闭
  • 参考链接:FFmpeg: AVCodec Struct Reference
  • 上述参考链接里面包含的结构体包含上述编解码函数指针
  • 但是新版本好像没有了
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;uint8_t max_lowres;                     ///< maximum value for lowres supported by the decoderconst 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 -1const int *supported_samplerates;       ///< array of supported audio samplerates, or NULL if unknown, array is terminated by 0const enum AVSampleFormat *sample_fmts; ///< array of supported sample formats, or NULL if unknown, array is terminated by -1
#if FF_API_OLD_CHANNEL_LAYOUT/*** @deprecated use ch_layouts instead*/attribute_deprecatedconst uint64_t *channel_layouts;         ///< array of support channel layouts, or NULL if unknown. array is terminated by 0
#endifconst AVClass *priv_class;              ///< AVClass for the private contextconst AVProfile *profiles;              ///< array of recognized profiles, or NULL if unknown, array is terminated by {FF_PROFILE_UNKNOWN}/*** Group name of the codec implementation.* This is a short symbolic name of the wrapper backing this codec. A* wrapper uses some kind of external implementation for the codec, such* as an external library, or a codec implementation provided by the OS or* the hardware.* If this field is NULL, this is a builtin, libavcodec native codec.* If non-NULL, this will be the suffix in AVCodec.name in most cases* (usually AVCodec.name will be of the form "<codec_name>_<wrapper_name>").*/const char *wrapper_name;/*** Array of supported channel layouts, terminated with a zeroed layout.*/const AVChannelLayout *ch_layouts;
} AVCodec;

注意事项:

  • 【例子】不同的编解码器对应着上述接口有不同的实现函数,举几个例子:
  • HEVC编码器对应的AVCodec结构体ff_libx265_encoder:
    • init() -> libx265_encode_init() -> x265_param_alloc(), x265_param_default_preset(), x265_encoder_open()
    • encode2() -> libx265_encode_frame() -> x265_encoder_encode()
    • close() -> libx265_encode_close() -> x265_param_free(), x265_encoder_close()
  • 参考链接:FFmpeg: libavcodec/libx265.c File Reference
= {.name             = "libx265",.long_name        = NULL_IF_CONFIG_SMALL("libx265 H.265 / HEVC"),.type             = AVMEDIA_TYPE_VIDEO,.id               = AV_CODEC_ID_HEVC,.init             = libx265_encode_init,.init_static_data = libx265_encode_init_csp,.encode2          = libx265_encode_frame,.close            = libx265_encode_close,.priv_data_size   = sizeof(libx265Context),.priv_class       = &class,.defaults         = x265_defaults,.capabilities     = AV_CODEC_CAP_DELAY | AV_CODEC_CAP_AUTO_THREADS,
}
  • H.264编码器对应的AVCodec结构体ff_libx264_encoder:
    • init() -> X264_init() -> x264_param_default(), x264_encoder_open(), x264_encoder_headers()
    • encode2() -> X264_frame() -> x264_encoder_encode()
    • close() -> X264_close() -> x264_encoder_close()
  • 参考链接:FFmpeg: libavcodec/libx264.c File Reference
{.name           = "libx264",.type           = AVMEDIA_TYPE_VIDEO,.id             = CODEC_ID_H264,.priv_data_size = sizeof(X264Context),.init           = X264_init,.encode         = X264_frame,.close          = X264_close,.capabilities   = CODEC_CAP_DELAY,.pix_fmts       = (const enum PixelFormat[]) { PIX_FMT_YUV420P, PIX_FMT_YUVJ420P, PIX_FMT_NONE },.long_name      = NULL_IF_CONFIG_SMALL("libx264 H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10"),.priv_class     = &class,
}
  • VP8编码器(libVPX)对应的AVCodec结构体ff_libvpx_vp8_encoder:
    • init() -> vpx_init() -> vpx_codec_enc_config_default()
    • encode2() -> vp8_encode() -> vpx_codec_enc_init(), vpx_codec_encode()
    • close() -> vp8_free() -> vpx_codec_destroy()
  • 参考链接:FFmpeg/libvpxenc.c at master · FFmpeg/FFmpeg · GitHub
const FFCodec ff_libvpx_vp8_encoder = {.p.name         = "libvpx",.p.long_name    = NULL_IF_CONFIG_SMALL("libvpx VP8"),.p.type         = AVMEDIA_TYPE_VIDEO,.p.id           = AV_CODEC_ID_VP8,.p.capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_DELAY |AV_CODEC_CAP_OTHER_THREADS,.priv_data_size = sizeof(VPxContext),.init           = vp8_init,FF_CODEC_ENCODE_CB(vpx_encode),.close          = vpx_free,.caps_internal  = FF_CODEC_CAP_AUTO_THREADS,.p.pix_fmts     = (const enum AVPixelFormat[]){ AV_PIX_FMT_YUV420P, AV_PIX_FMT_YUVA420P, AV_PIX_FMT_NONE },.p.priv_class   = &class_vp8,.defaults       = defaults,.p.wrapper_name = "libvpx",
};
  • MPEG2编码器对应的AVCodec结构体ff_mpeg2video_encoder:
    • init() -> encode_init()
    • encode2() -> ff_mpv_encode_picture()
    • close() -> ff_mpv_encode_end()
  • 参考链接:FFmpeg: libavcodec/mpeg12enc.c File Reference
= {.name                 = "mpeg2video",.long_name            = NULL_IF_CONFIG_SMALL("MPEG-2 video"),.type                 = AVMEDIA_TYPE_VIDEO,.id                   = AV_CODEC_ID_MPEG2VIDEO,.priv_data_size       = sizeof(MpegEncContext),.init                 = encode_init,.encode2              = ff_mpv_encode_picture,.close                = ff_mpv_encode_end,.supported_framerates = ff_mpeg2_frame_rate_tab,.pix_fmts             = (const enum AVPixelFormat[]) { AV_PIX_FMT_YUV420P,AV_PIX_FMT_YUV422P,AV_PIX_FMT_NONE },.capabilities         = AV_CODEC_CAP_DELAY | AV_CODEC_CAP_SLICE_THREADS,.priv_class           = &mpeg2_class,
}

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/446008.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

为革命,保护视力——为Eclipse更换暗黑皮肤及编辑页面的字体颜色主题

1.在Eclipse中的菜单栏的Help -> Eclipse Market 的 Search栏中输入 Eclipse Moonrise UI Theme &#xff0c;之后自己执生啦&#xff08;确保上网配置正确&#xff09;。 2.与上面操作类似&#xff0c;输入 Eclipse Color Theme&#xff0c;选择安装。 3.选择菜单栏的Win…

FFmpeg源代码简单分析-通用- 内存的分配和释放(av_malloc()、av_free()等)

参考链接 FFmpeg源代码简单分析&#xff1a;内存的分配和释放&#xff08;av_malloc()、av_free()等&#xff09;_雷霄骅的博客-CSDN博客_av_malloc 内容介绍 内存操作的常见函数位于libavutil\mem.c中本文记录最常使用的几个函数&#xff1a; av_malloc()av_realloc()av_mal…

FFmpeg源代码简单分析-通用-结构体分析-AVFormatContext

参考链接 FFMPEG结构体分析&#xff1a;AVFormatContext_雷霄骅的博客-CSDN博客_avformatcontext AVFormatContext AVFormatContext是包含码流参数较多的结构体结构体的定义位于libavformat/avformat.h/*** Format I/O context.//格式化 I/O 上下文* New fields can be added…

plsql如何显示表结构图_【论文攻略】排版技巧——如何用 Word 编辑参考文献

每个需要写毕业论文的朋友都会发现&#xff0c;修改文献是一件非常痛苦的事情&#xff0c;虽然现在也有很多软件可以编排参考文献&#xff0c;其实 word 本身就可以。采用合适的编辑方法会方便地做到整齐,规范, 自动排序和交叉引用。 1. 以尾注的方式插入第一个参考文献将光标定…

FFmpeg源代码简单分析-通用-结构体分析-AVCodecContext

参考链接 FFMPEG结构体分析&#xff1a;AVCodecContext_雷霄骅的博客-CSDN博客_avcodeccontext AVCodecContext AVCodecContext是包含变量较多的结构体&#xff08;感觉差不多是变量最多的结构体&#xff09;结构体的定义位于avcodec.h关键的变量如下所示&#xff08;仅仅考虑…

Hello OpenGL——OpenGL在Visual c++6.0安装和配置

1、下载并安装glut库opengl的glut库 GLUT不是OpenGL所必须的&#xff0c;但它会给我们的学习带来一定的方便&#xff0c;推荐安装。 Windows环境下的GLUT下载地址&#xff1a;&#xff08;大小约为150k&#xff09; http://www.opengl.org/resources/libraries/glut/glutdlls37…

FFmpeg源代码简单分析-通用-结构体分析-AVIOContext

参考链接 FFMPEG结构体分析&#xff1a;AVIOContext_雷霄骅的博客-CSDN博客_aviocontext AVIOContext AVIOContext是FFMPEG管理输入输出数据的结构体结构体的定义位于位于avio.h关键的变量如下所示 unsigned char *buffer&#xff1a;缓存开始位置int buffer_size&#xff1…

初闻动态规划

前言 本文以一道常见的算法面试题开篇&#xff0c;引入动态规划的基础概念&#xff0c; 介绍其思考过程。 正文 一、常见的一道算法面试题——上台阶 有一个楼梯总共n个台阶&#xff0c;只能往上走&#xff0c;每次只能上1个、2个台阶&#xff0c;总共有多少种走法。 解决…

FFmpeg源代码简单分析-通用-结构体分析-AVCodec

参考链接 FFMPEG结构体分析&#xff1a;AVCodec_雷霄骅的博客-CSDN博客_avcodec AVCodec AVCodec是存储编解码器信息的结构体结构体的定义位于avcodec.h文件中最主要的几个变量 const char *name&#xff1a;编解码器的名字&#xff0c;比较短const char *long_name&#xff…

SLF4J简介与使用(整合log4j)

SLF4J简介与使用(整合log4j) 一、概念 SLF4J的全称是Simple Logging Facade for Java&#xff0c;即简单日志门面。SLF4J并不是具体的日志框架&#xff0c;而是作为一个简单门面服务于各类日志框架&#xff0c;如java.util.logging, logback和log4j。 SLF4J提供了统一的记录…

multism中ui和uo应该怎么表示_王者荣耀:梦泪直播时谈到体验服大改动,表示装备的改动很关键...

王者荣耀的主播梦泪&#xff0c;大家都很熟了&#xff0c;也是一个很强的主播&#xff0c;他对于王者荣耀的理解&#xff0c;还是非常深刻的&#xff0c;而最近王者荣耀的体验服&#xff0c;进行了大改动&#xff0c;也是改变了很多的东西。对此&#xff0c;网友们也是非常的在…

怎么关闭或者卸载ivanti_电脑软件卸载不了怎么办,教您解决电脑软件无法卸载方法技巧...

我们在使用电脑的过程中&#xff0c;肯定会安装各种软件&#xff0c;但是一些软件在使用完之后就不会再使用了&#xff0c;但又无法卸载。下面由小编分享一下电脑安装的软件无法卸载解决方法&#xff0c;如果你在某卸载软件的时候出现无法卸载的情况&#xff0c;不妨通过以下方…

解决Github图片加载失败

问题描述 浏览自己Github某仓库的README.md内时&#xff0c;发现文档的图片始终加载不出&#xff0c;打开浏览器后台&#xff0c;冒出一片红&#xff0c;Failed to load resource: net::ERR_CONNECTION_RESET&#xff0c;如下图所示&#xff1a; 问题分析 可能造成这问题的原…

FFmpeg源代码简单分析-通用-结构体分析-关键结构体之间的关系

参考链接 FFMPEG中最关键的结构体之间的关系_雷霄骅的博客-CSDN博客_ffmpeg 结构体关系 最关键的结构体可以分成以下几类&#xff1a; 解协议&#xff08;http,rtsp,rtmp,mms&#xff09; AVIOContext&#xff0c;URLProtocol&#xff0c;URLContext主要存储视音频使用的协…

用Python下载文件

前提条件 需要事先安装requests模块&#xff1a; pip install requests 放码过来 import requestsurl XXX #文件下载来源URL filename #下载到本地后新文件名 r requests.get(url) with open(filename, "wb") as code:code.write(r.content)实战演习 从目标…

FFmpeg源代码简单分析-通用-常见结构体的初始化和销毁(AVFormatContext,AVFrame等)

参考链接 FFmpeg源代码简单分析&#xff1a;常见结构体的初始化和销毁&#xff08;AVFormatContext&#xff0c;AVFrame等&#xff09;_雷霄骅的博客-CSDN博客 结构体 AVFormatContext&#xff1a;统领全局的基本结构体。主要用于处理封装格式&#xff08;FLV/MKV/RMVB等&…

FFmpeg源代码简单分析-通用-avio_open2()

参考链接 FFmpeg源代码简单分析&#xff1a;avio_open2()_雷霄骅的博客-CSDN博客_avio_open avio_open2() 该函数用于打开FFmpeg的输入输出文件avio_open2()的声明位于libavformat\avio.h文件中&#xff0c;如下所示。 /*** Create and initialize a AVIOContext for accessi…

用Tomcat构建一个简单图片服务器

前提条件 Tomcat 7.0.90 方法一&#xff1a;修改配置文件 在TOMCAT_HOME/conf/server.xml配置文件内的<Host>内添加一子标签&#xff1a; <Context docBase"C:\exambase\" path"/img"/>方法二&#xff1a;添加Servlet 新建一应用&#xf…

FFmpeg源代码简单分析-通用-av_find_decoder()和av_find_encoder()

参考链接 FFmpeg源代码简单分析&#xff1a;av_find_decoder()和av_find_encoder()_雷霄骅的博客-CSDN博客_avcodec_find_encoder avcodec_find_encoder avcodec_find_encoder()用于查找FFmpeg的编码器avcodec_find_encoder()的声明位于libavcodec\codec.h 版本差异avcode…

post方法就反回了一个string字符串前台怎么接_Golang Web入门(2):如何实现一个RESTful风格的路由...

摘要在上一篇文章中&#xff0c;我们聊了聊在Golang中怎么实现一个Http服务器。但是在最后我们可以发现&#xff0c;固然DefaultServeMux可以做路由分发的功能&#xff0c;但是他的功能同样是不完善的。由DefaultServeMux做路由分发&#xff0c;是不能实现RESTful风格的API的&a…