GstVideoFilter *filter = GST_VIDEO_FILTER_CAST (trans);
vc = GST_VIDEO_CONVERT_CAST(trans);
- if (filter->out_info.finfo->format == GST_VIDEO_FORMAT_SN12 ) {
+ if (filter->in_info.finfo->format != filter->out_info.finfo->format &&
+ filter->out_info.finfo->format == GST_VIDEO_FORMAT_SN12) {
guint size;
GstStructure *config;
GstCaps *caps = NULL;
size = vinfo.size;
- if (caps) {
- vc->pool = gst_tizen_buffer_pool_new ();
- config = gst_buffer_pool_get_config (vc->pool);
+ if (!caps) {
+ GST_WARNING_OBJECT (vc, "Not using our internal pool and copying buffers for downstream");
+ return FALSE;
+ }
- gst_buffer_pool_config_set_params (config, caps, size, 4, 10);
- gst_buffer_pool_config_add_option (config, GST_BUFFER_POOL_OPTION_VIDEO_META);
- gst_buffer_pool_set_config (vc->pool, config);
+ GST_INFO_OBJECT (vc, "Creating Tizen buffer pool");
- if (!gst_buffer_pool_set_active (vc->pool, TRUE)) {
- gst_object_unref (vc->pool);
- vc->pool = NULL;
- GST_INFO ("Failed to activate internal pool");
- }
- } else {
- GST_ERROR("Not using our internal pool and copying buffers for downstream");
- return FALSE;
+ vc->pool = gst_tizen_buffer_pool_new ();
+ config = gst_buffer_pool_get_config (vc->pool);
+
+ gst_buffer_pool_config_set_params (config, caps, size, 4, 10);
+ gst_buffer_pool_config_add_option (config, GST_BUFFER_POOL_OPTION_VIDEO_META);
+ gst_buffer_pool_set_config (vc->pool, config);
+
+ if (!gst_buffer_pool_set_active (vc->pool, TRUE)) {
+ gst_object_unref (vc->pool);
+ vc->pool = NULL;
+ GST_WARNING_OBJECT (vc, "Failed to activate Tizen buffer pool");
}
}
- GST_DEBUG("[%s]Creating Tizen Buffer Pool", __FUNCTION__);
return GST_BASE_TRANSFORM_CLASS (parent_class)->decide_allocation (trans, query);
}
vc = GST_VIDEO_CONVERT_CAST (trans);
- if (filter->out_info.finfo->format == GST_VIDEO_FORMAT_SN12 ) {
- if (gst_buffer_pool_acquire_buffer (vc->pool, &buf, 0) != GST_FLOW_OK) {
- GST_ERROR("[%s] memory prepare failed.",__FUNCTION__);
- return GST_FLOW_ERROR;
- }
-
- if (input != buf)
- GST_BASE_TRANSFORM_CLASS (parent_class)->copy_metadata (trans, input, buf);
- *outbuf = buf;
+ if (!vc->pool)
+ return GST_BASE_TRANSFORM_CLASS (parent_class)->prepare_output_buffer(trans, input, outbuf);
- return GST_FLOW_OK;
+ if (gst_buffer_pool_acquire_buffer (vc->pool, &buf, 0) != GST_FLOW_OK) {
+ GST_ERROR_OBJECT (vc, "acquire buffer failed");
+ return GST_FLOW_ERROR;
}
- return GST_BASE_TRANSFORM_CLASS (parent_class)->prepare_output_buffer(trans, input, outbuf);
+
+ GST_DEBUG_OBJECT (vc, "acquired buffer %p", buf);
+
+ if (input != buf)
+ GST_BASE_TRANSFORM_CLASS (parent_class)->copy_metadata (trans, input, buf);
+
+ *outbuf = buf;
+
+ return GST_FLOW_OK;
}
#endif