Commit 51fe1a04 authored by Sebastian Dröge's avatar Sebastian Dröge

ffmpeg: Add mapping for YUVA420P <-> A420

This is used by VP6a, which is used by Flash.

See bug #613901.
parent 6a0e167c
......@@ -815,6 +815,9 @@ gst_ffmpeg_codecid_to_caps (enum CodecID codec_id,
case PIX_FMT_YUV420P:
fourcc = GST_MAKE_FOURCC ('I', '4', '2', '0');
break;
case PIX_FMT_YUVA420P:
fourcc = GST_MAKE_FOURCC ('A', '4', '2', '0');
break;
case PIX_FMT_YUV411P:
fourcc = GST_MAKE_FOURCC ('Y', '4', '1', 'B');
break;
......@@ -1630,6 +1633,9 @@ gst_ffmpeg_pixfmt_to_caps (enum PixelFormat pix_fmt, AVCodecContext * context,
case PIX_FMT_YUV420P:
fmt = GST_MAKE_FOURCC ('I', '4', '2', '0');
break;
case PIX_FMT_YUVA420P:
fmt = GST_MAKE_FOURCC ('A', '4', '2', '0');
break;
case PIX_FMT_YUYV422:
fmt = GST_MAKE_FOURCC ('Y', 'U', 'Y', '2');
break;
......@@ -2036,6 +2042,9 @@ gst_ffmpeg_caps_to_pixfmt (const GstCaps * caps,
case GST_MAKE_FOURCC ('I', '4', '2', '0'):
context->pix_fmt = PIX_FMT_YUV420P;
break;
case GST_MAKE_FOURCC ('A', '4', '2', '0'):
context->pix_fmt = PIX_FMT_YUVA420P;
break;
case GST_MAKE_FOURCC ('Y', '4', '1', 'B'):
context->pix_fmt = PIX_FMT_YUV411P;
break;
......@@ -2411,6 +2420,9 @@ gst_ffmpeg_caps_with_codecid (enum CodecID codec_id,
case GST_MAKE_FOURCC ('I', '4', '2', '0'):
context->pix_fmt = PIX_FMT_YUV420P;
break;
case GST_MAKE_FOURCC ('A', '4', '2', '0'):
context->pix_fmt = PIX_FMT_YUVA420P;
break;
case GST_MAKE_FOURCC ('Y', '4', '1', 'B'):
context->pix_fmt = PIX_FMT_YUV411P;
break;
......
......@@ -237,6 +237,15 @@ gst_ffmpeg_init_pix_fmt_info (void)
pix_fmt_info[PIX_FMT_PAL8].color_type = FF_COLOR_RGB;
pix_fmt_info[PIX_FMT_PAL8].pixel_type = FF_PIXEL_PALETTE;
pix_fmt_info[PIX_FMT_PAL8].depth = 8;
pix_fmt_info[PIX_FMT_YUVA420P].name = g_strdup ("yuva420p");
pix_fmt_info[PIX_FMT_YUVA420P].nb_channels = 4;
pix_fmt_info[PIX_FMT_YUVA420P].is_alpha = 1;
pix_fmt_info[PIX_FMT_YUVA420P].color_type = FF_COLOR_YUV;
pix_fmt_info[PIX_FMT_YUVA420P].pixel_type = FF_PIXEL_PLANAR;
pix_fmt_info[PIX_FMT_YUVA420P].depth = 8,
pix_fmt_info[PIX_FMT_YUVA420P].x_chroma_shift = 1,
pix_fmt_info[PIX_FMT_YUVA420P].y_chroma_shift = 1;
};
int
......@@ -291,6 +300,25 @@ gst_ffmpeg_avpicture_fill (AVPicture * picture,
GST_DEBUG ("planes %d %d %d", 0, size, size + size2);
GST_DEBUG ("strides %d %d %d", stride, stride2, stride2);
return size + 2 * size2;
case PIX_FMT_YUVA420P:
stride = ROUND_UP_4 (width);
h2 = ROUND_UP_X (height, pinfo->y_chroma_shift);
size = stride * h2;
w2 = DIV_ROUND_UP_X (width, pinfo->x_chroma_shift);
stride2 = ROUND_UP_4 (w2);
h2 = DIV_ROUND_UP_X (height, pinfo->y_chroma_shift);
size2 = stride2 * h2;
picture->data[0] = ptr;
picture->data[1] = picture->data[0] + size;
picture->data[2] = picture->data[1] + size2;
picture->data[3] = picture->data[2] + size2;
picture->linesize[0] = stride;
picture->linesize[1] = stride2;
picture->linesize[2] = stride2;
picture->linesize[3] = stride;
GST_DEBUG ("planes %d %d %d %d", 0, size, size + size2, size + 2 * size2);
GST_DEBUG ("strides %d %d %d %d", stride, stride2, stride2, stride);
return 2 * size + 2 * size2;
case PIX_FMT_RGB24:
case PIX_FMT_BGR24:
stride = ROUND_UP_4 (width * 3);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment