aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorprasanth kamuju <prasanth.kamuju@linaro.org>2015-01-21 15:48:19 +0530
committerprasanth kamuju <prasanth.kamuju@linaro.org>2015-01-21 15:48:19 +0530
commitbd0eaa1149d8a0c6252b05fff3cbd2005f0efe60 (patch)
treef04e79390c3c203f984746cd04b414488cd03ae3
parent5fcccd8a6c4c3c8c2766ec9f1a8fcfd539fec545 (diff)
gstqcvideodec:No of gstbuffers should be same as number of ion buffers
when the reconfig event comes from the driver, recreate the gstbuffers in the pool based on the h/w decoder requirement of actual buffes.
-rw-r--r--src/gstqcvideodec.c51
1 files changed, 30 insertions, 21 deletions
diff --git a/src/gstqcvideodec.c b/src/gstqcvideodec.c
index 1da046b..c346f94 100644
--- a/src/gstqcvideodec.c
+++ b/src/gstqcvideodec.c
@@ -134,6 +134,8 @@ static gboolean gst_qcvideodec_close (GstVideoDecoder * decoder);
static GstFlowReturn gst_qcvideodec_handle_frame (GstVideoDecoder * decoder,GstVideoCodecFrame * frame);
static GstFlowReturn gst_qcvideodec_finish (GstVideoDecoder * decoder);
//static GstFlowReturn gst_qcvideodec_parse(GstVideoDecoder *decoder,GstVideoCodecFrame *frame,GstAdapter *adapter,gboolean at_eos);
+static gboolean gst_qcvideodec_create_buf_pool(Gstqcvideodec * decoder);
+
static void* video_thread (void *);
static void* async_thread (void *);
@@ -319,7 +321,6 @@ static gboolean gst_qcvideodec_set_format (GstVideoDecoder * decoder,GstVideoCod
GstVideoInfo *Vinfo;
GstCaps *caps;
gchar *caps_data;
- GstStructure *config = NULL;
GstStructure *structure;
GstVideoFormat fmt = GST_VIDEO_FORMAT_NV12_64Z32;
@@ -484,25 +485,8 @@ static gboolean gst_qcvideodec_set_format (GstVideoDecoder * decoder,GstVideoCod
/* Create the pool start */
if(dec->bufpool == NULL)
{
- dec->bufpool = gst_qc_video_buffer_pool_new ();
- if(dec->bufpool == NULL)
- {
- GST_DEBUG("pool is NULL, No memory ");
- return FALSE;
- }
- Gstqcvideobufpool *pool = GST_QCVIDEOBUFPOOL(dec->bufpool);
- config = gst_buffer_pool_get_config (dec->bufpool);
-
- gst_buffer_pool_config_set_params (config, NULL, 0, dec->output_buffer.mincount,\
- dec->output_buffer.maxcount);
-
- gst_video_info_init(&(pool->info));
- gst_video_info_set_format (&(pool->info), fmt, Vinfo->width, Vinfo->height);
- gst_buffer_pool_config_add_option (config,GST_BUFFER_POOL_OPTION_VIDEO_META);
- gst_buffer_pool_set_config(dec->bufpool,config);
-
+ gst_qcvideodec_create_buf_pool(dec);
gst_buffer_pool_set_active(dec->bufpool,TRUE);
-
} //if(pool == NULL)
/* Create the pool End */
gst_qcvideodec_set_buffers (dec);
@@ -527,7 +511,28 @@ static gboolean gst_qcvideodec_set_format (GstVideoDecoder * decoder,GstVideoCod
sem_wait(&dec->sem_input_buf_done);
return TRUE;
}
+static gboolean gst_qcvideodec_create_buf_pool(Gstqcvideodec * decoder)
+{
+ decoder->bufpool = gst_qc_video_buffer_pool_new ();
+ if(decoder->bufpool == NULL)
+ {
+ GST_DEBUG("pool is NULL, No memory ");
+ return FALSE;
+ }
+ Gstqcvideobufpool *pool = GST_QCVIDEOBUFPOOL(decoder->bufpool);
+ GstStructure *config = gst_buffer_pool_get_config (decoder->bufpool);
+
+ gst_buffer_pool_config_set_params (config, NULL, 0, decoder->output_buffer.actualcount,\
+ decoder->output_buffer.maxcount);
+
+ gst_video_info_init(&(pool->info));
+ gst_video_info_set_format (&(pool->info), GST_VIDEO_FORMAT_NV12_64Z32, decoder->video_resoultion.frame_width, decoder->video_resoultion.frame_height);
+ gst_buffer_pool_config_add_option (config,GST_BUFFER_POOL_OPTION_VIDEO_META);
+ gst_buffer_pool_set_config(decoder->bufpool,config);
+
+ return TRUE;
+}
static gboolean gst_qcvideodec_set_buffers (Gstqcvideodec * decoder)
{
struct vdec_ioctl_msg ioctl_msg = {NULL,NULL};
@@ -1153,7 +1158,7 @@ int allocate_reconfig_buff(Gstqcvideodec *dec)
fillbuffer.buffer.pmem_fd =
decode_context->ptr_outputbuffer [i].pmem_fd;
fillbuffer.client_data = (void *)&decode_context->ptr_respbuffer[i];
- GST_INFO ("\n Client Data on output = %p and bufferaddr = %p",fillbuffer.client_data,decode_context->ptr_outputbuffer [i].bufferaddr);
+ GST_DEBUG("\n Client Data on output = %p and bufferaddr = %p",fillbuffer.client_data,decode_context->ptr_outputbuffer [i].bufferaddr);
ioctl_msg.in = &fillbuffer;
ioctl_msg.out = NULL;
@@ -1165,6 +1170,11 @@ int allocate_reconfig_buff(Gstqcvideodec *dec)
}
i++;
}
+ gst_buffer_pool_set_active(decode_context->bufpool,FALSE);
+ gst_object_unref(decode_context->bufpool);
+
+ gst_qcvideodec_create_buf_pool(decode_context);
+ gst_buffer_pool_set_active(decode_context->bufpool,TRUE);
return 1;
}
@@ -1309,7 +1319,6 @@ static void* video_thread (void *context)
GST_DEBUG("\ngst_buffer_pool_acquire_buffer failed and GST_FLOW_Error \n");
return NULL;
}
-
gst_buffer_insert_memory (gst_local_buf, -1, gst_dmabuf_allocator_alloc (derivedpool->allocator,(uint32_t) dec_output_buf->pmem_fd, outputbuffer->len));
g_frame->output_buffer = gst_local_buf;
if(gst_video_decoder_finish_frame(GST_VIDEO_DECODER(decode_context),g_frame) != GST_FLOW_OK)