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

AVERROR(errno) is not defined #454

Closed
ishitatsuyuki opened this issue Aug 28, 2017 · 14 comments
Closed

AVERROR(errno) is not defined #454

ishitatsuyuki opened this issue Aug 28, 2017 · 14 comments

Comments

@ishitatsuyuki
Copy link
Contributor

The modern ffmpeg API uses those macros especially AVERROR(EAGAIN) which is just a errno trick, but this preset doesn't seem to handle it. This makes it virtually impossible to use the new API.

@saudet
Copy link
Member

saudet commented Aug 29, 2017

We would have to pick up the errno constants from somewhere, but they are not part of FFmpeg. The header files differ depending on the operating system. What would you suggest to do?

@ishitatsuyuki
Copy link
Contributor Author

The list used by FFmpeg is purely a subset, and we should implement the most vital ones like EAGAIN. If we can evaluate preprocessor we should get from it, else we would be just using a hardcoded enum.

I have collected all codes directly referenced by the source. Note that there may be other source of errno (e.g. system IO).
https://gist.github.com/7b84f62f9606ef375c94b30b25e004ff

@saudet
Copy link
Member

saudet commented Aug 29, 2017

We also need a list of constants that are available on all the platforms...

@saudet
Copy link
Member

saudet commented Aug 29, 2017

Or actually, we could simply implement them as JNI functions and they would return whatever constants are available as build time.

@ishitatsuyuki
Copy link
Contributor Author

A sad thing is that BSD family including Mac uses a different value of EAGAIN. This means that we cannot hardcode it and must evaluate in some manner.

@saudet
Copy link
Member

saudet commented Sep 1, 2017

Declarations such as this at the bottom of presets/avutil.java appear to have the desired results:

    public static native @MemberGetter @Name("AVERROR(EAGAIN)") int AVERROR_EAGAIN();

Would you mind sending a pull request for this? :)

@ishitatsuyuki
Copy link
Contributor Author

Makes sense. Let me do that over the weekend.

@ishitatsuyuki
Copy link
Contributor Author

Sorry, putting that statement at the bottom of presets/avutil.java doesn't seem to work. Is it somewhere else like InfoMap?

@saudet
Copy link
Member

saudet commented Sep 2, 2017 via email

@ishitatsuyuki
Copy link
Contributor Author

Altering the generated files may cause maintenance burden. Is there any way to do this more systematically?

@saudet
Copy link
Member

saudet commented Sep 2, 2017 via email

@ishitatsuyuki
Copy link
Contributor Author

Putting the statement has no effect. I'm putting statements like this:

    public static native @MemberGetter @Name("AVERROR(EAGAIN)") int AVERROR_EAGAIN();

after public void map and before the class ending curly brace.

What result did you get?

@saudet
Copy link
Member

saudet commented Sep 2, 2017 via email

@ishitatsuyuki
Copy link
Contributor Author

My bad. It actually works, but I didn't notice because generated JNI files gets automatically deleted.

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