bakape / thumbnailer

Go media thumbnailer
MIT License
152 stars 36 forks source link

Compile error #76

Open be195 opened 1 year ago

be195 commented 1 year ago

If you try to use this library with clean ffmpeg (libraries) build, you would get this error (ffmpeg.h):

unknown type name 'AVCodecContext'; did you mean 'AVFormatContext'?
16 | int codec_context(AVCodecContext** avcc, int* stream, AVFormatContext

I assume it's most likely because ffmpeg.h is not including libavcodec/avcodec.h, which declares AVCodecContext.

benjohnson commented 1 year ago

I'm seeing the same issue on my end.

bakape commented 1 year ago

What FFmpeg versions are you compiling against?

On Mon, 10 Oct 2022 at 17:03, Ben Johnson @.***> wrote:

I'm seeing the same issue on my end.

— Reply to this email directly, view it on GitHub https://github.com/bakape/thumbnailer/issues/76#issuecomment-1273363506, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB347MHYZFLD27GRFGNHV5TWCQO2PANCNFSM6AAAAAARACRZ3U . You are receiving this because you are subscribed to this thread.Message ID: @.***>

benjohnson commented 1 year ago

5.1.1. Let me know if there's any other way I can help.

gedw99 commented 1 year ago

i also hit this...

amlwwalker commented 1 year ago

me too

KernelDeimos commented 10 months ago

Reproduced Archlinux ffmpeg 6.0

KernelDeimos commented 10 months ago

Fixed by this PR, and merged on the Puter fork

For a quick fix until this is merged, assuming you're using modules:

git mod edit -replace github.com/bakape/thumbnailer/v2=github.com/HeyPuter/thumbnailer/v2@c526241bacef93a02053be748a6214751fe31cb1

This will temporarily use the patch commit on the Puter fork. When this is merged upstream, remove the replace line that was added to go.mod to continue getting patches from the bakape/thumbnailer.

phasetri commented 7 months ago

Fixed by this PR, and merged on the Puter fork

For a quick fix until this is merged, assuming you're using modules:

git mod edit -replace github.com/bakape/thumbnailer/v2=github.com/HeyPuter/thumbnailer/v2@c526241bacef93a02053be748a6214751fe31cb1

This will temporarily use the patch commit on the Puter fork. When this is merged upstream, remove the replace line that was added to go.mod to continue getting patches from the bakape/thumbnailer.

Thanks for the fix! Btw, just to be pedantic, it should be go mod rather than git mod.

While it doesn't break anything, I see a few compile warnings coming from ffmpeg.c:

# github.com/bakape/thumbnailer/v2
ffmpeg.c: In function ‘create_context’:
ffmpeg.c:29:14: warning: assignment discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
   29 |         avif = av_find_input_format(input_format);
      |              ^
ffmpeg.c: In function ‘codec_context’:
ffmpeg.c:59:15: warning: assignment discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
   59 |         codec = avcodec_find_decoder_by_name("libvpx");
      |               ^
ffmpeg.c:62:15: warning: assignment discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
   62 |         codec = avcodec_find_decoder_by_name("libvpx-vp9");
      |               ^
ffmpeg.c:66:15: warning: assignment discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
   66 |         codec = avcodec_find_decoder(st->codecpar->codec_id);
      |               ^

I'm not familiar with C, but is it possible to resolve these warnings?