Skip to content

Commit 5859b29

Browse files
authored
Enable Libheif Plugin System (#205)
* DENABLE_PLUGIN_LOADING=ON * CI runners: macos-11 -> macos-12 Signed-off-by: Alexander Piskun <[email protected]> --------- Signed-off-by: Alexander Piskun <[email protected]>
1 parent a45f845 commit 5859b29

File tree

16 files changed

+157
-31
lines changed

16 files changed

+157
-31
lines changed

.github/workflows/analysis-coverage.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,9 @@ jobs:
5959
run: python3 -c "import pillow_heif; print(pillow_heif.libheif_info())"
6060

6161
- name: Generate coverage report
62-
run: coverage run -m pytest && coverage xml && coverage html
62+
run: |
63+
TEST_PLUGIN_LOAD="$(whereis libheif | awk '{print $2}')/plugins/libheif-x265.so" coverage run -m pytest
64+
coverage xml && coverage html
6365
6466
- name: HTML coverage to artifacts
6567
uses: actions/upload-artifact@v3
@@ -104,7 +106,9 @@ jobs:
104106
run: python3 -c "import pillow_heif; print(pillow_heif.libheif_info())"
105107

106108
- name: Generate coverage report
107-
run: coverage run -m pytest && coverage xml && coverage html
109+
run: |
110+
TEST_PLUGIN_LOAD="$(whereis libheif | awk '{print $2}')/plugins/libheif-x265.so" coverage run -m pytest
111+
coverage xml && coverage html
108112
109113
- name: HTML coverage to artifacts
110114
uses: actions/upload-artifact@v3

.github/workflows/test-src-build-macos.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@ concurrency:
2828
cancel-in-progress: true
2929

3030
jobs:
31-
full_macos_11:
32-
name: macOS:11-x86_64
33-
runs-on: macos-11
31+
full_macos_12:
32+
name: macOS:12-x86_64
33+
runs-on: macos-12
3434
env:
3535
TEST_DECODE_THREADS: 0 # This test fails on GitHub on macOS. We have such enabled test on Cirrus.
3636
PH_FULL_ACTION: 1
@@ -52,9 +52,9 @@ jobs:
5252
- name: Perform tests
5353
run: python3 -m pytest
5454

55-
lite_macos_11:
56-
name: macOS:11-x86_64(Pi-Heif)
57-
runs-on: macos-11
55+
lite_macos_12:
56+
name: macOS:12-x86_64(Pi-Heif)
57+
runs-on: macos-12
5858
env:
5959
TEST_DECODE_THREADS: 0
6060
PH_LIGHT_ACTION: 1

.github/workflows/test-wheels-pi_heif.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,8 @@ jobs:
104104
cd .. && python3 -m pytest pillow_heif
105105
106106
macos-wheels:
107-
name: macOS • 11 • ${{ matrix.python-version }}
108-
runs-on: macos-11
107+
name: macOS • 12 • ${{ matrix.python-version }}
108+
runs-on: macos-12
109109
strategy:
110110
fail-fast: false
111111
matrix:

.github/workflows/test-wheels.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,8 @@ jobs:
9999
run: cd .. && python3 -m pytest pillow_heif
100100

101101
macos-wheels:
102-
name: macOS • 11 • ${{ matrix.python-version }}
103-
runs-on: macos-11
102+
name: macOS • 12 • ${{ matrix.python-version }}
103+
runs-on: macos-12
104104
strategy:
105105
matrix:
106106
python-version: ["pypy-3.8", "pypy-3.9", "pypy-3.10", "3.8", "3.9", "3.10", "3.11", "3.12"]

.github/workflows/wheels-pi_heif.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ jobs:
9393

9494
wheels_macos:
9595
name: macosx • x86_64
96-
runs-on: macos-11
96+
runs-on: macos-12
9797

9898
steps:
9999
- uses: actions/checkout@v4
@@ -109,6 +109,7 @@ jobs:
109109
env:
110110
CIBW_ARCHS: "x86_64"
111111
CIBW_ENVIRONMENT_MACOS: PH_LIGHT_ACTION=1 TEST_DECODE_THREADS=0
112+
MACOSX_DEPLOYMENT_TARGET: "10.10"
112113

113114
- name: Checking built wheels
114115
run: |

.github/workflows/wheels-pillow_heif.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ jobs:
8989

9090
wheels_macos:
9191
name: macosx • x86_64
92-
runs-on: macos-11
92+
runs-on: macos-12
9393

9494
steps:
9595
- uses: actions/checkout@v4
@@ -100,6 +100,7 @@ jobs:
100100
env:
101101
CIBW_ARCHS: "x86_64"
102102
CIBW_ENVIRONMENT_MACOS: PH_FULL_ACTION=1 TEST_DECODE_THREADS=0
103+
MACOSX_DEPLOYMENT_TARGET: "10.10"
103104

104105
- name: Check built wheels
105106
run: |

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
All notable changes to this project will be documented in this file.
22

3-
## [0.15.0 - 2024-0x-xx]
3+
## [0.15.0 - 2024-02-02]
44

55
### Added
66

77
- `libheif_info` function: added `encoders` and `decoders` keys to the result, for future libheif plugins support. #189
88
- `options.PREFERRED_ENCODER` - to use `encoder` different from the default one. #192
99
- `options.PREFERRED_DECODER` - to use `decoder` different from the default one. #193
10+
- New `load_plugin` function. `ENABLE_PLUGIN_LOADING` option now is `ON` in the libheif configuration. #154
1011

1112
### Changed
1213

libheif/linux_build_libs.py

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -189,8 +189,29 @@ def build_lib_linux(url: str, name: str):
189189
cmake_args += ["-DCMAKE_BUILD_TYPE=Release"]
190190
if name == "libheif":
191191
cmake_args += (
192-
"-DWITH_EXAMPLES=OFF -DWITH_RAV1E=OFF -DWITH_DAV1D=OFF -DWITH_SvtEnc=OFF"
193-
" -DWITH_LIBSHARPYUV=OFF -DENABLE_PLUGIN_LOADING=OFF".split()
192+
"-DWITH_LIBDE265=ON "
193+
"-DWITH_LIBDE265_PLUGIN=OFF "
194+
"-DWITH_X265=ON "
195+
"-DWITH_X265_PLUGIN=OFF "
196+
"-DWITH_AOM_DECODER=ON "
197+
"-DWITH_AOM_DECODER_PLUGIN=OFF "
198+
"-DWITH_AOM_ENCODER=ON "
199+
"-DWITH_AOM_ENCODER_PLUGIN=OFF "
200+
"-DWITH_RAV1E=OFF "
201+
"-DWITH_RAV1E_PLUGIN=OFF "
202+
"-DWITH_DAV1D=OFF "
203+
"-DWITH_DAV1D_PLUGIN=OFF "
204+
"-DWITH_SvtEnc=OFF "
205+
"-DWITH_SvtEnc_PLUGIN=OFF "
206+
"-DWITH_KVAZAAR=OFF "
207+
"-DWITH_KVAZAAR_PLUGIN=OFF "
208+
"-DWITH_JPEG_DECODER=OFF "
209+
"-DWITH_JPEG_ENCODER=OFF "
210+
"-DWITH_OpenJPEG_DECODER=OFF "
211+
"-DWITH_OpenJPEG_ENCODER=OFF "
212+
"-DENABLE_PLUGIN_LOADING=ON "
213+
"-DWITH_LIBSHARPYUV=OFF "
214+
"-DWITH_EXAMPLES=OFF".split()
194215
)
195216
_hide_build_process = False
196217
if is_musllinux():

libheif/macos/libheif.rb

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,30 @@ class Libheif < Formula
2020

2121
def install
2222
args = %W[
23+
-DWITH_LIBDE265=ON
24+
-DWITH_LIBDE265_PLUGIN=OFF
25+
-DWITH_X265=ON
26+
-DWITH_X265_PLUGIN=OFF
27+
-DWITH_AOM_DECODER=ON
28+
-DWITH_AOM_DECODER_PLUGIN=OFF
29+
-DWITH_AOM_ENCODER=ON
30+
-DWITH_AOM_ENCODER_PLUGIN=OFF
2331
-DWITH_RAV1E=OFF
32+
-DWITH_RAV1E_PLUGIN=OFF
2433
-DWITH_DAV1D=OFF
34+
-DWITH_DAV1D_PLUGIN=OFF
2535
-DWITH_SvtEnc=OFF
26-
-DWITH_LIBSHARPYUV=OFF
27-
-DENABLE_PLUGIN_LOADING=OFF
36+
-DWITH_SvtEnc_PLUGIN=OFF
37+
-DWITH_KVAZAAR=OFF
38+
-DWITH_KVAZAAR_PLUGIN=OFF
39+
-DWITH_FFMPEG_DECODER=OFF
40+
-DWITH_FFMPEG_DECODER_PLUGIN=OFF
2841
-DWITH_JPEG_DECODER=OFF
2942
-DWITH_JPEG_ENCODER=OFF
3043
-DWITH_OpenJPEG_DECODER=OFF
3144
-DWITH_OpenJPEG_ENCODER=OFF
45+
-DENABLE_PLUGIN_LOADING=ON
46+
-DWITH_LIBSHARPYUV=OFF
3247
-DCMAKE_INSTALL_RPATH=#{rpath}
3348
]
3449
system "cmake", "-S", ".", "-B", "build", *args, *std_cmake_args

libheif/windows/mingw-w64-libheif/PKGBUILD

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,31 @@ build() {
3535
-DCMAKE_INSTALL_PREFIX=${MINGW_PREFIX} \
3636
"${extra_config[@]}" \
3737
-DBUILD_SHARED_LIBS=ON \
38+
-DWITH_LIBDE265=ON \
39+
-DWITH_LIBDE265_PLUGIN=OFF \
40+
-DWITH_X265=ON \
41+
-DWITH_X265_PLUGIN=OFF \
42+
-DWITH_AOM_DECODER=ON \
43+
-DWITH_AOM_DECODER_PLUGIN=OFF \
44+
-DWITH_AOM_ENCODER=ON \
45+
-DWITH_AOM_ENCODER_PLUGIN=OFF \
3846
-DWITH_RAV1E=OFF \
47+
-DWITH_RAV1E_PLUGIN=OFF \
3948
-DWITH_DAV1D=OFF \
49+
-DWITH_DAV1D_PLUGIN=OFF \
4050
-DWITH_SvtEnc=OFF \
41-
-DWITH_LIBSHARPYUV=OFF \
42-
-DENABLE_PLUGIN_LOADING=OFF \
51+
-DWITH_SvtEnc_PLUGIN=OFF \
52+
-DWITH_KVAZAAR=OFF \
53+
-DWITH_KVAZAAR_PLUGIN=OFF \
54+
-DWITH_FFMPEG_DECODER=OFF \
55+
-DWITH_FFMPEG_DECODER_PLUGIN=OFF \
4356
-DWITH_JPEG_DECODER=OFF \
4457
-DWITH_JPEG_ENCODER=OFF \
4558
-DWITH_OpenJPEG_DECODER=OFF \
4659
-DWITH_OpenJPEG_ENCODER=OFF \
60+
-DENABLE_PLUGIN_LOADING=ON \
61+
-DWITH_LIBSHARPYUV=OFF \
62+
-DWITH_EXAMPLES=OFF \
4763
-DX265_CFLAGS="-DX265_API_IMPORTS" \
4864
../${_realname}-${pkgver}
4965

0 commit comments

Comments
 (0)