changeset 9245:b5d1395879a0 libavcodec

Make the pixel formats which were defined as macros: PIX_FMT_ARGB PIX_FMT_RGBA PIX_FMT_ABGR PIX_FMT_BGRA defined as enum PixelFormat values, and viceversa make: PIX_FMT_RGB32 PIX_FMT_RGB32_1 PIX_FMT_BGR32 PIX_FMT_BGR32_1 defined as macros, also resort accordingly the enum PixelFormat list. Also make avcodec_get_pix_fmt() recognize the "rgb32" and "bgr32" aliases, in order to make ffmpeg pass regressions test. This change breaks ABI backward compatibility.
author stefano
date Sun, 22 Mar 2009 22:50:19 +0000
parents cbf65173eed3
children 18b83dac1221
files avcodec.h imgconvert.c
diffstat 2 files changed, 24 insertions(+), 18 deletions(-) [+]
line wrap: on
line diff
--- a/avcodec.h	Sun Mar 22 22:38:06 2009 +0000
+++ b/avcodec.h	Sun Mar 22 22:50:19 2009 +0000
@@ -31,7 +31,7 @@
 
 #define LIBAVCODEC_VERSION_MAJOR 52
 #define LIBAVCODEC_VERSION_MINOR 22
-#define LIBAVCODEC_VERSION_MICRO  2
+#define LIBAVCODEC_VERSION_MICRO  3
 
 #define LIBAVCODEC_VERSION_INT  AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
                                                LIBAVCODEC_VERSION_MINOR, \
--- a/imgconvert.c	Sun Mar 22 22:38:06 2009 +0000
+++ b/imgconvert.c	Sun Mar 22 22:50:19 2009 +0000
@@ -192,8 +192,8 @@
         .depth = 8,
         .x_chroma_shift = 0, .y_chroma_shift = 0,
     },
-    [PIX_FMT_RGB32] = {
-        .name = "rgb32",
+    [PIX_FMT_ARGB] = {
+        .name = "argb",
         .nb_channels = 4, .is_alpha = 1,
         .color_type = FF_COLOR_RGB,
         .pixel_type = FF_PIXEL_PACKED,
@@ -335,8 +335,8 @@
         .depth = 8,
         .x_chroma_shift = 2, .y_chroma_shift = 0,
     },
-    [PIX_FMT_BGR32] = {
-        .name = "bgr32",
+    [PIX_FMT_ABGR] = {
+        .name = "abgr",
         .nb_channels = 4, .is_alpha = 1,
         .color_type = FF_COLOR_RGB,
         .pixel_type = FF_PIXEL_PACKED,
@@ -440,16 +440,16 @@
         .x_chroma_shift = 1, .y_chroma_shift = 1,
     },
 
-    [PIX_FMT_BGR32_1] = {
-        .name = "bgr32_1",
+    [PIX_FMT_BGRA] = {
+        .name = "bgra",
         .nb_channels = 4, .is_alpha = 1,
         .color_type = FF_COLOR_RGB,
         .pixel_type = FF_PIXEL_PACKED,
         .depth = 8,
         .x_chroma_shift = 0, .y_chroma_shift = 0,
     },
-    [PIX_FMT_RGB32_1] = {
-        .name = "rgb32_1",
+    [PIX_FMT_RGBA] = {
+        .name = "rgba",
         .nb_channels = 4, .is_alpha = 1,
         .color_type = FF_COLOR_RGB,
         .pixel_type = FF_PIXEL_PACKED,
@@ -507,8 +507,14 @@
 
 enum PixelFormat avcodec_get_pix_fmt(const char *name)
 {
-    enum PixelFormat pix_fmt = avcodec_get_pix_fmt_internal(name);
+    enum PixelFormat pix_fmt;
 
+    if (!strcmp(name, "rgb32"))
+        name = X_NE("argb", "bgra");
+    else if (!strcmp(name, "bgr32"))
+        name = X_NE("abgr", "rgba");
+
+    pix_fmt = avcodec_get_pix_fmt_internal(name);
     if (pix_fmt == PIX_FMT_NONE) {
         char name2[32];
         snprintf(name2, sizeof(name2), "%s%s", name, X_NE("be", "le"));
@@ -624,10 +630,10 @@
     case PIX_FMT_BGR24:
         picture->linesize[0] = width * 3;
         break;
-    case PIX_FMT_RGB32:
-    case PIX_FMT_BGR32:
-    case PIX_FMT_RGB32_1:
-    case PIX_FMT_BGR32_1:
+    case PIX_FMT_ARGB:
+    case PIX_FMT_ABGR:
+    case PIX_FMT_RGBA:
+    case PIX_FMT_BGRA:
         picture->linesize[0] = width * 4;
         break;
     case PIX_FMT_RGB48BE:
@@ -716,10 +722,10 @@
         return size + 2 * size2;
     case PIX_FMT_RGB24:
     case PIX_FMT_BGR24:
-    case PIX_FMT_RGB32:
-    case PIX_FMT_BGR32:
-    case PIX_FMT_RGB32_1:
-    case PIX_FMT_BGR32_1:
+    case PIX_FMT_ARGB:
+    case PIX_FMT_ABGR:
+    case PIX_FMT_RGBA:
+    case PIX_FMT_BGRA:
     case PIX_FMT_RGB48BE:
     case PIX_FMT_RGB48LE:
     case PIX_FMT_GRAY16BE: