ext/ffmpeg/gstffmpegcodecmap.c (gst_ffmpeg_pixfmt_to_caps): Add support for GRAY8 colorspace

Original commit message from CVS:
* ext/ffmpeg/gstffmpegcodecmap.c (gst_ffmpeg_pixfmt_to_caps):
Add support for GRAY8 colorspace
This commit is contained in:
Luca Ognibene 2005-05-13 14:33:09 +00:00
parent 63d6ce9235
commit 1857bd51da
2 changed files with 37 additions and 24 deletions

View file

@ -1,3 +1,8 @@
2005-05-13 Luca Ognibene <luogni@tin.it>
* ext/ffmpeg/gstffmpegcodecmap.c (gst_ffmpeg_pixfmt_to_caps):
Add support for GRAY8 colorspace
2005-05-11 Luca Ognibene <luogni@tin.it> 2005-05-11 Luca Ognibene <luogni@tin.it>
* ext/ffmpeg/gstffmpegenc.c (gst_ffmpegenc_chain_video): * ext/ffmpeg/gstffmpegenc.c (gst_ffmpegenc_chain_video):

View file

@ -808,7 +808,7 @@ gst_ffmpeg_pixfmt_to_caps (enum PixelFormat pix_fmt, AVCodecContext * context)
int bpp = 0, depth = 0, endianness = 0; int bpp = 0, depth = 0, endianness = 0;
gulong g_mask = 0, r_mask = 0, b_mask = 0, a_mask = 0; gulong g_mask = 0, r_mask = 0, b_mask = 0, a_mask = 0;
guint32 fmt = 0; guint32 fmt = 0;
switch (pix_fmt) { switch (pix_fmt) {
case PIX_FMT_YUVJ420P: case PIX_FMT_YUVJ420P:
case PIX_FMT_YUV420P: case PIX_FMT_YUV420P:
@ -880,35 +880,43 @@ gst_ffmpeg_pixfmt_to_caps (enum PixelFormat pix_fmt, AVCodecContext * context)
bpp = depth = 8; bpp = depth = 8;
endianness = G_BYTE_ORDER; endianness = G_BYTE_ORDER;
break; break;
case PIX_FMT_GRAY8:
bpp = depth = 8;
caps = GST_FF_VID_CAPS_NEW ("video/x-raw-gray",
"bpp", G_TYPE_INT, bpp,
"depth", G_TYPE_INT, depth, NULL);
break;
default: default:
/* give up ... */ /* give up ... */
break; break;
} }
if (bpp != 0) { if (caps == NULL) {
if (r_mask != 0) { if (bpp != 0) {
caps = GST_FF_VID_CAPS_NEW ("video/x-raw-rgb", if (r_mask != 0) {
"bpp", G_TYPE_INT, bpp, caps = GST_FF_VID_CAPS_NEW ("video/x-raw-rgb",
"depth", G_TYPE_INT, depth, "bpp", G_TYPE_INT, bpp,
"red_mask", G_TYPE_INT, r_mask, "depth", G_TYPE_INT, depth,
"green_mask", G_TYPE_INT, g_mask, "red_mask", G_TYPE_INT, r_mask,
"blue_mask", G_TYPE_INT, b_mask, "green_mask", G_TYPE_INT, g_mask,
"endianness", G_TYPE_INT, endianness, NULL); "blue_mask", G_TYPE_INT, b_mask,
if (a_mask) { "endianness", G_TYPE_INT, endianness, NULL);
gst_caps_set_simple (caps, "alpha_mask", G_TYPE_INT, a_mask, NULL); if (a_mask) {
} gst_caps_set_simple (caps, "alpha_mask", G_TYPE_INT, a_mask, NULL);
} else { }
caps = GST_FF_VID_CAPS_NEW ("video/x-raw-rgb", } else {
"bpp", G_TYPE_INT, bpp, caps = GST_FF_VID_CAPS_NEW ("video/x-raw-rgb",
"depth", G_TYPE_INT, depth, "bpp", G_TYPE_INT, bpp,
"endianness", G_TYPE_INT, endianness, NULL); "depth", G_TYPE_INT, depth,
if (context) { "endianness", G_TYPE_INT, endianness, NULL);
gst_ffmpeg_set_palette (caps, context); if (context) {
gst_ffmpeg_set_palette (caps, context);
}
} }
} else if (fmt) {
caps = GST_FF_VID_CAPS_NEW ("video/x-raw-yuv",
"format", GST_TYPE_FOURCC, fmt, NULL);
} }
} else if (fmt) {
caps = GST_FF_VID_CAPS_NEW ("video/x-raw-yuv",
"format", GST_TYPE_FOURCC, fmt, NULL);
} }
if (caps != NULL) { if (caps != NULL) {