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

Fix for failure to build against very recent ffmpeg (2020-05-02) #386

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

wyatt8740
Copy link

@wyatt8740 wyatt8740 commented May 9, 2020

This is my fix to make freshplayerplugin compile on my Debian Sid system, with ffmpeg git master from 02 May 2020.

I think this is actually a fix, because simply changing the preprocessor checks from, for instance:

#if !HAVE_avcodec_free_context

to

#ifndef HAVE_avcodec_free_context

…let it build.

I just upgraded ffmpeg on my system to today's git master, and that builds with or without my patches; my week-old ffmpeg requires my patches to build however.

src/ppb_video_decoder.c:167:1: error: static declaration of ‘avcodec_free_context’ follows non-static declaration
  167 | avcodec_free_context(AVCodecContext **pavctx)

…and several others in the same file.

@wyatt8740
Copy link
Author

wyatt8740 commented May 9, 2020

I just finished compiling today's ffmpeg; it appears that this morning's git master does allow freshplayerplugin to build without issues. So my guess is that the preprocessor defines aren't behaving as expected (!<something that is not defined> isn't working to check for undefined values; only defined ones).

My patch still appears to work with the most up-to-date ffmpeg, however (the library compiles with it as well), so I think my PR is still valid as it allows for ffmpeg libraries older than last week to be used.

(I edited the top post to remove some stuff in light of this new build).

@i-rinat
Copy link
Owner

i-rinat commented May 11, 2020

#ifndef HAVE_avcodec_free_context

I used HAVE_ macros in a non-conventional way. Rather than just being defined only when feature is available, they are always defined, but has values of 0 or 1. That's why #if' were used instead of #ifdef or #ifndef. (That confuses readers of the code, I should change it to the conventional way.)

I think the patch is not correct in its current state. Unfortunately, can't say how to make it correct yet.

@wyatt8740
Copy link
Author

Maybe check for a specific libavcodec version?
https://ffmpeg.org/doxygen/3.2/libavcodec_2version_8h.html

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

Successfully merging this pull request may close these issues.

None yet

2 participants