dirkvdb / ffmpegthumbnailer

Lightweight video thumbnailer that can be used by file managers to create thumbnails for video files
GNU General Public License v2.0
489 stars 70 forks source link

Fix a -fpermissive build issue. #199

Closed orbea closed 3 years ago

orbea commented 3 years ago

On gentoo with a recent ffmpeg git the build fails. (https://github.com/FFmpeg/FFmpeg/commit/5541cffa17a8c45004e5ceeda52d4d6b2acee037)

samu: job failed: /usr/lib/ccache/bin/c++ -D_FILE_OFFSET_BITS=64 -D__STDC_CONSTANT_MACROS -I. -fPIC -std=c++11 -MD -MT CMakeFiles/libffmpegthumbnailerobj.dir/libffmpegthumbnailer/moviedecoder.cpp.o -MF CMakeFiles/libffmpegthumbnailerobj.dir/libffmpegthumbnailer/moviedecoder.cpp.o.d -o CMakeFiles/libffmpegthumbnailerobj.dir/libffmpegthumbnailer/moviedecoder.cpp.o -c ../libffmpegthumbnailer/moviedecoder.cpp
../libffmpegthumbnailer/moviedecoder.cpp: In member function ‘void ffmpegthumbnailer::MovieDecoder::initializeVideo(bool)’:
../libffmpegthumbnailer/moviedecoder.cpp:198:41: error: invalid conversion from ‘const AVCodec*’ to ‘AVCodec*’ [-fpermissive]
  198 |     m_pVideoCodec = avcodec_find_decoder(m_pVideoStream->codecpar->codec_id);
      |                     ~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                                         |
      |                                         const AVCodec*
samu: subcommand failed

I am not sure this is the best way of solving the issue so please confirm, thanks!

orbea commented 3 years ago

@dirkvdb When you have a chance can you please review this PR? :)

dirkvdb commented 3 years ago

Hi, I cannot approve a const_cast as a solution.

I can't understand how avcodec_find_decoder would return a const* in your case but unfortunately I currently have no time to investigate this.

dirkvdb commented 3 years ago

Fixed by pull request #201