#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
-#include <gst/gst.h>
-#include <avcodec.h>
+
#include <string.h>
+#include <gst/gst.h>
+
+#include "avcodec.h"
#include "gstffmpegcodecmap.h"
/*
}
}
-/*
- * Fill in pointers to memory in a AVPicture, where
- * everything is aligned by 4 (as required by X).
- * This is mostly a copy from imgconvert.c with some
- * small changes.
- */
-
-#define FF_COLOR_RGB 0 /* RGB color space */
-#define FF_COLOR_GRAY 1 /* gray color space */
-#define FF_COLOR_YUV 2 /* YUV color space. 16 <= Y <= 235, 16 <= U, V <= 240 */
-#define FF_COLOR_YUV_JPEG 3 /* YUV color space. 0 <= Y <= 255, 0 <= U, V <= 255 */
-
-#define FF_PIXEL_PLANAR 0 /* each channel has one component in AVPicture */
-#define FF_PIXEL_PACKED 1 /* only one components containing all the channels */
-#define FF_PIXEL_PALETTE 2 /* one components containing indexes for a palette */
-
-typedef struct PixFmtInfo
-{
- const char *name;
- uint8_t nb_channels; /* number of channels (including alpha) */
- uint8_t color_type; /* color type (see FF_COLOR_xxx constants) */
- uint8_t pixel_type; /* pixel storage type (see FF_PIXEL_xxx constants) */
- uint8_t is_alpha:1; /* true if alpha can be specified */
- uint8_t x_chroma_shift; /* X chroma subsampling factor is 2 ^ shift */
- uint8_t y_chroma_shift; /* Y chroma subsampling factor is 2 ^ shift */
- uint8_t depth; /* bit depth of the color components */
-} PixFmtInfo;
-
-/* this table gives more information about formats */
-static PixFmtInfo pix_fmt_info[PIX_FMT_NB] = {
- /*[PIX_FMT_YUV420P] = */ {
- /*.name = */ "yuv420p",
- /*.nb_channels = */ 3,
- /*.color_type = */ FF_COLOR_YUV,
- /*.pixel_type = */ FF_PIXEL_PLANAR,
- /*.is_alpha = */ 0,
- /*.x_chroma_shift = */ 1,
- /*.y_chroma_shift = */ 1,
- /*.depth = */ 8
- },
- /*[PIX_FMT_YUV422] = */ {
- /*.name = */ "yuv422",
- /*.nb_channels = */ 1,
- /*.color_type = */ FF_COLOR_YUV,
- /*.pixel_type = */ FF_PIXEL_PACKED,
- /*.is_alpha = */ 0,
- /*.x_chroma_shift = */ 1,
- /*.y_chroma_shift = */ 0,
- /*.depth = */ 8
- },
- /*[PIX_FMT_RGB24] = */ {
- /*.name = */ "rgb24",
- /*.nb_channels = */ 3,
- /*.color_type = */ FF_COLOR_RGB,
- /*.pixel_type = */ FF_PIXEL_PACKED,
- /*.is_alpha = */ 0,
- /*.x_chroma_shift = */ 0,
- /*.y_chroma_shift = */ 0,
- /*.depth = */ 8
- },
- /*[PIX_FMT_BGR24] = */ {
- /*.name = */ "bgr24",
- /*.nb_channels = */ 3,
- /*.color_type = */ FF_COLOR_RGB,
- /*.pixel_type = */ FF_PIXEL_PACKED,
- /*.is_alpha = */ 0,
- /*.x_chroma_shift = */ 0,
- /*.y_chroma_shift = */ 0,
- /*.depth = */ 8
- },
- /*[PIX_FMT_YUV422P] = */ {
- /*.name = */ "yuv422p",
- /*.nb_channels = */ 3,
- /*.color_type = */ FF_COLOR_YUV,
- /*.pixel_type = */ FF_PIXEL_PLANAR,
- /*.depth = */ 8,
- /*.x_chroma_shift = */ 1,
- /*.y_chroma_shift = */ 0,
- /*.depth = */ 8
- },
- /*[PIX_FMT_YUV444P] = */ {
- /*.name = */ "yuv444p",
- /*.nb_channels = */ 3,
- /*.color_type = */ FF_COLOR_YUV,
- /*.pixel_type = */ FF_PIXEL_PLANAR,
- /*.is_alpha = */ 0,
- /*.x_chroma_shift = */ 0,
- /*.y_chroma_shift = */ 0,
- /*.depth = */ 8
- },
- /*[PIX_FMT_RGBA32] = */ {
- /*.name = */ "rgba32",
- /*.nb_channels = */ 4,
- /*.color_type = */ FF_COLOR_RGB,
- /*.pixel_type = */ FF_PIXEL_PACKED,
- /*.is_alpha = */ 1,
- /*.x_chroma_shift = */ 0,
- /*.y_chroma_shift = */ 0,
- /*.depth = */ 8
- },
- /*[PIX_FMT_RGB32] = */ {
- /*.name = */ "rgb32",
- /*.nb_channels = */ 4,
- /*.color_type = */ FF_COLOR_RGB,
- /*.pixel_type = */ FF_PIXEL_PACKED,
- /*.is_alpha = */ 0,
- /*.x_chroma_shift = */ 0,
- /*.y_chroma_shift = */ 0,
- /*.depth = */ 8
- },
- /*[PIX_FMT_YUV410P] = */ {
- /*.name = */ "yuv410p",
- /*.nb_channels = */ 3,
- /*.color_type = */ FF_COLOR_YUV,
- /*.pixel_type = */ FF_PIXEL_PLANAR,
- /*.is_alpha = */ 0,
- /*.x_chroma_shift = */ 2,
- /*.y_chroma_shift = */ 2,
- /*.depth = */ 8
- },
- /*[PIX_FMT_YUV411P] = */ {
- /*.name = */ "yuv411p",
- /*.nb_channels = */ 3,
- /*.color_type = */ FF_COLOR_YUV,
- /*.pixel_type = */ FF_PIXEL_PLANAR,
- /*.is_alpha = */ 0,
- /*.x_chroma_shift = */ 2,
- /*.y_chroma_shift = */ 0,
- /*.depth = */ 8
- },
- /*[PIX_FMT_RGB565] = */ {
- /*.name = */ "rgb565",
- /*.nb_channels = */ 3,
- /*.color_type = */ FF_COLOR_RGB,
- /*.pixel_type = */ FF_PIXEL_PACKED,
- /*.is_alpha = */ 0,
- /*.x_chroma_shift = */ 0,
- /*.y_chroma_shift = */ 0,
- /*.depth = */ 5
- },
- /*[PIX_FMT_RGB555] = */ {
- /*.name = */ "rgb555",
- /*.nb_channels = */ 4,
- /*.color_type = */ FF_COLOR_RGB,
- /*.pixel_type = */ FF_PIXEL_PACKED,
- /*.is_alpha = */ 1,
- /*.x_chroma_shift = */ 0,
- /*.y_chroma_shift = */ 0,
- /*.depth = */ 5
- },
- /*[PIX_FMT_GRAY8] = */ {
- /*.name = */ "gray",
- /*.nb_channels = */ 1,
- /*.color_type = */ FF_COLOR_GRAY,
- /*.pixel_type = */ FF_PIXEL_PLANAR,
- /*.is_alpha = */ 0,
- /*.x_chroma_shift = */ 0,
- /*.y_chroma_shift = */ 0,
- /*.depth = */ 8
- },
- /*[PIX_FMT_MONOWHITE] = */ {
- /*.name = */ "monow",
- /*.nb_channels = */ 1,
- /*.color_type = */ FF_COLOR_GRAY,
- /*.pixel_type = */ FF_PIXEL_PLANAR,
- /*.is_alpha = */ 0,
- /*.x_chroma_shift = */ 0,
- /*.y_chroma_shift = */ 0,
- /*.depth = */ 1
- },
- /*[PIX_FMT_MONOBLACK] = */ {
- /*.name = */ "monob",
- /*.nb_channels = */ 1,
- /*.color_type = */ FF_COLOR_GRAY,
- /*.pixel_type = */ FF_PIXEL_PLANAR,
- /*.is_alpha = */ 0,
- /*.x_chroma_shift = */ 0,
- /*.y_chroma_shift = */ 0,
- /*.depth = */ 1
- },
- /*[PIX_FMT_PAL8] = */ {
- /*.name = */ "pal8",
- /*.nb_channels = */ 4,
- /*.color_type = */ FF_COLOR_RGB,
- /*.pixel_type = */ FF_PIXEL_PALETTE,
- /*.is_alpha = */ 1,
- /*.x_chroma_shift = */ 0,
- /*.y_chroma_shift = */ 0,
- /*.depth = */ 8
- },
- /*[PIX_FMT_YUVJ420P] = */ {
- /*.name = */ "yuvj420p",
- /*.nb_channels = */ 3,
- /*.color_type = */ FF_COLOR_YUV_JPEG,
- /*.pixel_type = */ FF_PIXEL_PLANAR,
- /*.is_alpha = */ 0,
- /*.x_chroma_shift = */ 1,
- /*.y_chroma_shift = */ 1,
- /*.depth = */ 8
- },
- /*[PIX_FMT_YUVJ422P] = */ {
- /*.name = */ "yuvj422p",
- /*.nb_channels = */ 3,
- /*.color_type = */ FF_COLOR_YUV_JPEG,
- /*.pixel_type = */ FF_PIXEL_PLANAR,
- /*.is_alpha = */ 0,
- /*.x_chroma_shift = */ 1,
- /*.y_chroma_shift = */ 0,
- /*.depth = */ 8
- },
- /*[PIX_FMT_YUVJ444P] = */ {
- /*.name = */ "yuvj444p",
- /*.nb_channels = */ 3,
- /*.color_type = */ FF_COLOR_YUV_JPEG,
- /*.pixel_type = */ FF_PIXEL_PLANAR,
- /*.is_alpha = */ 0,
- /*.x_chroma_shift = */ 0,
- /*.y_chroma_shift = */ 0,
- /*.depth = */ 8
- },
- /*[PIX_FMT_XVMC_MPEG2_MC] = */ {
- /*.name = */ NULL
- },
- /*[PIX_FMT_UYVY422] = */ {
- /*.name = */ NULL
- },
- /*[PIX_FMT_UYVY411] = */ {
- /*.name = */ NULL
- },
- /*[PIX_FMT_AYUV] = */ {
- /*.name = */ "ayuv4444",
- /*.nb_channels = */ 1,
- /*.color_type = */ FF_COLOR_YUV,
- /*.pixel_type = */ FF_PIXEL_PACKED,
- /*.is_alpha = */ 1,
- /*.x_chroma_shift = */ 0,
- /*.y_chroma_shift = */ 0,
- /*.depth = */ 8
- }
-};
-
#define GEN_MASK(x) ((1<<(x))-1)
#define ROUND_UP_X(v,x) (((v) + GEN_MASK(x)) & ~GEN_MASK(x))
#define ROUND_UP_2(x) ROUND_UP_X (x, 1)
#define ROUND_UP_8(x) ROUND_UP_X (x, 3)
#define DIV_ROUND_UP_X(v,x) (((v) + GEN_MASK(x)) >> (x))
+/*
+ * Fill in pointers to memory in a AVPicture, where
+ * everything is aligned by 4 (as required by X).
+ * This is mostly a copy from imgconvert.c with some
+ * small changes.
+ */
int
gst_ffmpegcsp_avpicture_fill (AVPicture * picture,
uint8_t * ptr, enum PixelFormat pix_fmt, int width, int height)
int stride, stride2;
PixFmtInfo *pinfo;
- pinfo = &pix_fmt_info[pix_fmt];
+ pinfo = get_pix_fmt_info (pix_fmt);
switch (pix_fmt) {
case PIX_FMT_YUV420P:
#define xglue(x, y) x ## y
#define glue(x, y) xglue(x, y)
-#define FF_COLOR_RGB 0 /* RGB color space */
-#define FF_COLOR_GRAY 1 /* gray color space */
-#define FF_COLOR_YUV 2 /* YUV color space. 16 <= Y <= 235, 16 <= U, V <= 240 */
-#define FF_COLOR_YUV_JPEG 3 /* YUV color space. 0 <= Y <= 255, 0 <= U, V <= 255 */
-
-#define FF_PIXEL_PLANAR 0 /* each channel has one component in AVPicture */
-#define FF_PIXEL_PACKED 1 /* only one components containing all the channels */
-#define FF_PIXEL_PALETTE 2 /* one components containing indexes for a palette */
-
-typedef struct PixFmtInfo
-{
- enum PixelFormat format;
- const char *name;
- uint8_t nb_channels; /* number of channels (including alpha) */
- uint8_t color_type; /* color type (see FF_COLOR_xxx constants) */
- uint8_t pixel_type; /* pixel storage type (see FF_PIXEL_xxx constants) */
- uint8_t is_alpha:1; /* true if alpha can be specified */
- uint8_t x_chroma_shift; /* X chroma subsampling factor is 2 ^ shift */
- uint8_t y_chroma_shift; /* Y chroma subsampling factor is 2 ^ shift */
- uint8_t depth; /* bit depth of the color components */
-} PixFmtInfo;
-
/* this table gives more information about formats */
/* FIXME, this table is also in ffmpegcodecmap */
static PixFmtInfo pix_fmt_info[PIX_FMT_NB] = {
/* YUV formats */
- /* [PIX_FMT_YUV420P] = */ {PIX_FMT_YUV420P,
- /* .name = */ "yuv420p",
- /* .nb_channels = */ 3,
- /* .color_type = */ FF_COLOR_YUV,
- /* .pixel_type = */ FF_PIXEL_PLANAR,
- /* .is_alpha = */ 0,
+ /* [PIX_FMT_YUV420P] = */ {
+ /* .format = */ PIX_FMT_YUV420P,
+ /* .name = */ "yuv420p",
+ /* .nb_channels = */ 3,
+ /* .color_type = */ FF_COLOR_YUV,
+ /* .pixel_type = */ FF_PIXEL_PLANAR,
+ /* .is_alpha = */ 0,
/* .x_chroma_shift = */ 1,
/* .y_chroma_shift = */ 1,
- /* .depth = */ 8,
+ /* .depth = */ 8,
},
- /* [PIX_FMT_YUV422P] = */ {PIX_FMT_YUV422P,
- /* .name = */ "yuv422p",
- /* .nb_channels = */ 3,
- /* .color_type = */ FF_COLOR_YUV,
- /* .pixel_type = */ FF_PIXEL_PLANAR,
- /* .is_alpha = */ 0,
+ /* [PIX_FMT_YUV422P] = */ {
+ /* .format = */ PIX_FMT_YUV422P,
+ /* .name = */ "yuv422p",
+ /* .nb_channels = */ 3,
+ /* .color_type = */ FF_COLOR_YUV,
+ /* .pixel_type = */ FF_PIXEL_PLANAR,
+ /* .is_alpha = */ 0,
/* .x_chroma_shift = */ 1,
/* .y_chroma_shift = */ 0,
- /* .depth = */ 8,
+ /* .depth = */ 8,
},
- /* [PIX_FMT_YUV444P] = */ {PIX_FMT_YUV444P,
- /* .name = */ "yuv444p",
- /* .nb_channels = */ 3,
- /* .color_type = */ FF_COLOR_YUV,
- /* .pixel_type = */ FF_PIXEL_PLANAR,
- /* .is_alpha = */ 0,
+ /* [PIX_FMT_YUV444P] = */ {
+ /* .format = */ PIX_FMT_YUV444P,
+ /* .name = */ "yuv444p",
+ /* .nb_channels = */ 3,
+ /* .color_type = */ FF_COLOR_YUV,
+ /* .pixel_type = */ FF_PIXEL_PLANAR,
+ /* .is_alpha = */ 0,
/* .x_chroma_shift = */ 0,
/* .y_chroma_shift = */ 0,
- /* .depth = */ 8,
+ /* .depth = */ 8,
},
- /* [PIX_FMT_YUV422] = */ {PIX_FMT_YUV422,
- /* .name = */ "yuv422",
- /* .nb_channels = */ 1,
- /* .color_type = */ FF_COLOR_YUV,
- /* .pixel_type = */ FF_PIXEL_PACKED,
- /* .is_alpha = */ 0,
+ /* [PIX_FMT_YUV422] = */ {
+ /* .format = */ PIX_FMT_YUV422,
+ /* .name = */ "yuv422",
+ /* .nb_channels = */ 1,
+ /* .color_type = */ FF_COLOR_YUV,
+ /* .pixel_type = */ FF_PIXEL_PACKED,
+ /* .is_alpha = */ 0,
/* .x_chroma_shift = */ 1,
/* .y_chroma_shift = */ 0,
- /* .depth = */ 8,
+ /* .depth = */ 8,
},
- /* [PIX_FMT_UYVY422] = */ {PIX_FMT_UYVY422,
- /* .name = */ "uyvy422",
- /* .nb_channels = */ 1,
- /* .color_type = */ FF_COLOR_YUV,
- /* .pixel_type = */ FF_PIXEL_PACKED,
- /* .is_alpha = */ 0,
+ /* [PIX_FMT_UYVY422] = */ {
+ /* .format = */ PIX_FMT_UYVY422,
+ /* .name = */ "uyvy422",
+ /* .nb_channels = */ 1,
+ /* .color_type = */ FF_COLOR_YUV,
+ /* .pixel_type = */ FF_PIXEL_PACKED,
+ /* .is_alpha = */ 0,
/* .x_chroma_shift = */ 1,
/* .y_chroma_shift = */ 0,
- /* .depth = */ 8,
+ /* .depth = */ 8,
},
- /* [PIX_FMT_YUV410P] = */ {PIX_FMT_YUV410P,
- /* .name = */ "yuv410p",
- /* .nb_channels = */ 3,
- /* .color_type = */ FF_COLOR_YUV,
- /* .pixel_type = */ FF_PIXEL_PLANAR,
- /* .is_alpha = */ 0,
+ /* [PIX_FMT_YUV410P] = */ {
+ /* .format = */ PIX_FMT_YUV410P,
+ /* .name = */ "yuv410p",
+ /* .nb_channels = */ 3,
+ /* .color_type = */ FF_COLOR_YUV,
+ /* .pixel_type = */ FF_PIXEL_PLANAR,
+ /* .is_alpha = */ 0,
/* .x_chroma_shift = */ 2,
/* .y_chroma_shift = */ 2,
- /* .depth = */ 8,
+ /* .depth = */ 8,
},
- /* [PIX_FMT_YUV411P] = */ {PIX_FMT_YUV411P,
- /* .name = */ "yuv411p",
- /* .nb_channels = */ 3,
- /* .color_type = */ FF_COLOR_YUV,
- /* .pixel_type = */ FF_PIXEL_PLANAR,
- /* .is_alpha = */ 0,
+ /* [PIX_FMT_YUV411P] = */ {
+ /* .format = */ PIX_FMT_YUV411P,
+ /* .name = */ "yuv411p",
+ /* .nb_channels = */ 3,
+ /* .color_type = */ FF_COLOR_YUV,
+ /* .pixel_type = */ FF_PIXEL_PLANAR,
+ /* .is_alpha = */ 0,
/* .x_chroma_shift = */ 2,
/* .y_chroma_shift = */ 0,
- /* .depth = */ 8,
+ /* .depth = */ 8,
},
/* JPEG YUV */
- /* [PIX_FMT_YUVJ420P] = */ {PIX_FMT_YUVJ420P,
- /* .name = */ "yuvj420p",
- /* .nb_channels = */ 3,
- /* .color_type = */ FF_COLOR_YUV_JPEG,
- /* .pixel_type = */ FF_PIXEL_PLANAR,
- /* .is_alpha = */ 0,
+ /* [PIX_FMT_YUVJ420P] = */ {
+ /* .format = */ PIX_FMT_YUVJ420P,
+ /* .name = */ "yuvj420p",
+ /* .nb_channels = */ 3,
+ /* .color_type = */ FF_COLOR_YUV_JPEG,
+ /* .pixel_type = */ FF_PIXEL_PLANAR,
+ /* .is_alpha = */ 0,
/* .x_chroma_shift = */ 1,
/* .y_chroma_shift = */ 1,
- /* .depth = */ 8,
+ /* .depth = */ 8,
},
- /* [PIX_FMT_YUVJ422P] = */ {PIX_FMT_YUVJ422P,
- /* .name = */ "yuvj422p",
- /* .nb_channels = */ 3,
- /* .color_type = */ FF_COLOR_YUV_JPEG,
- /* .pixel_type = */ FF_PIXEL_PLANAR,
- /* .is_alpha = */ 0,
+ /* [PIX_FMT_YUVJ422P] = */ {
+ /* .format = */ PIX_FMT_YUVJ422P,
+ /* .name = */ "yuvj422p",
+ /* .nb_channels = */ 3,
+ /* .color_type = */ FF_COLOR_YUV_JPEG,
+ /* .pixel_type = */ FF_PIXEL_PLANAR,
+ /* .is_alpha = */ 0,
/* .x_chroma_shift = */ 1,
/* .y_chroma_shift = */ 0,
- /* .depth = */ 8,
+ /* .depth = */ 8,
},
- /* [PIX_FMT_YUVJ444P] = */ {PIX_FMT_YUVJ444P,
- /* .name = */ "yuvj444p",
- /* .nb_channels = */ 3,
- /* .color_type = */ FF_COLOR_YUV_JPEG,
- /* .pixel_type = */ FF_PIXEL_PLANAR,
- /* .is_alpha = */ 0,
+ /* [PIX_FMT_YUVJ444P] = */ {
+ /* .format = */ PIX_FMT_YUVJ444P,
+ /* .name = */ "yuvj444p",
+ /* .nb_channels = */ 3,
+ /* .color_type = */ FF_COLOR_YUV_JPEG,
+ /* .pixel_type = */ FF_PIXEL_PLANAR,
+ /* .is_alpha = */ 0,
/* .x_chroma_shift = */ 0,
/* .y_chroma_shift = */ 0,
- /* .depth = */ 8,
+ /* .depth = */ 8,
},
/* RGB formats */
- /* [PIX_FMT_RGB24] = */ {PIX_FMT_RGB24,
- /* .name = */ "rgb24",
- /* .nb_channels = */ 3,
- /* .color_type = */ FF_COLOR_RGB,
- /* .pixel_type = */ FF_PIXEL_PACKED,
- /* .is_alpha = */ 0,
+ /* [PIX_FMT_RGB24] = */ {
+ /* .format = */ PIX_FMT_RGB24,
+ /* .name = */ "rgb24",
+ /* .nb_channels = */ 3,
+ /* .color_type = */ FF_COLOR_RGB,
+ /* .pixel_type = */ FF_PIXEL_PACKED,
+ /* .is_alpha = */ 0,
/* .x_chroma_shift = */ 0,
/* .y_chroma_shift = */ 0,
- /* .depth = */ 8,
+ /* .depth = */ 8,
},
- /* [PIX_FMT_BGR24] = */ {PIX_FMT_BGR24,
- /* .name = */ "bgr24",
- /* .nb_channels = */ 3,
- /* .color_type = */ FF_COLOR_RGB,
- /* .pixel_type = */ FF_PIXEL_PACKED,
- /* .is_alpha = */ 0,
+ /* [PIX_FMT_BGR24] = */ {
+ /* .format = */ PIX_FMT_BGR24,
+ /* .name = */ "bgr24",
+ /* .nb_channels = */ 3,
+ /* .color_type = */ FF_COLOR_RGB,
+ /* .pixel_type = */ FF_PIXEL_PACKED,
+ /* .is_alpha = */ 0,
/* .x_chroma_shift = */ 0,
/* .y_chroma_shift = */ 0,
- /* .depth = */ 8,
+ /* .depth = */ 8,
},
- /* [PIX_FMT_RGB32] = */ {PIX_FMT_RGB32,
- /* .name = */ "rgb32",
- /* .nb_channels = */ 4,
- /* .color_type = */ FF_COLOR_RGB,
- /* .pixel_type = */ FF_PIXEL_PACKED,
- /* .is_alpha = */ 0,
+ /* [PIX_FMT_RGB32] = */ {
+ /* .format = */ PIX_FMT_RGB32,
+ /* .name = */ "rgb32",
+ /* .nb_channels = */ 4,
+ /* .color_type = */ FF_COLOR_RGB,
+ /* .pixel_type = */ FF_PIXEL_PACKED,
+ /* .is_alpha = */ 0,
/* .x_chroma_shift = */ 0,
/* .y_chroma_shift = */ 0,
- /* .depth = */ 8,
+ /* .depth = */ 8,
},
- /* [PIX_FMT_RGBA32] = */ {PIX_FMT_RGBA32,
- /* .name = */ "rgba32",
- /* .nb_channels = */ 4,
- /* .color_type = */ FF_COLOR_RGB,
- /* .pixel_type = */ FF_PIXEL_PACKED,
- /* .is_alpha = */ 1,
+ /* [PIX_FMT_RGBA32] = */ {
+ /* .format = */ PIX_FMT_RGBA32,
+ /* .name = */ "rgba32",
+ /* .nb_channels = */ 4,
+ /* .color_type = */ FF_COLOR_RGB,
+ /* .pixel_type = */ FF_PIXEL_PACKED,
+ /* .is_alpha = */ 1,
/* .x_chroma_shift = */ 0,
/* .y_chroma_shift = */ 0,
- /* .depth = */ 8,
+ /* .depth = */ 8,
},
- /* [PIX_FMT_RGB565] = */ {PIX_FMT_RGB565,
- /* .name = */ "rgb565",
- /* .nb_channels = */ 3,
- /* .color_type = */ FF_COLOR_RGB,
- /* .pixel_type = */ FF_PIXEL_PACKED,
- /* .is_alpha = */ 0,
+ /* [PIX_FMT_RGB565] = */ {
+ /* .format = */ PIX_FMT_RGB565,
+ /* .name = */ "rgb565",
+ /* .nb_channels = */ 3,
+ /* .color_type = */ FF_COLOR_RGB,
+ /* .pixel_type = */ FF_PIXEL_PACKED,
+ /* .is_alpha = */ 0,
/* .x_chroma_shift = */ 0,
/* .y_chroma_shift = */ 0,
- /* .depth = */ 5,
+ /* .depth = */ 5,
},
- /* [PIX_FMT_RGB555] = */ {PIX_FMT_RGB555,
- /* .name = */ "rgb555",
- /* .nb_channels = */ 4,
- /* .color_type = */ FF_COLOR_RGB,
- /* .pixel_type = */ FF_PIXEL_PACKED,
- /* .is_alpha = */ 1,
+ /* [PIX_FMT_RGB555] = */ {
+ /* .format = */ PIX_FMT_RGB555,
+ /* .name = */ "rgb555",
+ /* .nb_channels = */ 4,
+ /* .color_type = */ FF_COLOR_RGB,
+ /* .pixel_type = */ FF_PIXEL_PACKED,
+ /* .is_alpha = */ 1,
/* .x_chroma_shift = */ 0,
/* .y_chroma_shift = */ 0,
- /* .depth = */ 5,
+ /* .depth = */ 5,
},
/* gray / mono formats */
- /* [PIX_FMT_GRAY8] = */ {PIX_FMT_GRAY8,
- /* .name = */ "gray",
- /* .nb_channels = */ 1,
- /* .color_type = */ FF_COLOR_GRAY,
- /* .pixel_type = */ FF_PIXEL_PLANAR,
- /* .is_alpha = */ 0,
+ /* [PIX_FMT_GRAY8] = */ {
+ /* .format = */ PIX_FMT_GRAY8,
+ /* .name = */ "gray",
+ /* .nb_channels = */ 1,
+ /* .color_type = */ FF_COLOR_GRAY,
+ /* .pixel_type = */ FF_PIXEL_PLANAR,
+ /* .is_alpha = */ 0,
/* .x_chroma_shift = */ 0,
/* .y_chroma_shift = */ 0,
- /* .depth = */ 8,
+ /* .depth = */ 8,
},
- /* [PIX_FMT_MONOWHITE] = */ {PIX_FMT_MONOWHITE,
- /* .name = */ "monow",
- /* .nb_channels = */ 1,
- /* .color_type = */ FF_COLOR_GRAY,
- /* .pixel_type = */ FF_PIXEL_PLANAR,
- /* .is_alpha = */ 0,
+ /* [PIX_FMT_MONOWHITE] = */ {
+ /* .format = */ PIX_FMT_MONOWHITE,
+ /* .name = */ "monow",
+ /* .nb_channels = */ 1,
+ /* .color_type = */ FF_COLOR_GRAY,
+ /* .pixel_type = */ FF_PIXEL_PLANAR,
+ /* .is_alpha = */ 0,
/* .x_chroma_shift = */ 0,
/* .y_chroma_shift = */ 0,
- /* .depth = */ 1,
+ /* .depth = */ 1,
},
- /* [PIX_FMT_MONOBLACK] = */ {PIX_FMT_MONOBLACK,
- /* .name = */ "monob",
- /* .nb_channels = */ 1,
- /* .color_type = */ FF_COLOR_GRAY,
- /* .pixel_type = */ FF_PIXEL_PLANAR,
- /* .is_alpha = */ 0,
+ /* [PIX_FMT_MONOBLACK] = */ {
+ /* .format = */ PIX_FMT_MONOBLACK,
+ /* .name = */ "monob",
+ /* .nb_channels = */ 1,
+ /* .color_type = */ FF_COLOR_GRAY,
+ /* .pixel_type = */ FF_PIXEL_PLANAR,
+ /* .is_alpha = */ 0,
/* .x_chroma_shift = */ 0,
/* .y_chroma_shift = */ 0,
- /* .depth = */ 1,
+ /* .depth = */ 1,
},
/* paletted formats */
- /* [PIX_FMT_PAL8] = */ {PIX_FMT_PAL8,
- /* .name = */ "pal8",
- /* .nb_channels = */ 4,
- /* .color_type = */ FF_COLOR_RGB,
- /* .pixel_type = */ FF_PIXEL_PALETTE,
- /* .is_alpha = */ 1,
+ /* [PIX_FMT_PAL8] = */ {
+ /* .format = */ PIX_FMT_PAL8,
+ /* .name = */ "pal8",
+ /* .nb_channels = */ 4,
+ /* .color_type = */ FF_COLOR_RGB,
+ /* .pixel_type = */ FF_PIXEL_PALETTE,
+ /* .is_alpha = */ 1,
/* .x_chroma_shift = */ 0,
/* .y_chroma_shift = */ 0,
- /* .depth = */ 8,
+ /* .depth = */ 8,
},
- /* [PIX_FMT_XVMC_MPEG2_MC] = */ {PIX_FMT_XVMC_MPEG2_MC,
- /* .name = */ "xvmcmc",
+ /* [PIX_FMT_XVMC_MPEG2_MC] = */ {
+ /* .format = */ PIX_FMT_XVMC_MPEG2_MC,
+ /* .name = */ "xvmcmc",
},
- /* [PIX_FMT_XVMC_MPEG2_IDCT] = */ {PIX_FMT_XVMC_MPEG2_IDCT,
- /* .name = */ "xvmcidct",
+ /* [PIX_FMT_XVMC_MPEG2_IDCT] = */ {
+ /* .format = */ PIX_FMT_XVMC_MPEG2_IDCT,
+ /* .name = */ "xvmcidct",
},
- /* [PIX_FMT_UYVY411] = */ {PIX_FMT_UYVY411,
- /* .name = */ "uyvy411",
- /* .nb_channels = */ 1,
- /* .color_type = */ FF_COLOR_YUV,
- /* .pixel_type = */ FF_PIXEL_PACKED,
- /* .is_alpha = */ 0,
+ /* [PIX_FMT_UYVY411] = */ {
+ /* .format = */ PIX_FMT_UYVY411,
+ /* .name = */ "uyvy411",
+ /* .nb_channels = */ 1,
+ /* .color_type = */ FF_COLOR_YUV,
+ /* .pixel_type = */ FF_PIXEL_PACKED,
+ /* .is_alpha = */ 0,
/* .x_chroma_shift = */ 2,
/* .y_chroma_shift = */ 0,
- /* .depth = */ 8,
+ /* .depth = */ 8,
},
+ /* [PIX_FMT_AYUV4444] = */ {
+ /* .format = */ PIX_FMT_AYUV4444,
+ /* .name = */ "ayuv4444",
+ /* .nb_channels = */ 1,
+ /* .color_type = */ FF_COLOR_YUV,
+ /* .pixel_type = */ FF_PIXEL_PACKED,
+ /* .is_alpha = */ 1,
+ /* .x_chroma_shift = */ 0,
+ /* .y_chroma_shift = */ 0,
+ /*.depth = */ 8
+ }
+
};
/* returns NULL if not found */
-static PixFmtInfo *
+/* undid static since this is also used in gstffmpegcodecmap.c */
+PixFmtInfo *
get_pix_fmt_info (enum PixelFormat format)
{
int i;
/* since this doesn't get checked *anywhere*, we might as well warn
here if we return NULL so you have *some* idea what's going on */
- g_warning ("Could not find info for pixel format %d, one segfault coming up",
- format);
+ g_warning
+ ("Could not find info for pixel format %d out of %d known pixel formats. One segfault coming up",
+ format, PIX_FMT_NB);
return NULL;
}