[FFmpeg-devel] [FIXME][PATCH] avcodec/dpx: ABGR support

Paul B Mahol onemda at gmail.com
Sun Oct 6 22:02:25 CEST 2013


Signed-off-by: Paul B Mahol <onemda at gmail.com>
---
 libavcodec/dpx.c    | 3 ++-
 libavcodec/dpxenc.c | 5 ++++-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/libavcodec/dpx.c b/libavcodec/dpx.c
index e4c624c..148835b 100644
--- a/libavcodec/dpx.c
+++ b/libavcodec/dpx.c
@@ -149,6 +149,7 @@ static int decode_frame(AVCodecContext *avctx,
         avctx->sample_aspect_ratio = (AVRational){ 0, 1 };
 
     switch (descriptor) {
+    case 52: // ABGR
     case 51: // RGBA
         elements = 4;
         break;
@@ -163,7 +164,7 @@ static int decode_frame(AVCodecContext *avctx,
     switch (bits_per_color) {
     case 8:
         if (elements == 4) {
-            avctx->pix_fmt = AV_PIX_FMT_RGBA;
+            avctx->pix_fmt = descriptor == 52 ? AV_PIX_FMT_ABGR : AV_PIX_FMT_RGBA;
         } else {
             avctx->pix_fmt = AV_PIX_FMT_RGB24;
         }
diff --git a/libavcodec/dpxenc.c b/libavcodec/dpxenc.c
index 1f1c772..b651d18 100644
--- a/libavcodec/dpxenc.c
+++ b/libavcodec/dpxenc.c
@@ -52,6 +52,9 @@ static av_cold int encode_init(AVCodecContext *avctx)
     case AV_PIX_FMT_RGBA64LE:
     case AV_PIX_FMT_RGBA:
         break;
+    case AV_PIX_FMT_ABGR:
+        s->descriptor = 52;
+        break;
     case AV_PIX_FMT_RGB48LE:
     case AV_PIX_FMT_RGB48BE:
         if (avctx->bits_per_raw_sample)
@@ -242,7 +245,7 @@ AVCodec ff_dpx_encoder = {
     .init           = encode_init,
     .encode2        = encode_frame,
     .pix_fmts       = (const enum AVPixelFormat[]){
-        AV_PIX_FMT_RGB24,    AV_PIX_FMT_RGBA,
+        AV_PIX_FMT_RGB24,    AV_PIX_FMT_RGBA, AV_PIX_FMT_ABGR,
         AV_PIX_FMT_RGB48LE,  AV_PIX_FMT_RGB48BE,
         AV_PIX_FMT_RGBA64LE, AV_PIX_FMT_RGBA64BE,
         AV_PIX_FMT_GBRP10LE, AV_PIX_FMT_GBRP10BE,
-- 
1.7.11.2



More information about the ffmpeg-devel mailing list