diff --git a/sys/vdpau/gstvdputils.h b/sys/vdpau/gstvdputils.h index 530a4adea8..3713db3bbc 100644 --- a/sys/vdpau/gstvdputils.h +++ b/sys/vdpau/gstvdputils.h @@ -68,12 +68,12 @@ static const VdpauFormats formats[N_FORMATS] = { VDP_CHROMA_TYPE_444, VDP_YCBCR_FORMAT_Y8U8V8A8, GST_MAKE_FOURCC ('A', 'V', 'U', 'Y') - }, + }, { VDP_CHROMA_TYPE_422, VDP_YCBCR_FORMAT_YUYV, - GST_MAKE_FOURCC ('Y', 'U', 'Y', 'V') - } + GST_MAKE_FOURCC ('Y', 'U', 'Y', '2') + }, }; GstCaps *gst_vdp_video_to_yuv_caps (GstCaps *caps); diff --git a/sys/vdpau/gstvdpvideoyuv.c b/sys/vdpau/gstvdpvideoyuv.c index a17eba7008..594c51331d 100644 --- a/sys/vdpau/gstvdpvideoyuv.c +++ b/sys/vdpau/gstvdpvideoyuv.c @@ -56,7 +56,7 @@ static GstStaticPadTemplate src_template = GST_PAD_ALWAYS, GST_STATIC_CAPS (GST_VIDEO_CAPS_YUV ("I420") ";" GST_VIDEO_CAPS_YUV ("YV12") ";" GST_VIDEO_CAPS_YUV ("NV12") ";" - GST_VIDEO_CAPS_YUV ("UYVY"))); + GST_VIDEO_CAPS_YUV ("UYVY") ";" GST_VIDEO_CAPS_YUV ("YUY2"))); #define DEBUG_INIT(bla) \ GST_DEBUG_CATEGORY_INIT (gst_vdp_video_yuv_debug, "vdpauvideoyuv", 0, "VDPAU VdpSurface to YUV"); @@ -205,6 +205,32 @@ gst_vdp_video_yuv_transform (GstBaseTransform * trans, GstBuffer * inbuf, } break; } + case GST_MAKE_FOURCC ('Y', 'U', 'Y', '2'): + { + VdpStatus status; + guint8 *data[1]; + guint32 stride[1]; + + data[0] = GST_BUFFER_DATA (outbuf); + + stride[0] = gst_video_format_get_row_stride (GST_VIDEO_FORMAT_YUY2, + 0, video_yuv->width); + + GST_LOG_OBJECT (video_yuv, "Entering vdp_video_surface_get_bits_ycbcr"); + status = + device->vdp_video_surface_get_bits_ycbcr (surface, + VDP_YCBCR_FORMAT_YUYV, (void *) data, stride); + GST_LOG_OBJECT (video_yuv, + "Got status %d from vdp_video_surface_get_bits_ycbcr", status); + if (G_UNLIKELY (status != VDP_STATUS_OK)) { + GST_ELEMENT_ERROR (video_yuv, RESOURCE, READ, + ("Couldn't get data from vdpau"), + ("Error returned from vdpau was: %s", + device->vdp_get_error_string (status))); + return GST_FLOW_ERROR; + } + break; + } default: break; } @@ -253,6 +279,13 @@ gst_vdp_video_transform_size (GstBaseTransform * trans, video_yuv->height); break; } + case GST_MAKE_FOURCC ('Y', 'U', 'Y', '2'): + { + *othersize = + gst_video_format_get_size (GST_VIDEO_FORMAT_YUY2, video_yuv->width, + video_yuv->height); + break; + } default: return FALSE; } diff --git a/sys/vdpau/gstvdpyuvvideo.c b/sys/vdpau/gstvdpyuvvideo.c index db67646161..5bd15fcaf6 100644 --- a/sys/vdpau/gstvdpyuvvideo.c +++ b/sys/vdpau/gstvdpyuvvideo.c @@ -51,7 +51,7 @@ static GstStaticPadTemplate sink_template = GST_PAD_ALWAYS, GST_STATIC_CAPS (GST_VIDEO_CAPS_YUV ("I420") ";" GST_VIDEO_CAPS_YUV ("YV12") ";" GST_VIDEO_CAPS_YUV ("NV12") ";" - GST_VIDEO_CAPS_YUV ("UYVY"))); + GST_VIDEO_CAPS_YUV ("UYVY") ";" GST_VIDEO_CAPS_YUV ("YUY2"))); static GstStaticPadTemplate src_template = GST_STATIC_PAD_TEMPLATE (GST_BASE_TRANSFORM_SRC_NAME, @@ -221,6 +221,29 @@ gst_vdp_yuv_video_transform (GstBaseTransform * trans, GstBuffer * inbuf, } break; } + case GST_MAKE_FOURCC ('Y', 'U', 'Y', '2'): + { + VdpStatus status; + guint8 *data[1]; + guint32 stride[1]; + + data[0] = GST_BUFFER_DATA (inbuf); + + stride[0] = gst_video_format_get_row_stride (GST_VIDEO_FORMAT_YUY2, + 0, yuv_video->width); + + status = + device->vdp_video_surface_put_bits_ycbcr (surface, + VDP_YCBCR_FORMAT_YUYV, (void *) data, stride); + if (G_UNLIKELY (status != VDP_STATUS_OK)) { + GST_ELEMENT_ERROR (yuv_video, RESOURCE, READ, + ("Couldn't get data from vdpau"), + ("Error returned from vdpau was: %s", + device->vdp_get_error_string (status))); + return GST_FLOW_ERROR; + } + break; + } default: break; }