/root/catkin_uc/src/usb_cam/src/camera_driver.cpp: In destructor ‘virtual usb_cam::AbstractV4LUSBCam::~AbstractV4LUSBCam()’: /root/catkin_uc/src/usb_cam/src/camera_driver.cpp:237:5: error: ‘av_packet_free’ was not declared in this scope av_packet_free(&avpkt); ^~~~~~~~~~~~~~ /root/catkin_uc/src/usb_cam/src/camera_driver.cpp:237:5: note: suggested alternative: ‘av_packet_ref’ av_packet_free(&avpkt); ^~~~~~~~~~~~~~ av_packet_ref /root/catkin_uc/src/usb_cam/src/camera_driver.cpp: In static member function ‘static bool usb_cam::AbstractV4LUSBCam::init_decoder()’: /root/catkin_uc/src/usb_cam/src/camera_driver.cpp:377:13: error: ‘av_packet_alloc’ was not declared in this scope avpkt = av_packet_alloc(); ^~~~~~~~~~~~~~~ /root/catkin_uc/src/usb_cam/src/camera_driver.cpp:377:13: note: suggested alternative: ‘av_image_alloc’ avpkt = av_packet_alloc(); ^~~~~~~~~~~~~~~ av_image_alloc /root/catkin_uc/src/usb_cam/src/camera_driver.cpp: In static member function ‘static bool usb_cam::AbstractV4LUSBCam::decode_ffmpeg(const void*, int, usb_cam::camera_image_t*)’: /root/catkin_uc/src/usb_cam/src/camera_driver.cpp:777:8: error: ‘avcodec_send_packet’ was not declared in this scope if(avcodec_send_packet(avcodec_context, avpkt) < 0) ^~~~~~~~~~~~~~~~~~~ /root/catkin_uc/src/usb_cam/src/camera_driver.cpp:777:8: note: suggested alternative: ‘av_append_packet’ if(avcodec_send_packet(avcodec_context, avpkt) < 0) ^~~~~~~~~~~~~~~~~~~ av_append_packet /root/catkin_uc/src/usb_cam/src/camera_driver.cpp:790:9: error: ‘avcodec_receive_frame’ was not declared in this scope if (avcodec_receive_frame(avcodec_context, avframe_camera) < 0) ^~~~~~~~~~~~~~~~~~~~~ /root/catkin_uc/src/usb_cam/src/camera_driver.cpp:790:9: note: suggested alternative: ‘avcodec_free_frame’ if (avcodec_receive_frame(avcodec_context, avframe_camera) < 0) ^~~~~~~~~~~~~~~~~~~~~ avcodec_free_frame usb_cam/CMakeFiles/v4l_driver.dir/build.make:110: recipe for target 'usb_cam/CMakeFiles/v4l_driver.dir/src/camera_driver.cpp.o' failed make[2]: *** [usb_cam/CMakeFiles/v4l_driver.dir/src/camera_driver.cpp.o] Error 1 CMakeFiles/Makefile2:656: recipe for target 'usb_cam/CMakeFiles/v4l_driver.dir/all' failed make[1]: *** [usb_cam/CMakeFiles/v4l_driver.dir/all] Error 2 Makefile:140: recipe for target 'all' failed make: *** [all] Error 2 Invoking "make -j4 -l4" failed
时间: 2023-08-28 19:58:17 浏览: 127
uvc_driver.rar_UVC 联合开发_ov5693_ov5693win驱动_uvc_uvc camera
根据您提供的错误信息,看起来编译过程中仍然出现了与FFmpeg相关的问题。错误信息指出了一些FFmpeg函数未声明的错误。
从错误信息中可以看到以下几个函数未声明的错误:
- `av_packet_free` => 建议使用 `av_packet_unref`
- `av_packet_alloc` => 建议使用 `av_packet_alloc`
- `avcodec_send_packet` => 建议使用 `avcodec_send_packet`
- `avcodec_receive_frame` => 建议使用 `avcodec_receive_frame`
这些错误可能是由于FFmpeg版本不兼容或配置问题导致的。
解决这些错误的方法是:
1. 确保已正确安装FFmpeg库,以及头文件和库文件的路径设置正确。
2. 检查代码中是否有使用正确的FFmpeg函数名称。
3. 确保您的代码与所使用的FFmpeg版本兼容。
请尝试在 `camera_driver.cpp` 文件开头添加如下 `#include` 声明:
```cpp
extern "C" {
#include <libavcodec/avcodec.h>
#include <libavformat/avformat.h>
#include <libswscale/swscale.h>
}
```
这些头文件包含了FFmpeg库提供的函数和数据结构的声明。通过添加这些头文件的包含语句,您可以正确使用这些函数。
如果问题仍然存在,请确保您的代码中使用的FFmpeg函数与所安装的FFmpeg版本兼容,或者尝试升级您的FFmpeg版本。
如果上述方法无法解决问题,请提供更多关于您的编译环境和代码的详细信息,以便更好地帮助您解决问题。
阅读全文