[FFmpeg-devel] [PATCH] Seperate x264rgb encoder and only enable when its actually supported
Michael Niedermayer
michael at niedermayer.cc
Sat Feb 27 23:46:14 CET 2016
This avoids enabling and building the x264rgb encoder when its actually not supported and
thus would not work
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
---
configure | 3 ++-
libavcodec/libx264.c | 22 ++++++++++++----------
2 files changed, 14 insertions(+), 11 deletions(-)
diff --git a/configure b/configure
index f4b821a..a5416a0 100755
--- a/configure
+++ b/configure
@@ -2661,7 +2661,7 @@ libwebp_encoder_deps="libwebp"
libwebp_anim_encoder_deps="libwebp"
libx262_encoder_deps="libx262"
libx264_encoder_deps="libx264"
-libx264rgb_encoder_deps="libx264"
+libx264rgb_encoder_deps="libx264 x264_csp_bgr"
libx264rgb_encoder_select="libx264_encoder"
libx265_encoder_deps="libx265"
libxavs_encoder_deps="libxavs"
@@ -5352,6 +5352,7 @@ check_builtin sem_timedwait semaphore.h "sem_t *s; sem_init(s,0,0); sem_timedwai
check_builtin sync_val_compare_and_swap "" "int *ptr; int oldval, newval; __sync_val_compare_and_swap(ptr, oldval, newval)"
check_builtin gmtime_r time.h "time_t *time; struct tm *tm; gmtime_r(time, tm)"
check_builtin localtime_r time.h "time_t *time; struct tm *tm; localtime_r(time, tm)"
+check_builtin x264_csp_bgr "stdint.h x264.h" "X264_CSP_BGR"
case "$custom_allocator" in
jemalloc)
diff --git a/libavcodec/libx264.c b/libavcodec/libx264.c
index 5030d65..8a93fb1 100644
--- a/libavcodec/libx264.c
+++ b/libavcodec/libx264.c
@@ -430,7 +430,7 @@ static int convert_pix_fmt(enum AVPixelFormat pix_fmt)
case AV_PIX_FMT_YUVJ444P:
case AV_PIX_FMT_YUV444P9:
case AV_PIX_FMT_YUV444P10: return X264_CSP_I444;
-#ifdef X264_CSP_BGR
+#if CONFIG_LIBX264RGB_ENCODER
case AV_PIX_FMT_BGR0:
return X264_CSP_BGRA;
case AV_PIX_FMT_BGR24:
@@ -884,14 +884,14 @@ static const enum AVPixelFormat pix_fmts_10bit[] = {
AV_PIX_FMT_NV20,
AV_PIX_FMT_NONE
};
+#if CONFIG_LIBX264RGB_ENCODER
static const enum AVPixelFormat pix_fmts_8bit_rgb[] = {
-#ifdef X264_CSP_BGR
AV_PIX_FMT_BGR0,
AV_PIX_FMT_BGR24,
AV_PIX_FMT_RGB24,
-#endif
AV_PIX_FMT_NONE
};
+#endif
static av_cold void X264_init_static(AVCodec *codec)
{
@@ -1035,13 +1035,6 @@ static const AVClass x264_class = {
.version = LIBAVUTIL_VERSION_INT,
};
-static const AVClass rgbclass = {
- .class_name = "libx264rgb",
- .item_name = av_default_item_name,
- .option = options,
- .version = LIBAVUTIL_VERSION_INT,
-};
-
AVCodec ff_libx264_encoder = {
.name = "libx264",
.long_name = NULL_IF_CONFIG_SMALL("libx264 H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10"),
@@ -1058,6 +1051,15 @@ AVCodec ff_libx264_encoder = {
.caps_internal = FF_CODEC_CAP_INIT_THREADSAFE |
FF_CODEC_CAP_INIT_CLEANUP,
};
+#endif
+
+#if CONFIG_LIBX264RGB_ENCODER
+static const AVClass rgbclass = {
+ .class_name = "libx264rgb",
+ .item_name = av_default_item_name,
+ .option = options,
+ .version = LIBAVUTIL_VERSION_INT,
+};
AVCodec ff_libx264rgb_encoder = {
.name = "libx264rgb",
--
1.7.9.5
More information about the ffmpeg-devel
mailing list