Skip to contentSkip to conversation

x264: switch to PACKAGECONFIG

PATCH In review Dmitry Baryshkov 2 participants 2 messages Oct 12, 2025 – Oct 15, 2025

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x264: switch to PACKAGECONFIG

Switch to PACKAGECONFIG in order to make x264 options configurable. Enable FFmpeg (by default) and OpenCL (if enabled by the distro). Pick up the patch to fix building with the latest FFmpeg.

---
 ...b801191522961102d4bea292cdb61068d0dd.patch | 39 +++++++++++++++++++
 meta/recipes-multimedia/x264/x264_git.bb      | 11 ++++--
 2 files changed, 47 insertions(+), 3 deletions(-)
 create mode 100644 meta/recipes-multimedia/x264/x264/32c3b801191522961102d4bea292cdb61068d0dd.patch
meta/recipes-multimedia/x264/x264/32c3b801191522961102d4bea292cdb61068d0dd.patch new file +39 -0
new file mode 100644
index 000000000000..fb0f313cdb60
@@ -0,0 +1,39 @@
+From 32c3b801191522961102d4bea292cdb61068d0dd Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Martin=20Storsj=C3=B6?= <[email protected]>
+Date: Fri, 4 Apr 2025 16:59:34 +0300
+Subject: [PATCH] lavf: Update the code to work with the latest libavutil API
+
+Upstream-Status: Backport [https://code.videolan.org/videolan/x264/-/commit/32c3b801191522961102d4bea292cdb61068d0dd]
+---
+ input/lavf.c | 6 ++++++
+ 1 file changed, 6 insertions(+)
+
+diff --git a/input/lavf.c b/input/lavf.c
+index 90f4cec5..e2489963 100644
+--- a/input/lavf.c
++++ b/input/lavf.c
+@@ -33,6 +33,7 @@
+ #include <libavutil/error.h>
+ #include <libavutil/mem.h>
+ #include <libavutil/pixdesc.h>
++#include <libavutil/version.h>
+ 
+ #define FAIL_IF_ERROR( cond, ... ) FAIL_IF_ERR( cond, "lavf", __VA_ARGS__ )
+ 
+@@ -141,8 +142,13 @@ static int read_frame_internal( cli_pic_t *p_pic, lavf_hnd_t *h, int i_frame, vi
+     if( info )
+     {
+         info->fullrange  = is_fullrange;
++#if LIBAVUTIL_VERSION_MAJOR < 60
+         info->interlaced = h->frame->interlaced_frame;
+         info->tff        = h->frame->top_field_first;
++#else
++        info->interlaced = !!(h->frame->flags & AV_FRAME_FLAG_INTERLACED);
++        info->tff        = !!(h->frame->flags & AV_FRAME_FLAG_TOP_FIELD_FIRST);
++#endif
+     }
+ 
+     if( h->vfr_input )
+-- 
+GitLab
+
meta/recipes-multimedia/x264/x264_git.bb +8 -3
index 3cc339259381..eb72ba006a04 100644
@@ -9,6 +9,7 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=94d55d512a9ba36caa9b7df079bae19f"
 DEPENDS = "nasm-native"
 
 SRC_URI = "git://code.videolan.org/videolan/x264.git;branch=stable;protocol=https \
+    file://32c3b801191522961102d4bea292cdb61068d0dd.patch \
            "
 UPSTREAM_CHECK_COMMITS = "1"
 
@@ -25,6 +26,13 @@ X264_DISABLE_ASM:armv5 = "--disable-asm"
 X264_DISABLE_ASM:powerpc = "${@bb.utils.contains("TUNE_FEATURES", "spe", "--disable-asm", "", d)}"
 X264_DISABLE_ASM:mipsarch = "${@bb.utils.contains("TUNE_FEATURES", "r6", "", "--disable-asm", d)}"
 
+PACKAGECONFIG ?= " \
+    ffmpeg \
+    ${@bb.utils.filter("DISTRO_FEATURES", "opencl", d)} \
+"
+PACKAGECONFIG[ffmpeg] = "--enable-lavf --enable-swscale,--disable-lavf --disable-swscale,ffmpeg"
+PACKAGECONFIG[opencl] = "--enable-opencl,--disable-opencl,"
+
 EXTRA_OECONF = '--prefix=${prefix} \
                 --host=${HOST_SYS} \
                 --libdir=${libdir} \
@@ -32,9 +40,6 @@ EXTRA_OECONF = '--prefix=${prefix} \
                 --sysroot=${STAGING_DIR_TARGET} \
                 --enable-shared \
                 --enable-static \
-                --disable-lavf \
-                --disable-swscale \
-                --disable-opencl \
                 --enable-pic \
                 ${X264_DISABLE_ASM} \
                 --extra-cflags="${TUNE_CCARGS}" \
Signature · 1 line
2.47.3
#1 lore raw

This causes a dependency loop between x264 and ffmpeg, if PACKAGECONFIG = "x264" is used for ffmpeg.

Now, that x264 depends on ffmpeg by default, should the PACKAGECONFIG[x264] entry from ffmpeg be removed?

How does this change influence h.264 support if I remove PACKAGECONFIG = "x264" from my ffmpeg bbappend?
Will that be always a hw-accelerated implementation now or just disables it?

2025. 10. 12. 17:08 keltezéssel, Dmitry Baryshkov via lists.openembedded.org írta:

Quoted 101 lines

Switch to PACKAGECONFIG in order to make x264 options configurable. Enable FFmpeg (by default) and OpenCL (if enabled by the distro). Pick up the patch to fix building with the latest FFmpeg.

---
  ...b801191522961102d4bea292cdb61068d0dd.patch | 39 +++++++++++++++++++
  meta/recipes-multimedia/x264/x264_git.bb      | 11 ++++--
  2 files changed, 47 insertions(+), 3 deletions(-)

create mode 100644 meta/recipes-multimedia/x264/x264/32c3b801191522961102d4bea292cdb61068d0dd.patch

meta/recipes-multimedia/x264/x264/32c3b801191522961102d4bea292cdb61068d0dd.patch new file +39 -0
new file mode 100644
index 000000000000..fb0f313cdb60
@@ -0,0 +1,39 @@
+From 32c3b801191522961102d4bea292cdb61068d0dd Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Martin=20Storsj=C3=B6?= <[email protected]>
+Date: Fri, 4 Apr 2025 16:59:34 +0300
+Subject: [PATCH] lavf: Update the code to work with the latest libavutil API
+
+Upstream-Status: Backport [https://code.videolan.org/videolan/x264/-/commit/32c3b801191522961102d4bea292cdb61068d0dd]
+---
+ input/lavf.c | 6 ++++++
+ 1 file changed, 6 insertions(+)
+
+diff --git a/input/lavf.c b/input/lavf.c
+index 90f4cec5..e2489963 100644
+--- a/input/lavf.c
++++ b/input/lavf.c
+@@ -33,6 +33,7 @@
+ #include <libavutil/error.h>
+ #include <libavutil/mem.h>
+ #include <libavutil/pixdesc.h>
++#include <libavutil/version.h>
+
+ #define FAIL_IF_ERROR( cond, ... ) FAIL_IF_ERR( cond, "lavf", __VA_ARGS__ )
+
+@@ -141,8 +142,13 @@ static int read_frame_internal( cli_pic_t *p_pic, lavf_hnd_t *h, int i_frame, vi
+     if( info )
+     {
+         info->fullrange  = is_fullrange;
++#if LIBAVUTIL_VERSION_MAJOR < 60
+         info->interlaced = h->frame->interlaced_frame;
+         info->tff        = h->frame->top_field_first;
++#else
++        info->interlaced = !!(h->frame->flags & AV_FRAME_FLAG_INTERLACED);
++        info->tff        = !!(h->frame->flags & AV_FRAME_FLAG_TOP_FIELD_FIRST);
++#endif
+     }
+
+     if( h->vfr_input )
+--
+GitLab
+
meta/recipes-multimedia/x264/x264_git.bb +8 -4
index 3cc339259381..eb72ba006a04 100644
@@ -9,6 +9,7 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=94d55d512a9ba36caa9b7df079bae19f"
  DEPENDS = "nasm-native"
 
  SRC_URI = "git://code.videolan.org/videolan/x264.git;branch=stable;protocol=https \
+    file://32c3b801191522961102d4bea292cdb61068d0dd.patch \
             "
  UPSTREAM_CHECK_COMMITS = "1"
 
@@ -25,6 +26,13 @@ X264_DISABLE_ASM:armv5 = "--disable-asm"
  X264_DISABLE_ASM:powerpc = "${@bb.utils.contains("TUNE_FEATURES", "spe", "--disable-asm", "", d)}"
  X264_DISABLE_ASM:mipsarch = "${@bb.utils.contains("TUNE_FEATURES", "r6", "", "--disable-asm", d)}"
 
+PACKAGECONFIG ?= " \
+    ffmpeg \
+    ${@bb.utils.filter("DISTRO_FEATURES", "opencl", d)} \
+"
+PACKAGECONFIG[ffmpeg] = "--enable-lavf --enable-swscale,--disable-lavf --disable-swscale,ffmpeg"
+PACKAGECONFIG[opencl] = "--enable-opencl,--disable-opencl,"
+
  EXTRA_OECONF = '--prefix=${prefix} \
                  --host=${HOST_SYS} \
                  --libdir=${libdir} \
@@ -32,9 +40,6 @@ EXTRA_OECONF = '--prefix=${prefix} \
                  --sysroot=${STAGING_DIR_TARGET} \
                  --enable-shared \
                  --enable-static \
-                --disable-lavf \
-                --disable-swscale \
-                --disable-opencl \
                  --enable-pic \
                  ${X264_DISABLE_ASM} \
                  --extra-cflags="${TUNE_CCARGS}" \
 
-=-=-=-=-=-=-=-=-=-=-=-

Links: You receive all messages sent to this group.
View/Reply Online (#224738): https://lists.openembedded.org/g/openembedded-core/message/224738
Mute This Topic: https://lists.openembedded.org/mt/115719250/3617728
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-