FFMPEG:“PIX_FMT_BGR24”没有在这个范围内声明 [英] FFMPEG: ‘PIX_FMT_BGR24’ was not declared in this scope

查看:3336
本文介绍了FFMPEG:“PIX_FMT_BGR24”没有在这个范围内声明的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我建立使用FFMPEG API一个简单的解码程序。我知道有在OpenCV中可用的解决方案但具体原因我是从使用避免设置自己。因为我是很新的FFMPEG(和这个社会一样),我想知道是否有,虽然建设FFMPEG我可能会做任何错误。

编译:我使用GCC 5.3.0编译和构建

下面是我遵循的步骤:


  1. 我有使用以下配置将FFMPEG库:


      

    ./配置 - preFIX = /家庭/ DEP /的ffmpeg /安装/ --pkg-配置-标志= - 静态--enable-GPL --disable-YASM



  2. 我的编译命令是应用程序:


      

    G ++ -std = C ++ 11 -I /家庭/ DEP /的ffmpeg /安装/包括/ Queue.cpp Image.cpp CaptureFFMPEGFrame.cpp Object.cpp的main.cpp -o主要-L /家庭/ DEP /的ffmpeg /安装/ lib目录-lavutil -lav codeC -lavformat -lavdevice -lavfilter -lswscale -lswresample -lpostproc -lpthread -lz -lrt -llzma -lbz2



我现在面临的错误是:

  CaptureFFMPEGFrame.cpp:203:169:错误:'PIX_FMT_BGR24在此范围未声明
     mpFrameSwsContext = sws_getContext(mpAV codecContext->宽度,mpAV codecContext->的高度,mpAV codecContext-> pix_fmt,mpAV codecContext->宽度,mpAV codecContext- >的高度,PIX_FMT_BGR24,SWS_BICUBIC,NULL,NULL,NULL)

我的努力和理解:


  1. 从我的理解,libavutil / pixfmt.h包含了我与其他包括和错误仍然存​​在包括沿像素格式。你也可以看到我已经与我的应用程序一起包括图书馆。


  2. 由于我的计划是CPP code,所以我的头被使用的externC,即已经包含了的#includelibav codeC / AV codeC。 H


什么我可能会错过?

非常感谢。


解决方案

由于提交 78071a14 ,像素格式已经与 AV pfixed $ p $ _ PIX_FMT _ * 定义为移动到 libavutil / old_pix_fmts.h (这是包括原 pixfmt.h )。然后,此文件是下一个主要版本中删除。

该修补程序(如在评论中所述)只是为了这个preFIX添加到任何 PIX_FMT _其中尚未更新* 语句。

I am building a simple decoding application using FFMPEG API. I know there are solutions available in OpenCV but for specific reason I am refraining myself from using that. Since I am very new to FFMPEG (and to this community as well), I would like to know if there is any mistake that I might have done while building FFMPEG.

Compiler: I am using gcc 5.3.0 for compilation and building.

Following are the steps that I followed:

  1. I have build FFMPEG library using following configuration:

    ./configure --prefix=/home/dep/ffmpeg/install/ --pkg-config-flags=--static --enable-gpl --disable-yasm

  2. My compiling command is for the application:

    g++ -std=c++11 -I/home/dep/ffmpeg/install/include/ Queue.cpp Image.cpp CaptureFFMPEGFrame.cpp Object.cpp main.cpp -o main -L/home/dep/ffmpeg/install/lib -lavutil -lavcodec -lavformat -lavdevice -lavfilter -lswscale -lswresample -lpostproc -lpthread -lz -lrt -llzma -lbz2

The error I am facing is :

CaptureFFMPEGFrame.cpp:203:169: error: ‘PIX_FMT_BGR24’ was not declared in this scope
     mpFrameSwsContext = sws_getContext(mpAVCodecContext->width, mpAVCodecContext->height, mpAVCodecContext->pix_fmt, mpAVCodecContext->width, mpAVCodecContext->height, PIX_FMT_BGR24, SWS_BICUBIC, NULL, NULL, NULL)

My effort and understanding:

  1. From my understanding, libavutil/pixfmt.h contains pixel formats which I included along with other includes and the error persists. You can also see libraries I have included along with my application.

  2. Since my program is cpp code, therefore my headers are already included using extern "C", i.e. #include "libavcodec/avcodec.h"

Anything I might have missed?

Many thanks.

解决方案

As of commit 78071a14, pixel formats have been prefixed with AV_, and the PIX_FMT_* defines were moves to libavutil/old_pix_fmts.h (which was included by the original pixfmt.h). This file was then removed in the next major version.

The fix (as described in the comments) was just to add this prefix to any PIX_FMT_* statements which haven't been updated yet.

这篇关于FFMPEG:“PIX_FMT_BGR24”没有在这个范围内声明的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆