Advertisement

ffmpeg源码简析(五)Encode——avformat分配输出上下文, avcodec编码视频

阅读量:

1.avformat_alloc_output_context2()

在基于FFmpeg的视音频编码器程序中,该函数往往作为首个被调用的函数出现(不包括用于组件注册的av_register_all()函数)。avformat_alloc_output_context2()函数的主要作用是初始化一个用于输出的AVFormatContext结构体。该函数的声明位置位于libavformat\avformat.h文件中,具体定义如下所示。

复制代码
    int avformat_alloc_output_context2(AVFormatContext **ctx, AVOutputFormat *oformat,  
                                   const char *format_name, const char *filename);  
    
      
      
    

ctx:用于表示函数调用成功后生成的AVFormatContext结构体。
oformat:用于设定AVFormatContext中的AVOutputFormat,从而确定输出文件的格式。若该参数设为NULL,则可利用后续两个参数(format_name或filename)供FFmpeg自动推断输出格式。

全部评论 (0)

还没有任何评论哟~