summaryrefslogtreecommitdiff
authorCarl-Anton Ingmarsson <ca.ingmarsson@gmail.com>2010-07-30 12:44:09 (GMT)
committer Carl-Anton Ingmarsson <ca.ingmarsson@gmail.com>2010-07-30 12:44:09 (GMT)
commit472cdc4c6166962ccf76f4c7b808df3134145241 (patch) (side-by-side diff)
tree2cbf85b142244251ab5a8ac2bcaf2c29781858b6
parent726290de21c99e75c6c8b826820371068c99d08c (diff)
downloadgst-plugins-bad-472cdc4c6166962ccf76f4c7b808df3134145241.zip
gst-plugins-bad-472cdc4c6166962ccf76f4c7b808df3134145241.tar.gz
vdpau: rename gst_vdp_video_buffer_parse_yuv_caps and move it to gstvdputils.h
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--sys/vdpau/gstvdp/gstvdputils.c85
-rw-r--r--sys/vdpau/gstvdp/gstvdputils.h3
-rw-r--r--sys/vdpau/gstvdp/gstvdpvideobuffer.c59
-rw-r--r--sys/vdpau/gstvdp/gstvdpvideobuffer.h2
-rw-r--r--sys/vdpau/gstvdpvideopostprocess.c4
5 files changed, 82 insertions, 71 deletions
diff --git a/sys/vdpau/gstvdp/gstvdputils.c b/sys/vdpau/gstvdp/gstvdputils.c
index fad66a6..a614d99 100644
--- a/sys/vdpau/gstvdp/gstvdputils.c
+++ b/sys/vdpau/gstvdp/gstvdputils.c
@@ -40,17 +40,22 @@ gst_vdp_video_remove_pixel_aspect_ratio (GstStructure * structure)
}
GstCaps *
-gst_vdp_video_to_output_caps (GstCaps * caps)
+gst_vdp_video_to_output_caps (GstCaps * video_caps)
{
- GstCaps *result;
+ GstCaps *output_caps;
gint i;
- result = gst_caps_copy (caps);
- for (i = 0; i < gst_caps_get_size (caps); i++) {
+ g_return_val_if_fail (GST_IS_CAPS (video_caps), NULL);
+
+ output_caps = gst_caps_copy (video_caps);
+ for (i = 0; i < gst_caps_get_size (video_caps); i++) {
GstStructure *structure, *rgb_structure;
- structure = gst_caps_get_structure (result, i);
+ structure = gst_caps_get_structure (output_caps, i);
+ if (!gst_structure_has_name (structure, "video/x-vdpau-video"))
+ goto not_video_error;
+
rgb_structure = gst_structure_copy (structure);
gst_structure_set_name (structure, "video/x-vdpau-output");
@@ -60,8 +65,74 @@ gst_vdp_video_to_output_caps (GstCaps * caps)
gst_structure_set_name (rgb_structure, "video/x-raw-rgb");
gst_structure_remove_field (rgb_structure, "chroma-type");
gst_vdp_video_remove_pixel_aspect_ratio (rgb_structure);
- gst_caps_append_structure (result, rgb_structure);
+ gst_caps_append_structure (output_caps, rgb_structure);
}
- return result;
+ return output_caps;
+
+error:
+ gst_caps_unref (output_caps);
+ return NULL;
+
+not_video_error:
+ GST_WARNING ("The caps weren't of type \"video/x-vdpau-video\"");
+ goto error;
+}
+
+GstCaps *
+gst_vdp_yuv_to_video_caps (GstCaps * yuv_caps)
+{
+ GstCaps *video_caps;
+ gint i;
+
+ g_return_val_if_fail (GST_IS_CAPS (yuv_caps), NULL);
+
+ video_caps = gst_caps_copy (yuv_caps);
+ for (i = 0; i < gst_caps_get_size (video_caps); i++) {
+ GstStructure *structure;
+ guint32 fourcc;
+ VdpChromaType chroma_type;
+
+ structure = gst_caps_get_structure (video_caps, i);
+ if (!gst_structure_has_name (structure, "video/x-raw-yuv"))
+ goto not_yuv_error;
+
+ if (!gst_structure_get_fourcc (structure, "format", &fourcc))
+ goto no_format_error;
+
+ chroma_type = -1;
+ for (i = 0; i < G_N_ELEMENTS (formats); i++) {
+ if (formats[i].fourcc == fourcc) {
+ chroma_type = formats[i].chroma_type;
+ break;
+ }
+ }
+
+ if (chroma_type == -1)
+ goto no_chroma_error;
+
+ /* now we transform the caps */
+ gst_structure_set_name (structure, "video/x-vdpau-video");
+ gst_structure_remove_field (structure, "format");
+ gst_structure_set (structure, "chroma-type", G_TYPE_INT, chroma_type, NULL);
+ }
+
+ return video_caps;
+
+error:
+ gst_caps_unref (video_caps);
+ return NULL;
+
+not_yuv_error:
+ GST_WARNING ("The caps weren't of type \"video/x-raw-yuv\"");
+ goto error;
+
+no_format_error:
+ GST_WARNING ("The caps didn't have a \"fourcc\" field");
+ goto error;
+
+no_chroma_error:
+ GST_WARNING ("The caps had an invalid \"fourcc\" field");
+ goto error;
+
}
diff --git a/sys/vdpau/gstvdp/gstvdputils.h b/sys/vdpau/gstvdp/gstvdputils.h
index 7df4cd2..316cf8b 100644
--- a/sys/vdpau/gstvdp/gstvdputils.h
+++ b/sys/vdpau/gstvdp/gstvdputils.h
@@ -24,6 +24,7 @@
#include <gst/gst.h>
#include "gstvdpdevice.h"
-GstCaps *gst_vdp_video_to_output_caps (GstCaps *caps);
+GstCaps *gst_vdp_video_to_output_caps (GstCaps *video_caps);
+GstCaps *gst_vdp_yuv_to_video_caps (GstCaps * yuv_caps);
#endif /* _GST_VDP_UTILS_H_ */
diff --git a/sys/vdpau/gstvdp/gstvdpvideobuffer.c b/sys/vdpau/gstvdp/gstvdpvideobuffer.c
index 1d1883c..4f15798 100644
--- a/sys/vdpau/gstvdp/gstvdpvideobuffer.c
+++ b/sys/vdpau/gstvdp/gstvdpvideobuffer.c
@@ -279,65 +279,6 @@ gst_vdp_video_buffer_calculate_size (guint32 fourcc, gint width, gint height,
return TRUE;
}
-GstCaps *
-gst_vdp_video_buffer_parse_yuv_caps (GstCaps * yuv_caps)
-{
-
- GstCaps *video_caps;
- gint i;
-
- g_return_val_if_fail (GST_IS_CAPS (yuv_caps), NULL);
-
- video_caps = gst_caps_copy (yuv_caps);
- for (i = 0; i < gst_caps_get_size (video_caps); i++) {
- GstStructure *structure;
- guint32 fourcc;
- VdpChromaType chroma_type;
-
- structure = gst_caps_get_structure (video_caps, i);
- if (!gst_structure_has_name (structure, "video/x-raw-yuv"))
- goto not_yuv_error;
-
- if (!gst_structure_get_fourcc (structure, "format", &fourcc))
- goto no_format_error;
-
- chroma_type = -1;
- for (i = 0; i < G_N_ELEMENTS (formats); i++) {
- if (formats[i].fourcc == fourcc) {
- chroma_type = formats[i].chroma_type;
- break;
- }
- }
-
- if (chroma_type == -1)
- goto no_chroma_error;
-
- /* now we transform the caps */
- gst_structure_set_name (structure, "video/x-vdpau-video");
- gst_structure_remove_field (structure, "format");
- gst_structure_set (structure, "chroma-type", G_TYPE_INT, chroma_type, NULL);
- }
-
- return video_caps;
-
-error:
- gst_caps_unref (video_caps);
- return NULL;
-
-not_yuv_error:
- GST_WARNING ("The caps weren't of type \"video/x-raw-yuv\"");
- goto error;
-
-no_format_error:
- GST_WARNING ("The caps didn't have a \"fourcc\" field");
- goto error;
-
-no_chroma_error:
- GST_WARNING ("The caps had an invalid \"fourcc\" field");
- goto error;
-
-}
-
gboolean
gst_vdp_video_buffer_download (GstVdpVideoBuffer * video_buf,
GstBuffer * outbuf, guint32 fourcc, gint width, gint height)
diff --git a/sys/vdpau/gstvdp/gstvdpvideobuffer.h b/sys/vdpau/gstvdp/gstvdpvideobuffer.h
index 0699e73..1866b17 100644
--- a/sys/vdpau/gstvdp/gstvdpvideobuffer.h
+++ b/sys/vdpau/gstvdp/gstvdpvideobuffer.h
@@ -96,8 +96,6 @@ GstVdpVideoBuffer *gst_vdp_video_buffer_new (GstVdpDevice * device, VdpChromaTyp
GstCaps *gst_vdp_video_buffer_get_caps (gboolean filter, VdpChromaType chroma_type);
GstCaps *gst_vdp_video_buffer_get_allowed_caps (GstVdpDevice * device);
-GstCaps *gst_vdp_video_buffer_parse_yuv_caps (GstCaps *yuv_caps);
-
gboolean gst_vdp_video_buffer_calculate_size (guint32 fourcc, gint width, gint height, guint *size);
gboolean gst_vdp_video_buffer_download (GstVdpVideoBuffer *inbuf, GstBuffer *outbuf, guint32 fourcc, gint width, gint height);
gboolean gst_vdp_video_buffer_upload (GstVdpVideoBuffer *video_buf, GstBuffer *src_buf, guint fourcc, gint width, gint height);
diff --git a/sys/vdpau/gstvdpvideopostprocess.c b/sys/vdpau/gstvdpvideopostprocess.c
index 8311f28..4658f90 100644
--- a/sys/vdpau/gstvdpvideopostprocess.c
+++ b/sys/vdpau/gstvdpvideopostprocess.c
@@ -482,7 +482,7 @@ gst_vdp_vpp_sink_setcaps (GstPad * pad, GstCaps * caps)
if (!gst_structure_get_fourcc (structure, "format", &vpp->fourcc))
goto done;
vpp->native_input = FALSE;
- video_caps = gst_vdp_video_buffer_parse_yuv_caps (caps);
+ video_caps = gst_vdp_yuv_to_video_caps (caps);
if (!video_caps)
goto done;
@@ -493,7 +493,7 @@ gst_vdp_vpp_sink_setcaps (GstPad * pad, GstCaps * caps)
} else {
vpp->native_input = TRUE;
- video_caps = gst_caps_copy (caps);
+ video_caps = gst_caps_ref (caps);
if (vpp->vpool) {
g_object_unref (vpp->vpool);