#include "gstv4l2object.h"
#include "gst/gst-i18n-plugin.h"
#include <gst/glib-compat-private.h>
-#ifdef TIZEN_FEATURE_TBM_SUPPORT_FOR_V4L2_DECODER
+#ifdef TIZEN_FEATURE_V4L2_TBM_SUPPORT
#include <gst/allocators/gsttizenmemory.h>
-#endif /* TIZEN_FEATURE_TBM_SUPPORT_FOR_V4L2_DECODER */
+#endif /* TIZEN_FEATURE_V4L2_TBM_SUPPORT */
GST_DEBUG_CATEGORY_STATIC (v4l2bufferpool_debug);
GST_DEBUG_CATEGORY_STATIC (CAT_PERFORMANCE);
static void gst_v4l2_buffer_pool_release_buffer (GstBufferPool * bpool,
GstBuffer * buffer);
-#ifdef TIZEN_FEATURE_TBM_SUPPORT_FOR_V4L2_DECODER
+#ifdef TIZEN_FEATURE_V4L2_TBM_SUPPORT
typedef struct _GstV4l2TizenBuffer GstV4l2TizenBuffer;
struct _GstV4l2TizenBuffer {
int index;
g_mutex_unlock (&pool->buffer_lock);
+ gst_object_unref (pool);
+
g_free(tizen_buffer);
}
tizen_buffer->index = index;
tizen_buffer->v4l2_buffer = v4l2_buffer;
tizen_buffer->gst_buffer = gst_buffer_new ();
- tizen_buffer->v4l2_pool = v4l2_pool;
+ tizen_buffer->v4l2_pool = gst_object_ref (v4l2_pool);
memory = gst_tizen_allocator_alloc_surface (v4l2_pool->tallocator,
&v4l2_pool->obj->info, v4l2_pool->vallocator->groups[index]->surface, (gpointer)tizen_buffer,
return tizen_buffer;
}
-#endif /* TIZEN_FEATURE_TBM_SUPPORT_FOR_V4L2_DECODER */
+#endif /* TIZEN_FEATURE_V4L2_TBM_SUPPORT */
static gboolean
gst_v4l2_is_buffer_valid (GstBuffer * buffer, GstV4l2MemoryGroup ** out_group)
GstBufferPoolClass *pclass = GST_BUFFER_POOL_CLASS (parent_class);
GstV4l2Object *obj = pool->obj;
gint i;
-#ifdef TIZEN_FEATURE_TBM_SUPPORT_FOR_V4L2_DECODER
+#ifdef TIZEN_FEATURE_V4L2_TBM_SUPPORT
gint64 end_time = 0;
-#endif /* TIZEN_FEATURE_TBM_SUPPORT_FOR_V4L2_DECODER */
+#endif /* TIZEN_FEATURE_V4L2_TBM_SUPPORT */
if (!pool->streaming)
return;
-#ifdef TIZEN_FEATURE_TBM_SUPPORT_FOR_V4L2_DECODER
+#ifdef TIZEN_FEATURE_V4L2_TBM_SUPPORT
if (obj->tbm_output && !V4L2_TYPE_IS_OUTPUT(pool->obj->type)) {
g_mutex_lock (&pool->buffer_lock);
g_mutex_unlock (&pool->buffer_lock);
}
-#endif /* TIZEN_FEATURE_TBM_SUPPORT_FOR_V4L2_DECODER */
+#endif /* TIZEN_FEATURE_V4L2_TBM_SUPPORT */
switch (obj->mode) {
case GST_V4L2_IO_MMAP:
case GST_V4L2_IO_USERPTR:
GstVideoMeta *vmeta;
gsize size;
gint i;
-#ifdef TIZEN_FEATURE_TBM_SUPPORT_FOR_V4L2_DECODER
+#ifdef TIZEN_FEATURE_V4L2_TBM_SUPPORT
GstV4l2TizenBuffer *tizen_buffer = NULL;
-#endif /* TIZEN_FEATURE_TBM_SUPPORT_FOR_V4L2_DECODER */
+#endif /* TIZEN_FEATURE_V4L2_TBM_SUPPORT */
if ((res = gst_v4l2_buffer_pool_poll (pool, wait)) < GST_FLOW_OK)
goto poll_failed;
GST_BUFFER_OFFSET (outbuf) = group->buffer.sequence;
GST_BUFFER_OFFSET_END (outbuf) = group->buffer.sequence + 1;
-#ifdef TIZEN_FEATURE_TBM_SUPPORT_FOR_V4L2_DECODER
+#ifdef TIZEN_FEATURE_V4L2_TBM_SUPPORT
if (group->surface) {
tizen_buffer = gst_v4l2_tizen_buffer_new (outbuf, group->buffer.index, pool);
if (!tizen_buffer) {
}
outbuf = tizen_buffer->gst_buffer;
}
-#endif /* TIZEN_FEATURE_TBM_SUPPORT_FOR_V4L2_DECODER */
+#endif /* TIZEN_FEATURE_V4L2_TBM_SUPPORT */
done:
*buffer = outbuf;
gst_object_unref (pool->allocator);
pool->allocator = NULL;
-#ifdef TIZEN_FEATURE_TBM_SUPPORT_FOR_V4L2_DECODER
+#ifdef TIZEN_FEATURE_V4L2_TBM_SUPPORT
g_cond_clear (&pool->buffer_cond);
g_mutex_clear (&pool->buffer_lock);
if (pool->tallocator)
gst_object_unref (pool->tallocator);
pool->tallocator = NULL;
-#endif /* TIZEN_FEATURE_TBM_SUPPORT_FOR_V4L2_DECODER */
+#endif /* TIZEN_FEATURE_V4L2_TBM_SUPPORT */
if (pool->other_pool)
gst_object_unref (pool->other_pool);
pool->other_pool = NULL;
pool->obj = obj;
pool->can_poll_device = TRUE;
-#ifdef TIZEN_FEATURE_TBM_SUPPORT_FOR_V4L2_DECODER
+#ifdef TIZEN_FEATURE_V4L2_TBM_SUPPORT
pool->tallocator = gst_tizen_allocator_new ();
if (pool->tallocator == NULL)
goto allocator_failed;
g_mutex_init (&pool->buffer_lock);
g_cond_init (&pool->buffer_cond);
-#endif /* TIZEN_FEATURE_TBM_SUPPORT_FOR_V4L2_DECODER */
+#endif /* TIZEN_FEATURE_V4L2_TBM_SUPPORT */
pool->vallocator = gst_v4l2_allocator_new (GST_OBJECT (pool), obj);
if (pool->vallocator == NULL)
goto allocator_failed;
}
allocator_failed:
{
-#ifdef TIZEN_FEATURE_TBM_SUPPORT_FOR_V4L2_DECODER
+#ifdef TIZEN_FEATURE_V4L2_TBM_SUPPORT
if (pool->tallocator) {
gst_object_unref (pool->tallocator);
pool->tallocator = NULL;
}
-#endif /* TIZEN_FEATURE_TBM_SUPPORT_FOR_V4L2_DECODER */
+#endif /* TIZEN_FEATURE_V4L2_TBM_SUPPORT */
GST_ERROR_OBJECT (pool, "Failed to create V4L2 allocator");
gst_object_unref (pool);
return NULL;
if (GST_V4L2_IS_M2M (obj->device_caps))
goto eos;
}
-#ifdef TIZEN_FEATURE_TBM_SUPPORT_FOR_V4L2_DECODER
+#ifdef TIZEN_FEATURE_V4L2_TBM_SUPPORT
if (pool->obj->tbm_output && pool->obj->mode == GST_V4L2_IO_DMABUF) {
gst_buffer_unref (*buf);
*buf = tmp;
} else {
-#endif /* TIZEN_FEATURE_TBM_SUPPORT_FOR_V4L2_DECODER */
+#endif /* TIZEN_FEATURE_V4L2_TBM_SUPPORT */
ret = gst_v4l2_buffer_pool_copy_buffer (pool, *buf, tmp);
/* an queue the buffer again after the copy */
gst_v4l2_buffer_pool_release_buffer (bpool, tmp);
-#ifdef TIZEN_FEATURE_TBM_SUPPORT_FOR_V4L2_DECODER
+#ifdef TIZEN_FEATURE_V4L2_TBM_SUPPORT
}
-#endif /* TIZEN_FEATURE_TBM_SUPPORT_FOR_V4L2_DECODER */
+#endif /* TIZEN_FEATURE_V4L2_TBM_SUPPORT */
if (ret != GST_FLOW_OK)
goto copy_failed;