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

Add discovery of decoding/encoding heif support #4

Open
Jehan opened this issue Jun 6, 2018 · 10 comments
Open

Add discovery of decoding/encoding heif support #4

Jehan opened this issue Jun 6, 2018 · 10 comments

Comments

@Jehan
Copy link

Jehan commented Jun 6, 2018

Followup of issue #3. In GIMP, all we can do right now is to write down in INSTALL that libheif must be compiled with libx265 and libde265 support. It would be nice if we could instead "discover" at configuration time.

The common way to do so is by the pkg-config .pc file. Either you could add some pkg-config variable telling us whether the encoding or decoding are built-in. Or simply you can create more pc files. Like libheif-encoder.pc and libheif-decoder.pc (I am assuming here these 2 libs are only used for encoding and decoding).

@farindk
Copy link
Contributor

farindk commented Jun 6, 2018

I would prefer to check at runtime what is available and only register those parts of the plugin.
Especially if we are going to add support for more formats, like AV1, doing this at configuration time would increasingly complicate things.

@Jehan
Copy link
Author

Jehan commented Jun 6, 2018

It can be both. Having runtime checks is good too but it would be nice to be able to check somehow that libheif can actually encode/decode heif files. This is typically a case where we could create packages containing a broken HEIF plugin without even realizing it because the configure showed that everything was all right.

@fancycode
Copy link
Member

Keep in mind that libheif could be different at runtime compared to libheif during build-time and the list of supported codecs might be different. Also applications can register external codecs, so a codec might not be there during build-time, but is available later in the application.

I'm +1 with @farindk for checking at runtime.

If you really want to do it at build-time, you could use AC_RUN_IFELSE to build and run a small application in configure and check if a given codec is available.

@farindk
Copy link
Contributor

farindk commented Jun 7, 2018

I understand that you might want to check for support already at configure time. Hence, I've added (commit 9031b53 in libheif) two pkg-config variables "builtin_h265_decoder" and "builtin_h265_encoder" that you can check for. I'll also going to add the runtime check too.

@Jehan
Copy link
Author

Jehan commented Jun 7, 2018

Thanks @fancycode and @farindk.

I would have settled indeed for a AC_RUN_IFELSE check but I don't like these for the very simple reason that they don't work when cross-compiling (so you end-up tweaking your configure script special-casing cross-compilation, etc.). I prefer very much having pkg-config variables. That's great!

@farindk
Copy link
Contributor

farindk commented Jun 11, 2018

I have added two API functions for simple testing at runtime whether there is encoding/decoding support:
int heif_have_decoder_for_format(enum heif_compression_format format)
int heif_have_encoder_for_format(enum heif_compression_format format)

@Jehan
Copy link
Author

Jehan commented Jun 11, 2018

Awesome, thanks @farindk. I would like to propose to close this report when you announce a new release of libheif because we can't update our code based on non-released versions.
Or if you prefer, you can close here and we would appreciate if you could make a comment on our side's report to tell us the release has been done. One way or another. Otherwise I will forget! :P

P.S.: also sorry, I just realized I reported on the wrong project. I should have reported this in the libheif project actually!

@farindk
Copy link
Contributor

farindk commented Jun 11, 2018

Yes, I thought so. I made a fork of gimp with the changes here
https://gitlab.gnome.org/farindk/gimp/tree/changes-for-libheif-v1.3.0
and will send you a pull-request when everything is ready and released.
(Still working on other things like saving thumbnails and saving Exif.)

@Jehan
Copy link
Author

Jehan commented Jun 11, 2018

and will send you a pull-request when everything is ready and released.

Ah awesome. Then you may just close this report if you want. I just wanted to keep something somewhere to send me notifications so that I don't forget. But if you take care of contributing a MR, then I will also get my notification and even won't have to code anything! :-)

@KrasnayaPloshchad
Copy link

This support would be nice choice if you are installed the following plugins from MS Store:
https://www.microsoft.com/store/productId/9PMMSR1CGPWG
https://www.microsoft.com/store/productId/9NMZLZ57R3T7
https://www.microsoft.com/store/productId/9N4WGH0Z6VHQ

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

4 participants