openni2src: Check color format

This commit is contained in:
Sebastian Dröge 2013-12-03 14:53:24 +01:00
parent 4b3d2a1b09
commit 26bf14c9fd

View file

@ -327,15 +327,15 @@ gst_openni2_src_get_caps (GstBaseSrc * src, GstCaps * filter)
: gst_caps_ref (ni2src->gst_caps); : gst_caps_ref (ni2src->gst_caps);
} }
// If we are here, we need to compose the caps and return them. // If we are here, we need to compose the caps and return them.
if (ni2src->colorpixfmt != openni::PIXEL_FORMAT_RGB888)
return gst_caps_new_empty (); /* Uh oh, not RGB :? Not supported. */
if (ni2src->depth.isValid () && ni2src->color.isValid () && if (ni2src->depth.isValid () && ni2src->color.isValid () &&
ni2src->sourcetype == SOURCETYPE_BOTH) { ni2src->sourcetype == SOURCETYPE_BOTH
&& ni2src->colorpixfmt == openni::PIXEL_FORMAT_RGB888) {
format = GST_VIDEO_FORMAT_RGBA; format = GST_VIDEO_FORMAT_RGBA;
} else if (ni2src->depth.isValid () && ni2src->sourcetype == SOURCETYPE_DEPTH) { } else if (ni2src->depth.isValid () && ni2src->sourcetype == SOURCETYPE_DEPTH) {
format = GST_VIDEO_FORMAT_GRAY16_LE; format = GST_VIDEO_FORMAT_GRAY16_LE;
} else if (ni2src->color.isValid () && ni2src->sourcetype == SOURCETYPE_COLOR) { } else if (ni2src->color.isValid () && ni2src->sourcetype == SOURCETYPE_COLOR
&& ni2src->colorpixfmt == openni::PIXEL_FORMAT_RGB888) {
format = GST_VIDEO_FORMAT_RGB; format = GST_VIDEO_FORMAT_RGB;
} else { } else {
return gst_caps_new_empty (); return gst_caps_new_empty ();
@ -452,7 +452,8 @@ gst_openni2src_decide_allocation (GstBaseSrc * bsrc, GstQuery * query)
if (gst_query_find_allocation_meta (query, GST_VIDEO_META_API_TYPE, NULL)) { if (gst_query_find_allocation_meta (query, GST_VIDEO_META_API_TYPE, NULL)) {
GST_DEBUG_OBJECT (pool, "activate Video Meta"); GST_DEBUG_OBJECT (pool, "activate Video Meta");
gst_buffer_pool_config_add_option (config, GST_BUFFER_POOL_OPTION_VIDEO_META); gst_buffer_pool_config_add_option (config,
GST_BUFFER_POOL_OPTION_VIDEO_META);
} }
gst_buffer_pool_set_config (pool, config); gst_buffer_pool_set_config (pool, config);