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
This commit is contained in:
Thomas Vander Stichele 2004-12-29 16:04:00 +00:00
parent 7dc6d49cbb
commit b2c8b986e7
4 changed files with 242 additions and 421 deletions

View file

@ -1,3 +1,10 @@
2004-12-29 Thomas Vander Stichele <thomas at apestaart dot org>
* 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 <thomas at apestaart dot org> 2004-12-29 Thomas Vander Stichele <thomas at apestaart dot org>
* gst/ffmpegcolorspace/imgconvert.c: * gst/ffmpegcolorspace/imgconvert.c:
@ -14,6 +21,7 @@
* gst/playback/gstplaybin.c: (gst_play_bin_change_state): * gst/playback/gstplaybin.c: (gst_play_bin_change_state):
Only change state on audiosink if it exists. Only change state on audiosink if it exists.
2004-12-28 Maciej Katafiasz <mathrick@mathrick.org> 2004-12-28 Maciej Katafiasz <mathrick@mathrick.org>
* gst/matroska/matroska-demux.c: * gst/matroska/matroska-demux.c:

View file

@ -82,11 +82,42 @@ enum PixelFormat {
/* currently unused, may be used if 24/32 bits samples ever supported */ /* currently unused, may be used if 24/32 bits samples ever supported */
enum SampleFormat { enum SampleFormat {
SAMPLE_FMT_S16 = 0, ///< signed 16 bits SAMPLE_FMT_S16 = 0, ///< signed 16 bits
}; };
#define DEFAULT_FRAME_RATE_BASE 1001000 #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. * main external api structure.
*/ */

View file

@ -22,10 +22,12 @@
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
#include "config.h" #include "config.h"
#endif #endif
#include <gst/gst.h>
#include <avcodec.h>
#include <string.h> #include <string.h>
#include <gst/gst.h>
#include "avcodec.h"
#include "gstffmpegcodecmap.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 GEN_MASK(x) ((1<<(x))-1)
#define ROUND_UP_X(v,x) (((v) + GEN_MASK(x)) & ~GEN_MASK(x)) #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_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 ROUND_UP_8(x) ROUND_UP_X (x, 3)
#define DIV_ROUND_UP_X(v,x) (((v) + GEN_MASK(x)) >> (x)) #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 int
gst_ffmpegcsp_avpicture_fill (AVPicture * picture, gst_ffmpegcsp_avpicture_fill (AVPicture * picture,
uint8_t * ptr, enum PixelFormat pix_fmt, int width, int height) uint8_t * ptr, enum PixelFormat pix_fmt, int width, int height)
@ -781,7 +548,7 @@ gst_ffmpegcsp_avpicture_fill (AVPicture * picture,
int stride, stride2; int stride, stride2;
PixFmtInfo *pinfo; PixFmtInfo *pinfo;
pinfo = &pix_fmt_info[pix_fmt]; pinfo = get_pix_fmt_info (pix_fmt);
switch (pix_fmt) { switch (pix_fmt) {
case PIX_FMT_YUV420P: case PIX_FMT_YUV420P:

View file

@ -38,260 +38,274 @@
#define xglue(x, y) x ## y #define xglue(x, y) x ## y
#define glue(x, y) xglue(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 */ /* this table gives more information about formats */
/* FIXME, this table is also in ffmpegcodecmap */ /* FIXME, this table is also in ffmpegcodecmap */
static PixFmtInfo pix_fmt_info[PIX_FMT_NB] = { static PixFmtInfo pix_fmt_info[PIX_FMT_NB] = {
/* YUV formats */ /* YUV formats */
/* [PIX_FMT_YUV420P] = */ {PIX_FMT_YUV420P, /* [PIX_FMT_YUV420P] = */ {
/* .name = */ "yuv420p", /* .format = */ PIX_FMT_YUV420P,
/* .nb_channels = */ 3, /* .name = */ "yuv420p",
/* .color_type = */ FF_COLOR_YUV, /* .nb_channels = */ 3,
/* .pixel_type = */ FF_PIXEL_PLANAR, /* .color_type = */ FF_COLOR_YUV,
/* .is_alpha = */ 0, /* .pixel_type = */ FF_PIXEL_PLANAR,
/* .is_alpha = */ 0,
/* .x_chroma_shift = */ 1, /* .x_chroma_shift = */ 1,
/* .y_chroma_shift = */ 1, /* .y_chroma_shift = */ 1,
/* .depth = */ 8, /* .depth = */ 8,
}, },
/* [PIX_FMT_YUV422P] = */ {PIX_FMT_YUV422P, /* [PIX_FMT_YUV422P] = */ {
/* .name = */ "yuv422p", /* .format = */ PIX_FMT_YUV422P,
/* .nb_channels = */ 3, /* .name = */ "yuv422p",
/* .color_type = */ FF_COLOR_YUV, /* .nb_channels = */ 3,
/* .pixel_type = */ FF_PIXEL_PLANAR, /* .color_type = */ FF_COLOR_YUV,
/* .is_alpha = */ 0, /* .pixel_type = */ FF_PIXEL_PLANAR,
/* .is_alpha = */ 0,
/* .x_chroma_shift = */ 1, /* .x_chroma_shift = */ 1,
/* .y_chroma_shift = */ 0, /* .y_chroma_shift = */ 0,
/* .depth = */ 8, /* .depth = */ 8,
}, },
/* [PIX_FMT_YUV444P] = */ {PIX_FMT_YUV444P, /* [PIX_FMT_YUV444P] = */ {
/* .name = */ "yuv444p", /* .format = */ PIX_FMT_YUV444P,
/* .nb_channels = */ 3, /* .name = */ "yuv444p",
/* .color_type = */ FF_COLOR_YUV, /* .nb_channels = */ 3,
/* .pixel_type = */ FF_PIXEL_PLANAR, /* .color_type = */ FF_COLOR_YUV,
/* .is_alpha = */ 0, /* .pixel_type = */ FF_PIXEL_PLANAR,
/* .is_alpha = */ 0,
/* .x_chroma_shift = */ 0, /* .x_chroma_shift = */ 0,
/* .y_chroma_shift = */ 0, /* .y_chroma_shift = */ 0,
/* .depth = */ 8, /* .depth = */ 8,
}, },
/* [PIX_FMT_YUV422] = */ {PIX_FMT_YUV422, /* [PIX_FMT_YUV422] = */ {
/* .name = */ "yuv422", /* .format = */ PIX_FMT_YUV422,
/* .nb_channels = */ 1, /* .name = */ "yuv422",
/* .color_type = */ FF_COLOR_YUV, /* .nb_channels = */ 1,
/* .pixel_type = */ FF_PIXEL_PACKED, /* .color_type = */ FF_COLOR_YUV,
/* .is_alpha = */ 0, /* .pixel_type = */ FF_PIXEL_PACKED,
/* .is_alpha = */ 0,
/* .x_chroma_shift = */ 1, /* .x_chroma_shift = */ 1,
/* .y_chroma_shift = */ 0, /* .y_chroma_shift = */ 0,
/* .depth = */ 8, /* .depth = */ 8,
}, },
/* [PIX_FMT_UYVY422] = */ {PIX_FMT_UYVY422, /* [PIX_FMT_UYVY422] = */ {
/* .name = */ "uyvy422", /* .format = */ PIX_FMT_UYVY422,
/* .nb_channels = */ 1, /* .name = */ "uyvy422",
/* .color_type = */ FF_COLOR_YUV, /* .nb_channels = */ 1,
/* .pixel_type = */ FF_PIXEL_PACKED, /* .color_type = */ FF_COLOR_YUV,
/* .is_alpha = */ 0, /* .pixel_type = */ FF_PIXEL_PACKED,
/* .is_alpha = */ 0,
/* .x_chroma_shift = */ 1, /* .x_chroma_shift = */ 1,
/* .y_chroma_shift = */ 0, /* .y_chroma_shift = */ 0,
/* .depth = */ 8, /* .depth = */ 8,
}, },
/* [PIX_FMT_YUV410P] = */ {PIX_FMT_YUV410P, /* [PIX_FMT_YUV410P] = */ {
/* .name = */ "yuv410p", /* .format = */ PIX_FMT_YUV410P,
/* .nb_channels = */ 3, /* .name = */ "yuv410p",
/* .color_type = */ FF_COLOR_YUV, /* .nb_channels = */ 3,
/* .pixel_type = */ FF_PIXEL_PLANAR, /* .color_type = */ FF_COLOR_YUV,
/* .is_alpha = */ 0, /* .pixel_type = */ FF_PIXEL_PLANAR,
/* .is_alpha = */ 0,
/* .x_chroma_shift = */ 2, /* .x_chroma_shift = */ 2,
/* .y_chroma_shift = */ 2, /* .y_chroma_shift = */ 2,
/* .depth = */ 8, /* .depth = */ 8,
}, },
/* [PIX_FMT_YUV411P] = */ {PIX_FMT_YUV411P, /* [PIX_FMT_YUV411P] = */ {
/* .name = */ "yuv411p", /* .format = */ PIX_FMT_YUV411P,
/* .nb_channels = */ 3, /* .name = */ "yuv411p",
/* .color_type = */ FF_COLOR_YUV, /* .nb_channels = */ 3,
/* .pixel_type = */ FF_PIXEL_PLANAR, /* .color_type = */ FF_COLOR_YUV,
/* .is_alpha = */ 0, /* .pixel_type = */ FF_PIXEL_PLANAR,
/* .is_alpha = */ 0,
/* .x_chroma_shift = */ 2, /* .x_chroma_shift = */ 2,
/* .y_chroma_shift = */ 0, /* .y_chroma_shift = */ 0,
/* .depth = */ 8, /* .depth = */ 8,
}, },
/* JPEG YUV */ /* JPEG YUV */
/* [PIX_FMT_YUVJ420P] = */ {PIX_FMT_YUVJ420P, /* [PIX_FMT_YUVJ420P] = */ {
/* .name = */ "yuvj420p", /* .format = */ PIX_FMT_YUVJ420P,
/* .nb_channels = */ 3, /* .name = */ "yuvj420p",
/* .color_type = */ FF_COLOR_YUV_JPEG, /* .nb_channels = */ 3,
/* .pixel_type = */ FF_PIXEL_PLANAR, /* .color_type = */ FF_COLOR_YUV_JPEG,
/* .is_alpha = */ 0, /* .pixel_type = */ FF_PIXEL_PLANAR,
/* .is_alpha = */ 0,
/* .x_chroma_shift = */ 1, /* .x_chroma_shift = */ 1,
/* .y_chroma_shift = */ 1, /* .y_chroma_shift = */ 1,
/* .depth = */ 8, /* .depth = */ 8,
}, },
/* [PIX_FMT_YUVJ422P] = */ {PIX_FMT_YUVJ422P, /* [PIX_FMT_YUVJ422P] = */ {
/* .name = */ "yuvj422p", /* .format = */ PIX_FMT_YUVJ422P,
/* .nb_channels = */ 3, /* .name = */ "yuvj422p",
/* .color_type = */ FF_COLOR_YUV_JPEG, /* .nb_channels = */ 3,
/* .pixel_type = */ FF_PIXEL_PLANAR, /* .color_type = */ FF_COLOR_YUV_JPEG,
/* .is_alpha = */ 0, /* .pixel_type = */ FF_PIXEL_PLANAR,
/* .is_alpha = */ 0,
/* .x_chroma_shift = */ 1, /* .x_chroma_shift = */ 1,
/* .y_chroma_shift = */ 0, /* .y_chroma_shift = */ 0,
/* .depth = */ 8, /* .depth = */ 8,
}, },
/* [PIX_FMT_YUVJ444P] = */ {PIX_FMT_YUVJ444P, /* [PIX_FMT_YUVJ444P] = */ {
/* .name = */ "yuvj444p", /* .format = */ PIX_FMT_YUVJ444P,
/* .nb_channels = */ 3, /* .name = */ "yuvj444p",
/* .color_type = */ FF_COLOR_YUV_JPEG, /* .nb_channels = */ 3,
/* .pixel_type = */ FF_PIXEL_PLANAR, /* .color_type = */ FF_COLOR_YUV_JPEG,
/* .is_alpha = */ 0, /* .pixel_type = */ FF_PIXEL_PLANAR,
/* .is_alpha = */ 0,
/* .x_chroma_shift = */ 0, /* .x_chroma_shift = */ 0,
/* .y_chroma_shift = */ 0, /* .y_chroma_shift = */ 0,
/* .depth = */ 8, /* .depth = */ 8,
}, },
/* RGB formats */ /* RGB formats */
/* [PIX_FMT_RGB24] = */ {PIX_FMT_RGB24, /* [PIX_FMT_RGB24] = */ {
/* .name = */ "rgb24", /* .format = */ PIX_FMT_RGB24,
/* .nb_channels = */ 3, /* .name = */ "rgb24",
/* .color_type = */ FF_COLOR_RGB, /* .nb_channels = */ 3,
/* .pixel_type = */ FF_PIXEL_PACKED, /* .color_type = */ FF_COLOR_RGB,
/* .is_alpha = */ 0, /* .pixel_type = */ FF_PIXEL_PACKED,
/* .is_alpha = */ 0,
/* .x_chroma_shift = */ 0, /* .x_chroma_shift = */ 0,
/* .y_chroma_shift = */ 0, /* .y_chroma_shift = */ 0,
/* .depth = */ 8, /* .depth = */ 8,
}, },
/* [PIX_FMT_BGR24] = */ {PIX_FMT_BGR24, /* [PIX_FMT_BGR24] = */ {
/* .name = */ "bgr24", /* .format = */ PIX_FMT_BGR24,
/* .nb_channels = */ 3, /* .name = */ "bgr24",
/* .color_type = */ FF_COLOR_RGB, /* .nb_channels = */ 3,
/* .pixel_type = */ FF_PIXEL_PACKED, /* .color_type = */ FF_COLOR_RGB,
/* .is_alpha = */ 0, /* .pixel_type = */ FF_PIXEL_PACKED,
/* .is_alpha = */ 0,
/* .x_chroma_shift = */ 0, /* .x_chroma_shift = */ 0,
/* .y_chroma_shift = */ 0, /* .y_chroma_shift = */ 0,
/* .depth = */ 8, /* .depth = */ 8,
}, },
/* [PIX_FMT_RGB32] = */ {PIX_FMT_RGB32, /* [PIX_FMT_RGB32] = */ {
/* .name = */ "rgb32", /* .format = */ PIX_FMT_RGB32,
/* .nb_channels = */ 4, /* .name = */ "rgb32",
/* .color_type = */ FF_COLOR_RGB, /* .nb_channels = */ 4,
/* .pixel_type = */ FF_PIXEL_PACKED, /* .color_type = */ FF_COLOR_RGB,
/* .is_alpha = */ 0, /* .pixel_type = */ FF_PIXEL_PACKED,
/* .is_alpha = */ 0,
/* .x_chroma_shift = */ 0, /* .x_chroma_shift = */ 0,
/* .y_chroma_shift = */ 0, /* .y_chroma_shift = */ 0,
/* .depth = */ 8, /* .depth = */ 8,
}, },
/* [PIX_FMT_RGBA32] = */ {PIX_FMT_RGBA32, /* [PIX_FMT_RGBA32] = */ {
/* .name = */ "rgba32", /* .format = */ PIX_FMT_RGBA32,
/* .nb_channels = */ 4, /* .name = */ "rgba32",
/* .color_type = */ FF_COLOR_RGB, /* .nb_channels = */ 4,
/* .pixel_type = */ FF_PIXEL_PACKED, /* .color_type = */ FF_COLOR_RGB,
/* .is_alpha = */ 1, /* .pixel_type = */ FF_PIXEL_PACKED,
/* .is_alpha = */ 1,
/* .x_chroma_shift = */ 0, /* .x_chroma_shift = */ 0,
/* .y_chroma_shift = */ 0, /* .y_chroma_shift = */ 0,
/* .depth = */ 8, /* .depth = */ 8,
}, },
/* [PIX_FMT_RGB565] = */ {PIX_FMT_RGB565, /* [PIX_FMT_RGB565] = */ {
/* .name = */ "rgb565", /* .format = */ PIX_FMT_RGB565,
/* .nb_channels = */ 3, /* .name = */ "rgb565",
/* .color_type = */ FF_COLOR_RGB, /* .nb_channels = */ 3,
/* .pixel_type = */ FF_PIXEL_PACKED, /* .color_type = */ FF_COLOR_RGB,
/* .is_alpha = */ 0, /* .pixel_type = */ FF_PIXEL_PACKED,
/* .is_alpha = */ 0,
/* .x_chroma_shift = */ 0, /* .x_chroma_shift = */ 0,
/* .y_chroma_shift = */ 0, /* .y_chroma_shift = */ 0,
/* .depth = */ 5, /* .depth = */ 5,
}, },
/* [PIX_FMT_RGB555] = */ {PIX_FMT_RGB555, /* [PIX_FMT_RGB555] = */ {
/* .name = */ "rgb555", /* .format = */ PIX_FMT_RGB555,
/* .nb_channels = */ 4, /* .name = */ "rgb555",
/* .color_type = */ FF_COLOR_RGB, /* .nb_channels = */ 4,
/* .pixel_type = */ FF_PIXEL_PACKED, /* .color_type = */ FF_COLOR_RGB,
/* .is_alpha = */ 1, /* .pixel_type = */ FF_PIXEL_PACKED,
/* .is_alpha = */ 1,
/* .x_chroma_shift = */ 0, /* .x_chroma_shift = */ 0,
/* .y_chroma_shift = */ 0, /* .y_chroma_shift = */ 0,
/* .depth = */ 5, /* .depth = */ 5,
}, },
/* gray / mono formats */ /* gray / mono formats */
/* [PIX_FMT_GRAY8] = */ {PIX_FMT_GRAY8, /* [PIX_FMT_GRAY8] = */ {
/* .name = */ "gray", /* .format = */ PIX_FMT_GRAY8,
/* .nb_channels = */ 1, /* .name = */ "gray",
/* .color_type = */ FF_COLOR_GRAY, /* .nb_channels = */ 1,
/* .pixel_type = */ FF_PIXEL_PLANAR, /* .color_type = */ FF_COLOR_GRAY,
/* .is_alpha = */ 0, /* .pixel_type = */ FF_PIXEL_PLANAR,
/* .is_alpha = */ 0,
/* .x_chroma_shift = */ 0, /* .x_chroma_shift = */ 0,
/* .y_chroma_shift = */ 0, /* .y_chroma_shift = */ 0,
/* .depth = */ 8, /* .depth = */ 8,
}, },
/* [PIX_FMT_MONOWHITE] = */ {PIX_FMT_MONOWHITE, /* [PIX_FMT_MONOWHITE] = */ {
/* .name = */ "monow", /* .format = */ PIX_FMT_MONOWHITE,
/* .nb_channels = */ 1, /* .name = */ "monow",
/* .color_type = */ FF_COLOR_GRAY, /* .nb_channels = */ 1,
/* .pixel_type = */ FF_PIXEL_PLANAR, /* .color_type = */ FF_COLOR_GRAY,
/* .is_alpha = */ 0, /* .pixel_type = */ FF_PIXEL_PLANAR,
/* .is_alpha = */ 0,
/* .x_chroma_shift = */ 0, /* .x_chroma_shift = */ 0,
/* .y_chroma_shift = */ 0, /* .y_chroma_shift = */ 0,
/* .depth = */ 1, /* .depth = */ 1,
}, },
/* [PIX_FMT_MONOBLACK] = */ {PIX_FMT_MONOBLACK, /* [PIX_FMT_MONOBLACK] = */ {
/* .name = */ "monob", /* .format = */ PIX_FMT_MONOBLACK,
/* .nb_channels = */ 1, /* .name = */ "monob",
/* .color_type = */ FF_COLOR_GRAY, /* .nb_channels = */ 1,
/* .pixel_type = */ FF_PIXEL_PLANAR, /* .color_type = */ FF_COLOR_GRAY,
/* .is_alpha = */ 0, /* .pixel_type = */ FF_PIXEL_PLANAR,
/* .is_alpha = */ 0,
/* .x_chroma_shift = */ 0, /* .x_chroma_shift = */ 0,
/* .y_chroma_shift = */ 0, /* .y_chroma_shift = */ 0,
/* .depth = */ 1, /* .depth = */ 1,
}, },
/* paletted formats */ /* paletted formats */
/* [PIX_FMT_PAL8] = */ {PIX_FMT_PAL8, /* [PIX_FMT_PAL8] = */ {
/* .name = */ "pal8", /* .format = */ PIX_FMT_PAL8,
/* .nb_channels = */ 4, /* .name = */ "pal8",
/* .color_type = */ FF_COLOR_RGB, /* .nb_channels = */ 4,
/* .pixel_type = */ FF_PIXEL_PALETTE, /* .color_type = */ FF_COLOR_RGB,
/* .is_alpha = */ 1, /* .pixel_type = */ FF_PIXEL_PALETTE,
/* .is_alpha = */ 1,
/* .x_chroma_shift = */ 0, /* .x_chroma_shift = */ 0,
/* .y_chroma_shift = */ 0, /* .y_chroma_shift = */ 0,
/* .depth = */ 8, /* .depth = */ 8,
}, },
/* [PIX_FMT_XVMC_MPEG2_MC] = */ {PIX_FMT_XVMC_MPEG2_MC, /* [PIX_FMT_XVMC_MPEG2_MC] = */ {
/* .name = */ "xvmcmc", /* .format = */ PIX_FMT_XVMC_MPEG2_MC,
/* .name = */ "xvmcmc",
}, },
/* [PIX_FMT_XVMC_MPEG2_IDCT] = */ {PIX_FMT_XVMC_MPEG2_IDCT, /* [PIX_FMT_XVMC_MPEG2_IDCT] = */ {
/* .name = */ "xvmcidct", /* .format = */ PIX_FMT_XVMC_MPEG2_IDCT,
/* .name = */ "xvmcidct",
}, },
/* [PIX_FMT_UYVY411] = */ {PIX_FMT_UYVY411, /* [PIX_FMT_UYVY411] = */ {
/* .name = */ "uyvy411", /* .format = */ PIX_FMT_UYVY411,
/* .nb_channels = */ 1, /* .name = */ "uyvy411",
/* .color_type = */ FF_COLOR_YUV, /* .nb_channels = */ 1,
/* .pixel_type = */ FF_PIXEL_PACKED, /* .color_type = */ FF_COLOR_YUV,
/* .is_alpha = */ 0, /* .pixel_type = */ FF_PIXEL_PACKED,
/* .is_alpha = */ 0,
/* .x_chroma_shift = */ 2, /* .x_chroma_shift = */ 2,
/* .y_chroma_shift = */ 0, /* .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 */ /* 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) get_pix_fmt_info (enum PixelFormat format)
{ {
int i; 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 /* 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 */ 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", g_warning
format); ("Could not find info for pixel format %d out of %d known pixel formats. One segfault coming up",
format, PIX_FMT_NB);
return NULL; return NULL;
} }