From b2c8b986e773e33df6edb663f0dff0fcefd6f371 Mon Sep 17 00:00:00 2001 From: Thomas Vander Stichele Date: Wed, 29 Dec 2004 16:04:00 +0000 Subject: [PATCH] clean up the mess that made me cry and avoid needless duplication Original commit message from CVS: clean up the mess that made me cry and avoid needless duplication --- ChangeLog | 8 + gst/ffmpegcolorspace/avcodec.h | 33 ++- gst/ffmpegcolorspace/gstffmpegcodecmap.c | 255 +-------------------- gst/ffmpegcolorspace/imgconvert.c | 367 ++++++++++++++++--------------- 4 files changed, 242 insertions(+), 421 deletions(-) diff --git a/ChangeLog b/ChangeLog index d9a6a4e..7d95f01 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,12 @@ 2004-12-29 Thomas Vander Stichele + * gst/ffmpegcolorspace/avcodec.h: + * gst/ffmpegcolorspace/gstffmpegcodecmap.c: + * gst/ffmpegcolorspace/imgconvert.c: + clean up the mess that made me cry and avoid needless duplication + +2004-12-29 Thomas Vander Stichele + * gst/ffmpegcolorspace/imgconvert.c: give some indication of why we're segfaulting @@ -14,6 +21,7 @@ * gst/playback/gstplaybin.c: (gst_play_bin_change_state): Only change state on audiosink if it exists. + 2004-12-28 Maciej Katafiasz * gst/matroska/matroska-demux.c: diff --git a/gst/ffmpegcolorspace/avcodec.h b/gst/ffmpegcolorspace/avcodec.h index 9ce7d22..6cd8964 100644 --- a/gst/ffmpegcolorspace/avcodec.h +++ b/gst/ffmpegcolorspace/avcodec.h @@ -82,11 +82,42 @@ enum PixelFormat { /* currently unused, may be used if 24/32 bits samples ever supported */ enum SampleFormat { - SAMPLE_FMT_S16 = 0, ///< signed 16 bits + SAMPLE_FMT_S16 = 0, ///< signed 16 bits }; #define DEFAULT_FRAME_RATE_BASE 1001000 + +/* thomas: extracted from imgconvert.c since it's also used in + * gstffmpegcodecmap.c */ + +/* start of extract */ + +#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; + +PixFmtInfo * get_pix_fmt_info (enum PixelFormat format); +/* end of extract */ + /** * main external api structure. */ diff --git a/gst/ffmpegcolorspace/gstffmpegcodecmap.c b/gst/ffmpegcolorspace/gstffmpegcodecmap.c index b9c077b..dc6abdd 100644 --- a/gst/ffmpegcolorspace/gstffmpegcodecmap.c +++ b/gst/ffmpegcolorspace/gstffmpegcodecmap.c @@ -22,10 +22,12 @@ #ifdef HAVE_CONFIG_H #include "config.h" #endif -#include -#include + #include +#include + +#include "avcodec.h" #include "gstffmpegcodecmap.h" /* @@ -525,247 +527,6 @@ gst_ffmpegcsp_caps_with_codectype (enum CodecType type, } } -/* - * 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) @@ -773,6 +534,12 @@ static PixFmtInfo pix_fmt_info[PIX_FMT_NB] = { #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) @@ -781,7 +548,7 @@ gst_ffmpegcsp_avpicture_fill (AVPicture * picture, 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: diff --git a/gst/ffmpegcolorspace/imgconvert.c b/gst/ffmpegcolorspace/imgconvert.c index d9dd2f8..8aea77f 100644 --- a/gst/ffmpegcolorspace/imgconvert.c +++ b/gst/ffmpegcolorspace/imgconvert.c @@ -38,260 +38,274 @@ #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; @@ -304,8 +318,9 @@ get_pix_fmt_info (enum PixelFormat format) /* 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; } -- 2.7.4