[FFmpeg-devel] [PATCH] avcodec/libx264: support BGRA pixel format
Thomas Volkert
silvo at gmx.net
Sat Feb 2 17:05:21 EET 2019
From: Thomas Volkert <thomas.volkert at net-zeal.com>
---
libavcodec/libx264.c | 15 ++++++++-------
1 file changed, 8 insertions(+), 7 deletions(-)
diff --git a/libavcodec/libx264.c b/libavcodec/libx264.c
index a3493f393d..dd51fdc6dc 100644
--- a/libavcodec/libx264.c
+++ b/libavcodec/libx264.c
@@ -158,6 +158,9 @@ static int encode_nals(AVCodecContext *ctx, AVPacket *pkt,
static int avfmt2_num_planes(int avfmt)
{
switch (avfmt) {
+ case AV_PIX_FMT_BGRA:
+ return 4;
+
case AV_PIX_FMT_YUV420P:
case AV_PIX_FMT_YUVJ420P:
case AV_PIX_FMT_YUV420P9:
@@ -511,13 +514,10 @@ static int convert_pix_fmt(enum AVPixelFormat pix_fmt)
case AV_PIX_FMT_YUV444P9:
case AV_PIX_FMT_YUV444P10: return X264_CSP_I444;
#if CONFIG_LIBX264RGB_ENCODER
- case AV_PIX_FMT_BGR0:
- return X264_CSP_BGRA;
- case AV_PIX_FMT_BGR24:
- return X264_CSP_BGR;
-
- case AV_PIX_FMT_RGB24:
- return X264_CSP_RGB;
+ case AV_PIX_FMT_BGRA: return X264_CSP_BGRA;
+ case AV_PIX_FMT_BGR0: return X264_CSP_BGRA;
+ case AV_PIX_FMT_BGR24: return X264_CSP_BGR;
+ case AV_PIX_FMT_RGB24: return X264_CSP_RGB;
#endif
case AV_PIX_FMT_NV12: return X264_CSP_NV12;
case AV_PIX_FMT_NV16:
@@ -987,6 +987,7 @@ static const enum AVPixelFormat pix_fmts_all[] = {
};
#if CONFIG_LIBX264RGB_ENCODER
static const enum AVPixelFormat pix_fmts_8bit_rgb[] = {
+ AV_PIX_FMT_BGRA,
AV_PIX_FMT_BGR0,
AV_PIX_FMT_BGR24,
AV_PIX_FMT_RGB24,
--
2.17.1
More information about the ffmpeg-devel
mailing list