mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-11 09:55:36 +00:00
vdpau: small api cleanup
merge gst_vdp_video_buffer_get_allowed_[video|yuv]_caps into gst_vdp_video_buffer_get_allowed_caps
This commit is contained in:
parent
5739eb3c8f
commit
8a355f1a24
5 changed files with 42 additions and 78 deletions
|
@ -809,8 +809,8 @@ gst_vdp_sink_show_frame (GstBaseSink * bsink, GstBuffer * outbuf)
|
|||
|
||||
g_mutex_lock (vdp_sink->x_lock);
|
||||
status =
|
||||
device->vdp_presentation_queue_query_surface_status (vdp_sink->window->
|
||||
queue, surface, &queue_status, &pres_time);
|
||||
device->vdp_presentation_queue_query_surface_status (vdp_sink->
|
||||
window->queue, surface, &queue_status, &pres_time);
|
||||
g_mutex_unlock (vdp_sink->x_lock);
|
||||
|
||||
if (queue_status == VDP_PRESENTATION_QUEUE_STATUS_QUEUED) {
|
||||
|
|
|
@ -163,14 +163,16 @@ gst_vdp_video_buffer_get_caps (gboolean filter, VdpChromaType chroma_type)
|
|||
}
|
||||
|
||||
GstCaps *
|
||||
gst_vdp_video_buffer_get_allowed_yuv_caps (GstVdpDevice * device)
|
||||
gst_vdp_video_buffer_get_allowed_caps (GstVdpDevice * device)
|
||||
{
|
||||
GstCaps *caps;
|
||||
GstCaps *video_caps, *yuv_caps;
|
||||
gint i;
|
||||
|
||||
caps = gst_caps_new_empty ();
|
||||
for (i = 0; i < G_N_ELEMENTS (chroma_types); i++) {
|
||||
VdpStatus status;
|
||||
|
||||
video_caps = gst_caps_new_empty ();
|
||||
yuv_caps = gst_caps_new_empty ();
|
||||
|
||||
for (i = 0; i < G_N_ELEMENTS (chroma_types); i++) {
|
||||
VdpBool is_supported;
|
||||
guint32 max_w, max_h;
|
||||
|
||||
|
@ -178,17 +180,19 @@ gst_vdp_video_buffer_get_allowed_yuv_caps (GstVdpDevice * device)
|
|||
device->vdp_video_surface_query_capabilities (device->device,
|
||||
chroma_types[i], &is_supported, &max_w, &max_h);
|
||||
|
||||
if (status != VDP_STATUS_OK && status != VDP_STATUS_INVALID_CHROMA_TYPE) {
|
||||
GST_ERROR_OBJECT (device,
|
||||
"Could not get query VDPAU video surface capabilites, "
|
||||
"Error returned from vdpau was: %s",
|
||||
device->vdp_get_error_string (status));
|
||||
if (status != VDP_STATUS_OK && status != VDP_STATUS_INVALID_CHROMA_TYPE)
|
||||
goto surface_query_caps_error;
|
||||
|
||||
goto error;
|
||||
}
|
||||
if (is_supported) {
|
||||
GstCaps *format_caps;
|
||||
gint j;
|
||||
|
||||
format_caps = gst_caps_new_simple ("video/x-vdpau-video",
|
||||
"chroma-type", G_TYPE_INT, chroma_types[i],
|
||||
"width", GST_TYPE_INT_RANGE, 1, max_w,
|
||||
"height", GST_TYPE_INT_RANGE, 1, max_h, NULL);
|
||||
gst_caps_append (video_caps, format_caps);
|
||||
|
||||
for (j = 0; j < G_N_ELEMENTS (formats); j++) {
|
||||
if (formats[j].chroma_type != chroma_types[i])
|
||||
continue;
|
||||
|
@ -197,69 +201,36 @@ gst_vdp_video_buffer_get_allowed_yuv_caps (GstVdpDevice * device)
|
|||
device->vdp_video_surface_query_ycbcr_capabilities (device->device,
|
||||
formats[j].chroma_type, formats[j].format, &is_supported);
|
||||
if (status != VDP_STATUS_OK
|
||||
&& status != VDP_STATUS_INVALID_Y_CB_CR_FORMAT) {
|
||||
GST_ERROR_OBJECT (device, "Could not query VDPAU YCbCr capabilites, "
|
||||
"Error returned from vdpau was: %s",
|
||||
device->vdp_get_error_string (status));
|
||||
|
||||
goto error;
|
||||
}
|
||||
&& status != VDP_STATUS_INVALID_Y_CB_CR_FORMAT)
|
||||
goto surface_query_ycbcr_error;
|
||||
|
||||
if (is_supported) {
|
||||
GstCaps *format_caps;
|
||||
|
||||
format_caps = gst_caps_new_simple ("video/x-raw-yuv",
|
||||
"format", GST_TYPE_FOURCC, formats[j].fourcc,
|
||||
"width", GST_TYPE_INT_RANGE, 1, max_w,
|
||||
"height", GST_TYPE_INT_RANGE, 1, max_h, NULL);
|
||||
gst_caps_append (caps, format_caps);
|
||||
gst_caps_append (yuv_caps, format_caps);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
error:
|
||||
return caps;
|
||||
}
|
||||
done:
|
||||
gst_caps_append (video_caps, yuv_caps);
|
||||
return video_caps;
|
||||
|
||||
GstCaps *
|
||||
gst_vdp_video_buffer_get_allowed_video_caps (GstVdpDevice * device)
|
||||
{
|
||||
GstCaps *caps;
|
||||
gint i;
|
||||
|
||||
caps = gst_caps_new_empty ();
|
||||
for (i = 0; i < G_N_ELEMENTS (chroma_types); i++) {
|
||||
VdpStatus status;
|
||||
VdpBool is_supported;
|
||||
guint32 max_w, max_h;
|
||||
|
||||
status =
|
||||
device->vdp_video_surface_query_capabilities (device->device,
|
||||
chroma_types[i], &is_supported, &max_w, &max_h);
|
||||
|
||||
if (status != VDP_STATUS_OK && status != VDP_STATUS_INVALID_CHROMA_TYPE) {
|
||||
surface_query_caps_error:
|
||||
GST_ERROR_OBJECT (device,
|
||||
"Could not get query VDPAU video surface capabilites, "
|
||||
"Error returned from vdpau was: %s",
|
||||
device->vdp_get_error_string (status));
|
||||
goto done;
|
||||
|
||||
goto error;
|
||||
}
|
||||
|
||||
if (is_supported) {
|
||||
GstCaps *format_caps;
|
||||
|
||||
format_caps = gst_caps_new_simple ("video/x-vdpau-video",
|
||||
"chroma-type", G_TYPE_INT, chroma_types[i],
|
||||
"width", GST_TYPE_INT_RANGE, 1, max_w,
|
||||
"height", GST_TYPE_INT_RANGE, 1, max_h, NULL);
|
||||
gst_caps_append (caps, format_caps);
|
||||
}
|
||||
}
|
||||
|
||||
error:
|
||||
return caps;
|
||||
surface_query_ycbcr_error:
|
||||
GST_ERROR_OBJECT (device, "Could not query VDPAU YCbCr capabilites, "
|
||||
"Error returned from vdpau was: %s",
|
||||
device->vdp_get_error_string (status));
|
||||
goto done;
|
||||
}
|
||||
|
||||
gboolean
|
||||
|
|
|
@ -96,8 +96,7 @@ GstVdpVideoBuffer* gst_vdp_video_buffer_new (GstVdpDevice * device, VdpChromaTyp
|
|||
void gst_vdp_video_buffer_add_reference (GstVdpVideoBuffer *buffer, GstVdpVideoBuffer *buf);
|
||||
|
||||
GstCaps *gst_vdp_video_buffer_get_caps (gboolean filter, VdpChromaType chroma_type);
|
||||
GstCaps *gst_vdp_video_buffer_get_allowed_yuv_caps (GstVdpDevice * device);
|
||||
GstCaps *gst_vdp_video_buffer_get_allowed_video_caps (GstVdpDevice * device);
|
||||
GstCaps *gst_vdp_video_buffer_get_allowed_caps (GstVdpDevice * device);
|
||||
|
||||
GstCaps *gst_vdp_video_buffer_parse_yuv_caps (GstCaps *yuv_caps);
|
||||
|
||||
|
|
|
@ -844,11 +844,7 @@ gst_vdp_vpp_sink_getcaps (GstPad * pad)
|
|||
GstCaps *caps;
|
||||
|
||||
if (vpp->device) {
|
||||
GstCaps *video_caps, *yuv_caps;
|
||||
video_caps = gst_vdp_video_buffer_get_allowed_video_caps (vpp->device);
|
||||
yuv_caps = gst_vdp_video_buffer_get_allowed_yuv_caps (vpp->device);
|
||||
gst_caps_append (video_caps, yuv_caps);
|
||||
caps = video_caps;
|
||||
caps = gst_vdp_video_buffer_get_allowed_caps (vpp->device);
|
||||
} else {
|
||||
GstElementClass *element_class = GST_ELEMENT_GET_CLASS (vpp);
|
||||
GstPadTemplate *sink_template;
|
||||
|
|
|
@ -127,21 +127,19 @@ gst_vdp_video_src_pad_push (GstVdpVideoSrcPad * vdp_pad,
|
|||
static void
|
||||
gst_vdp_video_src_pad_update_caps (GstVdpVideoSrcPad * vdp_pad)
|
||||
{
|
||||
GstCaps *yuv_caps, *video_caps;
|
||||
GstCaps *caps;
|
||||
const GstCaps *templ_caps;
|
||||
|
||||
video_caps = gst_vdp_video_buffer_get_allowed_video_caps (vdp_pad->device);
|
||||
yuv_caps = gst_vdp_video_buffer_get_allowed_yuv_caps (vdp_pad->device);
|
||||
gst_caps_append (video_caps, yuv_caps);
|
||||
|
||||
if (vdp_pad->caps)
|
||||
gst_caps_unref (vdp_pad->caps);
|
||||
|
||||
caps = gst_vdp_video_buffer_get_allowed_caps (vdp_pad->device);
|
||||
|
||||
if ((templ_caps = gst_pad_get_pad_template_caps (GST_PAD (vdp_pad)))) {
|
||||
vdp_pad->caps = gst_caps_intersect (video_caps, templ_caps);
|
||||
gst_caps_unref (video_caps);
|
||||
vdp_pad->caps = gst_caps_intersect (caps, templ_caps);
|
||||
gst_caps_unref (caps);
|
||||
} else
|
||||
vdp_pad->caps = video_caps;
|
||||
vdp_pad->caps = caps;
|
||||
}
|
||||
|
||||
GstFlowReturn
|
||||
|
|
Loading…
Reference in a new issue