summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndoni Morales Alastruey <ylatuya@gmail.com>2013-04-25 11:27:13 +0200
committerSebastian Dröge <sebastian.droege@collabora.co.uk>2013-05-20 13:31:02 +0200
commit5e09d616385c935c639ab15cabbbc5e8bbc484b9 (patch)
treef3020a7303d07cfe4e5172a6f8dd86f78c8029d2
parentc69f41d2997ba958fb14a6464ec673baca0c5634 (diff)
applemedia: use the best colorformat on each platform
This saves a colorspace conversion before the sink in OS X
-rw-r--r--sys/applemedia/vtdec.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/sys/applemedia/vtdec.c b/sys/applemedia/vtdec.c
index 2aed900aa..924e9a614 100644
--- a/sys/applemedia/vtdec.c
+++ b/sys/applemedia/vtdec.c
@@ -54,6 +54,16 @@ static gboolean gst_vtdec_sink_event (GstPad * pad, GstObject * parent,
static CMSampleBufferRef gst_vtdec_sample_buffer_from (GstVTDec * self,
GstBuffer * buf);
+#ifdef HAVE_IOS
+#define GST_VTDEC_VIDEO_FORMAT_STR "NV12"
+#define GST_VTDEC_VIDEO_FORMAT GST_VIDEO_FORMAT_NV12
+#define GST_VTDEC_CV_VIDEO_FORMAT kCVPixelFormatType_420YpCbCr8BiPlanarVideoRange
+#else
+#define GST_VTDEC_VIDEO_FORMAT_STR "UYVY"
+#define GST_VTDEC_VIDEO_FORMAT GST_VIDEO_FORMAT_UYVY
+#define GST_VTDEC_CV_VIDEO_FORMAT kCVPixelFormatType_422YpCbCr8
+#endif
+
static void
gst_vtdec_base_init (GstVTDecClass * klass)
{
@@ -95,7 +105,7 @@ gst_vtdec_base_init (GstVTDecClass * klass)
GST_PAD_SRC,
GST_PAD_ALWAYS,
gst_caps_new_simple ("video/x-raw",
- "format", G_TYPE_STRING, "NV12",
+ "format", G_TYPE_STRING, GST_VTDEC_VIDEO_FORMAT_STR,
"width", GST_TYPE_INT_RANGE, min_width, max_width,
"height", GST_TYPE_INT_RANGE, min_height, max_height,
"framerate", GST_TYPE_FRACTION_RANGE,
@@ -207,7 +217,7 @@ gst_vtdec_sink_setcaps (GstVTDec * self, GstCaps * caps)
{
GstStructure *structure;
CMFormatDescriptionRef fmt_desc = NULL;
- GstVideoFormat format = GST_VIDEO_FORMAT_NV12;
+ GstVideoFormat format = GST_VTDEC_VIDEO_FORMAT;
gint width, height;
gint fps_n, fps_d;
gint par_n, par_d;
@@ -409,7 +419,7 @@ gst_vtdec_create_session (GstVTDec * self, CMFormatDescriptionRef fmt_desc)
pb_attrs = CFDictionaryCreateMutable (NULL, 0, &kCFTypeDictionaryKeyCallBacks,
&kCFTypeDictionaryValueCallBacks);
gst_vtutil_dict_set_i32 (pb_attrs, kCVPixelBufferPixelFormatTypeKey,
- kCVPixelFormatType_420YpCbCr8BiPlanarVideoRange);
+ GST_VTDEC_CV_VIDEO_FORMAT);
gst_vtutil_dict_set_i32 (pb_attrs, kCVPixelBufferWidthKey,
self->vinfo.width);
gst_vtutil_dict_set_i32 (pb_attrs, kCVPixelBufferHeightKey,