Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error during make: invalid conversion from 'const AVCodec*' to 'AVCodec*' #155

Closed
SCZwangxiao opened this issue May 20, 2021 · 2 comments
Closed

Comments

@SCZwangxiao
Copy link

root@machine-2824-prod:/home/decord/build# make
Scanning dependencies of target decord
[  2%] Building CXX object CMakeFiles/decord.dir/src/runtime/c_runtime_api.cc.o
[  5%] Building CXX object CMakeFiles/decord.dir/src/runtime/cpu_device_api.cc.o
[  7%] Building CXX object CMakeFiles/decord.dir/src/runtime/dso_module.cc.o
[ 10%] Building CXX object CMakeFiles/decord.dir/src/runtime/file_util.cc.o
[ 13%] Building CXX object CMakeFiles/decord.dir/src/runtime/module.cc.o
[ 15%] Building CXX object CMakeFiles/decord.dir/src/runtime/module_util.cc.o
[ 18%] Building CXX object CMakeFiles/decord.dir/src/runtime/ndarray.cc.o
[ 21%] Building CXX object CMakeFiles/decord.dir/src/runtime/registry.cc.o
[ 23%] Building CXX object CMakeFiles/decord.dir/src/runtime/str_util.cc.o
[ 26%] Building CXX object CMakeFiles/decord.dir/src/runtime/system_lib_module.cc.o
[ 28%] Building CXX object CMakeFiles/decord.dir/src/runtime/thread_pool.cc.o
[ 31%] Building CXX object CMakeFiles/decord.dir/src/runtime/threading_backend.cc.o
[ 34%] Building CXX object CMakeFiles/decord.dir/src/runtime/workspace_pool.cc.o
[ 36%] Building CXX object CMakeFiles/decord.dir/src/video/logging.cc.o
[ 39%] Building CXX object CMakeFiles/decord.dir/src/video/storage_pool.cc.o
[ 42%] Building CXX object CMakeFiles/decord.dir/src/video/video_interface.cc.o
[ 44%] Building CXX object CMakeFiles/decord.dir/src/video/video_loader.cc.o
[ 47%] Building CXX object CMakeFiles/decord.dir/src/video/video_reader.cc.o
/home/decord/src/video/video_reader.cc: In constructor 'decord::VideoReader::VideoReader(std::__cxx11::string, DLContext, int, int, int, int, std::__cxx11::string)':
/home/decord/src/video/video_reader.cc:100:52: error: invalid conversion from 'const AVCodec*' to 'AVCodec*' [-fpermissive]
         AVCodec *local_codec = avcodec_find_decoder(st->codecpar->codec_id);
                                ~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
/home/decord/src/video/video_reader.cc: In member function 'virtual void decord::VideoReader::SetVideoStream(int)':
/home/decord/src/video/video_reader.cc:149:88: error: invalid conversion from 'AVCodec**' to 'const AVCodec**' [-fpermissive]
     int st_nb = av_find_best_stream(fmt_ctx_.get(), AVMEDIA_TYPE_VIDEO, stream_nb, -1, &dec, 0);
                                                                                        ^~~~
In file included from /home/decord/src/video/ffmpeg/ffmpeg_common.h:24:0,
                 from /home/decord/src/video/threaded_decoder_interface.h:10,
                 from /home/decord/src/video/video_reader.h:10,
                 from /home/decord/src/video/video_reader.cc:7:
/usr/local/include/libavformat/avformat.h:2038:5: note:   initializing argument 5 of 'int av_find_best_stream(AVFormatContext*, AVMediaType, int, int, const AVCodec**, int)'
 int av_find_best_stream(AVFormatContext *ic,
     ^~~~~~~~~~~~~~~~~~~
/home/decord/src/video/video_reader.cc:165:55: error: invalid conversion from 'const AVInputFormat*' to 'AVInputFormat*' [-fpermissive]
             ctx_.device_id, codecpar.get(), fmt_ctx_->iformat));
                                             ~~~~~~~~~~^~~~~~~
In file included from /home/decord/src/video/video_reader.cc:11:0:
/home/decord/src/video/nvcodec/cuda_threaded_decoder.h:49:9: note:   initializing argument 3 of 'decord::cuda::CUThreadedDecoder::CUThreadedDecoder(int, AVCodecParameters*, AVInputFormat*)'
         CUThreadedDecoder(int device_id, AVCodecParameters *codecpar, AVInputFormat *iformat);
         ^~~~~~~~~~~~~~~~~
CMakeFiles/decord.dir/build.make:470: recipe for target 'CMakeFiles/decord.dir/src/video/video_reader.cc.o' failed
make[2]: *** [CMakeFiles/decord.dir/src/video/video_reader.cc.o] Error 1
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/decord.dir/all' failed
make[1]: *** [CMakeFiles/decord.dir/all] Error 2
Makefile:129: recipe for target 'all' failed
make: *** [all] Error 2

I'm using:

  • cmake 3.10.2
  • make 4.1
@zhreshold
Copy link
Member

Verified that the problem is caused by the latest ffmpeg, temporary solution is to downgrade libavcodec to ffmpeg<=4.2. I will try to update the code in the future.

@zhreshold
Copy link
Member

Fixed in #160

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants