gst/: Patch for support of YVU9 AVI files (#334822)

Original commit message from CVS:
Patch by: Fabrizio Gennari <fabrizio dot ge at tiscali dot it>
* gst-libs/gst/riff/riff-media.c: (gst_riff_create_video_caps),
(gst_riff_create_video_template_caps):
* gst/ffmpegcolorspace/avcodec.h:
* gst/ffmpegcolorspace/gstffmpegcodecmap.c:
(gst_ffmpeg_pixfmt_to_caps), (gst_ffmpeg_caps_to_pixfmt),
(gst_ffmpegcsp_avpicture_fill):
* gst/ffmpegcolorspace/imgconvert.c:
Patch for support of YVU9 AVI files (#334822)
This commit is contained in:
Fabrizio Gennari 2006-03-23 09:38:59 +00:00 committed by Wim Taymans
parent 8063481f3f
commit 1f9a8224f4
5 changed files with 46 additions and 5 deletions

View file

@ -1,3 +1,16 @@
2006-03-23 Wim Taymans <wim@fluendo.com>
Patch by: Fabrizio Gennari <fabrizio dot ge at tiscali dot it>
* gst-libs/gst/riff/riff-media.c: (gst_riff_create_video_caps),
(gst_riff_create_video_template_caps):
* gst/ffmpegcolorspace/avcodec.h:
* gst/ffmpegcolorspace/gstffmpegcodecmap.c:
(gst_ffmpeg_pixfmt_to_caps), (gst_ffmpeg_caps_to_pixfmt),
(gst_ffmpegcsp_avpicture_fill):
* gst/ffmpegcolorspace/imgconvert.c:
Patch for support of YVU9 AVI files (#334822)
2006-03-22 Edward Hervey <edward@fluendo.com>
* docs/design/design-decodebin.txt:

View file

@ -99,6 +99,13 @@ gst_riff_create_video_caps (guint32 codec_fcc,
*codec_name = g_strdup ("Uncompressed packed YUV 4:2:2");
break;
case GST_MAKE_FOURCC ('Y', 'V', 'U', '9'):
caps = gst_caps_new_simple ("video/x-raw-yuv",
"format", GST_TYPE_FOURCC, codec_fcc, NULL);
if (codec_name)
*codec_name = g_strdup ("Uncompressed packed YVU 4:1:0");
break;
case GST_MAKE_FOURCC ('M', 'J', 'P', 'G'): /* YUY2 MJPEG */
case GST_MAKE_FOURCC ('A', 'V', 'R', 'n'):
case GST_MAKE_FOURCC ('I', 'J', 'P', 'G'):
@ -1005,6 +1012,7 @@ gst_riff_create_video_template_caps (void)
guint32 tags[] = {
GST_MAKE_FOURCC ('I', '4', '2', '0'),
GST_MAKE_FOURCC ('Y', 'U', 'Y', '2'),
GST_MAKE_FOURCC ('Y', 'V', 'U', '9'),
GST_MAKE_FOURCC ('M', 'J', 'P', 'G'),
GST_MAKE_FOURCC ('D', 'V', 'S', 'D'),
GST_MAKE_FOURCC ('W', 'M', 'V', '1'),

View file

@ -64,6 +64,7 @@ enum PixelFormat {
PIX_FMT_RGB32, ///< Packed pixel, 4 bytes per pixel, BGRXBGRX..., stored in cpu endianness
PIX_FMT_BGR32, ///< Packed pixel, 4 bytes per pixel, XRGBXRGB...
PIX_FMT_YUV410P, ///< Planar YUV 4:1:0 (1 Cr & Cb sample per 4x4 Y samples)
PIX_FMT_YVU410P, ///< Planar YVU 4:1:0 (1 Cr & Cb sample per 4x4 Y samples)
PIX_FMT_YUV411P, ///< Planar YUV 4:1:1 (1 Cr & Cb sample per 4x1 Y samples)
PIX_FMT_RGB565, ///< always stored in cpu endianness
PIX_FMT_RGB555, ///< always stored in cpu endianness, most significant bit to 1

View file

@ -260,6 +260,9 @@ gst_ffmpeg_pixfmt_to_caps (enum PixelFormat pix_fmt, AVCodecContext * context)
case PIX_FMT_YUV410P:
fmt = GST_MAKE_FOURCC ('Y', 'U', 'V', '9');
break;
case PIX_FMT_YVU410P:
fmt = GST_MAKE_FOURCC ('Y', 'V', 'U', '9');
break;
case PIX_FMT_YUV411P:
fmt = GST_MAKE_FOURCC ('Y', '4', '1', 'B');
break;
@ -537,6 +540,9 @@ gst_ffmpeg_caps_to_pixfmt (const GstCaps * caps,
case GST_MAKE_FOURCC ('Y', 'U', 'V', '9'):
context->pix_fmt = PIX_FMT_YUV410P;
break;
case GST_MAKE_FOURCC ('Y', 'V', 'U', '9'):
context->pix_fmt = PIX_FMT_YVU410P;
break;
case GST_MAKE_FOURCC ('A', 'Y', 'U', 'V'):
context->pix_fmt = PIX_FMT_AYUV4444;
break;
@ -695,19 +701,21 @@ gst_ffmpegcsp_avpicture_fill (AVPicture * picture,
return size + 2 * size2;
/* PIX_FMT_YVU420P = YV12: same as PIX_FMT_YUV420P, but
* with U and V plane swapped. Strides as in videotestsrc */
case PIX_FMT_YVU410P:
case PIX_FMT_YVU420P:
stride = GST_ROUND_UP_4 (width);
h2 = GST_ROUND_UP_2 (height);
h2 = ROUND_UP_X (height, pinfo->y_chroma_shift);
size = stride * h2;
stride2 = GST_ROUND_UP_8 (stride) / 2;
h2 = GST_ROUND_UP_2 (height) / 2;
w2 = DIV_ROUND_UP_X (width, pinfo->x_chroma_shift);
stride2 = GST_ROUND_UP_4 (w2);
h2 = DIV_ROUND_UP_X (height, pinfo->y_chroma_shift);
size2 = stride2 * h2;
picture->data[0] = ptr;
picture->data[2] = picture->data[0] + size;
picture->data[1] = picture->data[2] + size2;
picture->linesize[0] = stride;
picture->linesize[1] = GST_ROUND_UP_8 (stride) / 2;
picture->linesize[2] = GST_ROUND_UP_8 (stride) / 2;
picture->linesize[1] = stride2;
picture->linesize[2] = stride2;
return size + 2 * size2;
case PIX_FMT_RGB24:
case PIX_FMT_BGR24:

View file

@ -119,6 +119,17 @@ static PixFmtInfo pix_fmt_info[PIX_FMT_NB] = {
/* .y_chroma_shift = */ 2,
/* .depth = */ 8,
},
/* [PIX_FMT_YVU410P] = */ {
/* .format = */ PIX_FMT_YVU410P,
/* .name = */ "yvu410p",
/* .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] = */ {
/* .format = */ PIX_FMT_YUV411P,
/* .name = */ "yuv411p",