vaapipostproc: handle video sub-buffers.

Intermediate elements may produce a sub-buffer from a valid GstVaapiVideoBuffer
for non raw YUV cases. Make sure vaapipostproc now understands those buffers.
This commit is contained in:
Gwenole Beauchesne 2012-12-13 13:27:33 +01:00
parent 098eb2624e
commit 936d8b8fc6

View file

@ -255,7 +255,7 @@ gst_vaapipostproc_stop(GstVaapiPostproc *postproc)
static GstFlowReturn static GstFlowReturn
gst_vaapipostproc_process(GstVaapiPostproc *postproc, GstBuffer *buf) gst_vaapipostproc_process(GstVaapiPostproc *postproc, GstBuffer *buf)
{ {
GstVaapiVideoBuffer *vbuf = GST_VAAPI_VIDEO_BUFFER(buf); GstVaapiVideoBuffer *vbuf;
GstVaapiSurfaceProxy *proxy; GstVaapiSurfaceProxy *proxy;
GstClockTime timestamp; GstClockTime timestamp;
GstFlowReturn ret; GstFlowReturn ret;
@ -263,6 +263,13 @@ gst_vaapipostproc_process(GstVaapiPostproc *postproc, GstBuffer *buf)
guint outbuf_flags, flags; guint outbuf_flags, flags;
gboolean interlaced, tff; gboolean interlaced, tff;
if (GST_VAAPI_IS_VIDEO_BUFFER(buf))
vbuf = GST_VAAPI_VIDEO_BUFFER(buf);
else if (GST_VAAPI_IS_VIDEO_BUFFER(buf->parent))
vbuf = GST_VAAPI_VIDEO_BUFFER(buf->parent);
else
goto error_invalid_buffer;
flags = gst_vaapi_video_buffer_get_render_flags(vbuf); flags = gst_vaapi_video_buffer_get_render_flags(vbuf);
/* Deinterlacing disabled, push frame */ /* Deinterlacing disabled, push frame */
@ -328,6 +335,12 @@ gst_vaapipostproc_process(GstVaapiPostproc *postproc, GstBuffer *buf)
return GST_FLOW_OK; return GST_FLOW_OK;
/* ERRORS */ /* ERRORS */
error_invalid_buffer:
{
GST_ERROR("failed to receive a valid video buffer");
gst_buffer_unref(buf);
return GST_FLOW_UNEXPECTED;
}
error_create_buffer: error_create_buffer:
{ {
GST_ERROR("failed to create output buffer"); GST_ERROR("failed to create output buffer");