OMX_ERRORTYPE
gst_omx_port_tbm_allocate_dec_buffers (GstOMXPort * port)
{
- guint n = 0;
+ gint i = 0;
gint num = 0;
- gint i = 0 , j = 0;
GList *buffers = NULL;
tbm_surface_h buffer[MAX_INPUT_BUFFER];
GstOMXComponent *comp;
gint i = 0;
gint num = 0;
GList *buffers = NULL;
- tbm_bo_handle handle_bo;
tbm_surface_h buffer[MAX_INPUT_BUFFER];
g_return_val_if_fail (port != NULL, OMX_ErrorUndefined);
g_mutex_lock (&port->comp->lock);
- /*deallocate previous allocated buffers...*/
+ /* deallocate previous allocated buffers... */
if (port->buffers)
gst_omx_port_deallocate_buffers (port);
if (port->use_buffer) {
for (i = 0; i < port->port_def.nBufferCountActual; i++) {
- buffer[i] = tbm_surface_internal_create_with_flags (port->port_def.format.video.nFrameWidth,
- port->port_def.format.video.nFrameHeight, TBM_FORMAT_NV12, TBM_BO_WC);
+
+ /* Since the input buffer is queued via OMX_EmptyThisBuffer(),
+ * a minimum amount of memory is sufficient.
+ */
+ buffer[i] = tbm_surface_internal_create_with_flags (128, 128, TBM_FORMAT_NV12, TBM_BO_WC);
+
if (!buffer[i]) {
g_mutex_unlock (&port->comp->lock);
goto error;
#include <OMX_Component.h>
#ifdef TIZEN_FEATURE_OMX
-#include <tbm_type.h>
-#include <tbm_surface.h>
-#include <tbm_bufmgr.h>
#include <unistd.h>
+#include <tbm_surface.h>
+#include <tbm_surface_internal.h>
+#include <gst/allocators/gstdmabuf.h>
+#include <gst/allocators/gsttizenmemory.h>
#endif
#ifdef USE_OMX_TARGET_RPI
#endif
#include "gstomxbufferpool.h"
-#ifdef TIZEN_FEATURE_OMX
-#include <gst/allocators/gsttizenmemory.h>
-#endif
GST_DEBUG_CATEGORY_STATIC (gst_omx_buffer_pool_debug_category);
#define GST_CAT_DEFAULT gst_omx_buffer_pool_debug_category
gpointer * data, gint * stride, GstMapFlags flags)
{
gint err;
- gint bo_idx;
tbm_surface_info_s surface_info;
GstBuffer *buffer = meta->buffer;
GstMemory *mem = gst_buffer_get_memory (buffer, 0);
GST_OBJECT_FLAG_SET (allocator, GST_ALLOCATOR_FLAG_CUSTOM_ALLOC);
}
+#ifndef TIZEN_FEATURE_OMX
static GstMemory *
gst_omx_memory_allocator_alloc (GstAllocator * allocator, GstMemoryFlags flags,
GstOMXBuffer * buf)
return GST_MEMORY_CAST (mem);
}
+#endif
/* Buffer pool for the buffers of an OpenMAX port.
*
#ifdef TIZEN_FEATURE_OMX
tbm_surface_h surface;
- GstMapInfo map;
uint32_t _offset = 0;
uint32_t _stride = 0;
surface = (tbm_surface_h) omx_buf->omx_buf->pBuffer;
- mem = gst_tizen_allocator_alloc_surface (pool->allocator, &pool->video_info, surface, omx_buf, _destroy_tbm_surface);
+ mem = gst_tizen_allocator_alloc_surface (pool->allocator, &pool->video_info, surface, omx_buf, (GDestroyNotify) _destroy_tbm_surface);
#else
mem = gst_omx_memory_allocator_alloc (pool->allocator, 0, omx_buf);
#endif
#ifdef TIZEN_FEATURE_OMX
GstBufferPool *gst_omx_buffer_pool_new (GstElement * element, GstOMXComponent * component, GstOMXPort * port,
GstOMXBufferMode output_mode);
+
+gboolean gst_omx_video_memory_map (GstVideoMeta * meta, guint plane, GstMapInfo * info,
+ gpointer * data, gint * stride, GstMapFlags flags);
+
+gboolean gst_omx_video_memory_unmap (GstVideoMeta * meta, guint plane, GstMapInfo * info);
#else
GstBufferPool *gst_omx_buffer_pool_new (GstElement * element, GstOMXComponent * component, GstOMXPort * port);
#endif
video_decoder_class->handle_frame =
GST_DEBUG_FUNCPTR (gst_omx_video_dec_handle_frame);
video_decoder_class->finish = GST_DEBUG_FUNCPTR (gst_omx_video_dec_finish);
- video_decoder_class->drain = GST_DEBUG_FUNCPTR (gst_omx_video_dec_drain);
video_decoder_class->decide_allocation =
GST_DEBUG_FUNCPTR (gst_omx_video_dec_decide_allocation);
config = gst_buffer_pool_get_config (self->out_port_pool);
#ifndef TIZEN_FEATURE_OMX
- if (add_videometa)
+ if (add_videometa)
#endif
+ /* FIXME : it doensn't get a list of options supported by pool */
+ GST_DEBUG_OBJECT (self, "Check if the pool supports option %d", add_videometa);
+
gst_buffer_pool_config_add_option (config,
- GST_BUFFER_POOL_OPTION_VIDEO_META);
+ GST_BUFFER_POOL_OPTION_VIDEO_META);
gst_buffer_pool_config_set_params (config, caps,
self->dec_out_port->port_def.nBufferSize, min, max);
#ifdef TIZEN_FEATURE_OMX
case GST_VIDEO_FORMAT_ST12:
case GST_VIDEO_FORMAT_SN12: {
+ tbm_surface_h surface;
GstMemory *mem = gst_buffer_peek_memory (inbuf, 0);
- outbuf->omx_buf->pBuffer = gst_tizen_memory_get_surface (mem);
- outbuf->omx_buf->nAllocLen = tbm_surface_internal_get_size (gst_tizen_memory_get_surface (mem));
- outbuf->omx_buf->nFilledLen = tbm_surface_internal_get_size (gst_tizen_memory_get_surface (mem));
+
+ if (!gst_is_tizen_memory (mem)) {
+ GST_ERROR_OBJECT (self, "Invalid input buffer");
+ ret = FALSE;
+ break;
+ }
+
+ if (!(surface = gst_tizen_memory_get_surface (mem))) {
+ GST_ERROR_OBJECT (self, "Failed to get surface from tizen memory");
+ ret = FALSE;
+ break;
+ }
+ outbuf->omx_buf->pBuffer = (OMX_U8 *) surface;
+ outbuf->omx_buf->nAllocLen = (OMX_U32) tbm_surface_internal_get_size (surface);
+ outbuf->omx_buf->nFilledLen = (OMX_U32) tbm_surface_internal_get_size (surface);
#ifdef CODEC_ENC_INPUT_DUMP
gst_omx_video_enc_input_dump (inbuf);
#endif
#include <gst/gst.h>
#include <gst/video/video.h>
#include <gst/video/gstvideoencoder.h>
-#include <tbm_bufmgr.h>
#include "gstomx.h"