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

fail to build decord due to pointer convertion #258

Closed
hubutui opened this issue Mar 10, 2023 · 3 comments
Closed

fail to build decord due to pointer convertion #258

hubutui opened this issue Mar 10, 2023 · 3 comments

Comments

@hubutui
Copy link

hubutui commented Mar 10, 2023

/home/hubutui/Projects/archlinuxcn-repo/archlinuxcn/python-decord/src/decord-0.6.0/src/video/video_reader.cc: In member function ‘virtual void decord::VideoReader::SetVideoStream(int)’:
/home/hubutui/Projects/archlinuxcn-repo/archlinuxcn/python-decord/src/decord-0.6.0/src/video/video_reader.cc:149:88: error: invalid conversion from ‘AVCodec**’ to ‘const AVCodec**’ [-fpermissive]
  149 |     int st_nb = av_find_best_stream(fmt_ctx_.get(), AVMEDIA_TYPE_VIDEO, stream_nb, -1, &dec, 0);
      |                                                                                        ^~~~
      |                                                                                        |
      |                                                                                        AVCodec**
In file included from /home/hubutui/Projects/archlinuxcn-repo/archlinuxcn/python-decord/src/decord-0.6.0/src/video/ffmpeg/ffmpeg_common.h:25,
                 from /home/hubutui/Projects/archlinuxcn-repo/archlinuxcn/python-decord/src/decord-0.6.0/src/video/threaded_decoder_interface.h:10,

quick fix, we could change AVCodec *dec; to const AVCodec *dec; in

AVCodec *dec;

and if USE_CUDA=ON, then you also need to cast this pointer in
ctx_.device_id, codecpar.get(), fmt_ctx_->iformat));

change fmt_ctx_->iformat to (AVInputFormat*)fmt_ctx_->iformat.

@gracemcgrath
Copy link

gracemcgrath commented Mar 14, 2023

you might need to try the build again with ffmpeg 4 instead of 5. I referenced #203 and #186 to solve the same issues for macOS

@hubutui
Copy link
Author

hubutui commented Mar 14, 2023

thanks, and my fix also works for ffmpeg 5.

@hubutui
Copy link
Author

hubutui commented Mar 1, 2024

ref #257

@hubutui hubutui closed this as completed Mar 1, 2024
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