PSDK编译sample C++失败
Completed编译C版本成功生成可执行文件,但是C++版本编译过程报错:
/home/malab/Payload-SDK/samples/sample_c++/module_sample/liveview/dji_camera_stream_decoder.cpp: In member function ‘bool DJICameraStreamDecoder::init()’:
/home/malab/Payload-SDK/samples/sample_c++/module_sample/liveview/dji_camera_stream_decoder.cpp:81:5: error: ‘avcodec_register_all’ was not declared in this scope
81 | avcodec_register_all();
| ^~~~~~~~~~~~~~~~~~~~
/home/malab/Payload-SDK/samples/sample_c++/module_sample/liveview/dji_camera_stream_decoder.cpp:88:34: error: invalid conversion from ‘const AVCodec*’ to ‘AVCodec*’ [-fpermissive]
88 | pCodec = avcodec_find_decoder(AV_CODEC_ID_H264);
| ~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~
| |
| const AVCodec*
/home/malab/Payload-SDK/samples/sample_c++/module_sample/liveview/dji_camera_stream_decoder.cpp: In member function ‘void DJICameraStreamDecoder::cleanup()’:
/home/malab/Payload-SDK/samples/sample_c++/module_sample/liveview/dji_camera_stream_decoder.cpp:141:22: warning: ‘int avcodec_close(AVCodecContext*)’ is deprecated [-Wdeprecated-declarations]
141 | avcodec_close(pCodecCtx);
| ~~~~~~~~~~~~~^~~~~~~~~~~
In file included from /home/malab/Payload-SDK/samples/sample_c++/module_sample/liveview/dji_camera_stream_decoder.hpp:33,
from /home/malab/Payload-SDK/samples/sample_c++/module_sample/liveview/dji_camera_stream_decoder.cpp:26:
/usr/local/include/libavcodec/avcodec.h:2387:5: note: declared here
2387 | int avcodec_close(AVCodecContext *avctx);
| ^~~~~~~~~~~~~
/home/malab/Payload-SDK/samples/sample_c++/module_sample/liveview/dji_camera_stream_decoder.cpp: In member function ‘void DJICameraStreamDecoder::decodeBuffer(const uint8_t*, int)’:
/home/malab/Payload-SDK/samples/sample_c++/module_sample/liveview/dji_camera_stream_decoder.cpp:194:19: warning: ‘void av_init_packet(AVPacket*)’ is deprecated [-Wdeprecated-declarations]
194 | av_init_packet(&pkt);
| ~~~~~~~~~~~~~~^~~~~~
In file included from /usr/local/include/libavcodec/avcodec.h:44,
from /home/malab/Payload-SDK/samples/sample_c++/module_sample/liveview/dji_camera_stream_decoder.hpp:33,
from /home/malab/Payload-SDK/samples/sample_c++/module_sample/liveview/dji_camera_stream_decoder.cpp:26:
/usr/local/include/libavcodec/packet.h:653:6: note: declared here
653 | void av_init_packet(AVPacket *pkt);
| ^~~~~~~~~~~~~~
/home/malab/Payload-SDK/samples/sample_c++/module_sample/liveview/dji_camera_stream_decoder.cpp:210:13: error: ‘avcodec_decode_video2’ was not declared in this scope; did you mean ‘avcodec_decode_subtitle2’?
210 | avcodec_decode_video2(pCodecCtx, pFrameYUV, &gotPicture, &pkt);
| ^~~~~~~~~~~~~~~~~~~~~
| avcodec_decode_subtitle2
/home/malab/Payload-SDK/samples/sample_c++/module_sample/liveview/dji_camera_stream_decoder.cpp:227:31: error: ‘avpicture_get_size’ was not declared in this scope
227 | bufSize = avpicture_get_size(AV_PIX_FMT_RGB24, w, h);
| ^~~~~~~~~~~~~~~~~~
/home/malab/Payload-SDK/samples/sample_c++/module_sample/liveview/dji_camera_stream_decoder.cpp:229:37: error: ‘AVPicture’ was not declared in this scope; did you mean ‘gotPicture’?
229 | avpicture_fill((AVPicture *) pFrameRGB, rgbBuf, AV_PIX_FMT_RGB24, w, h);
| ^~~~~~~~~
| gotPicture
/home/malab/Payload-SDK/samples/sample_c++/module_sample/liveview/dji_camera_stream_decoder.cpp:229:48: error: expected primary-expression before ‘)’ token
229 | avpicture_fill((AVPicture *) pFrameRGB, rgbBuf, AV_PIX_FMT_RGB24, w, h);
| ^
/home/malab/Payload-SDK/samples/sample_c++/module_sample/liveview/dji_camera_stream_decoder.cpp:229:21: error: ‘avpicture_fill’ was not declared in this scope
229 | avpicture_fill((AVPicture *) pFrameRGB, rgbBuf, AV_PIX_FMT_RGB24, w, h);
| ^~~~~~~~~~~~~~
/home/malab/Payload-SDK/samples/sample_c++/module_sample/liveview/dji_camera_stream_decoder.cpp:246:5: error: ‘av_free_packet’ was not declared in this scope; did you mean ‘av_new_packet’?
246 | av_free_packet(&pkt);
| ^~~~~~~~~~~~~~
| av_new_packet
make[2]: *** [samples/sample_c++/platform/linux/manifold2/CMakeFiles/dji_sdk_demo_linux_cxx.dir/build.make:734: samples/sample_c++/platform/linux/manifold2/CMakeFiles/dji_sdk_demo_linux_cxx.dir/__/__/__/module_sample/liveview/dji_camera_stream_decoder.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:170: samples/sample_c++/platform/linux/manifold2/CMakeFiles/dji_sdk_demo_linux_cxx.dir/all] Error 2
make: *** [Makefile:136: all] Error 2
Please sign in to leave a comment.
Comments
1 comment