diff options
author | Nicolas Dechesne <nicolas.dechesne@linaro.org> | 2015-01-19 08:35:10 +0000 |
---|---|---|
committer | Nicolas Dechesne <nicolas.dechesne@linaro.org> | 2015-01-28 10:41:57 +0000 |
commit | 714ca030b2edf0be1c346782c9bc2b0203186d6e (patch) | |
tree | 1e40cd5c8abd6c4c606488f5a1952256f63b9087 | |
parent | 08c104612ee6662596f757baa312ef76d2d1c2bb (diff) |
gstqcvideodec: improve GST debug/log/info traces
* Try to use proper LOG level when appropriate
* Remove leading/trailing '\n'
Signed-off-by: Nicolas Dechesne <nicolas.dechesne@linaro.org>
-rw-r--r-- | src/gstqcvideodec.c | 225 |
1 files changed, 117 insertions, 108 deletions
diff --git a/src/gstqcvideodec.c b/src/gstqcvideodec.c index ffe4b31..5e2e00f 100644 --- a/src/gstqcvideodec.c +++ b/src/gstqcvideodec.c @@ -179,13 +179,13 @@ static GstFlowReturn gst_qcvideodec_finish(GstVideoDecoder *decoder) } if (ioctl(dec->video_driver_fd,VDEC_IOCTL_DECODE_FRAME,&ioctl_msg) < 0) { - GST_ERROR("\nVDEC_IOCTL_DECODE_FRAME Failed \n"); + GST_ERROR("VDEC_IOCTL_DECODE_FRAME Failed "); break; } GST_VIDEO_DECODER_STREAM_UNLOCK (dec); sem_wait(&dec->sem_input_buf_done); }/* for loop */ - GST_DEBUG("\ngst_qcvideodec_finish returned : Exit"); + GST_DEBUG("gst_qcvideodec_finish returned : Exit"); return GST_FLOW_OK; } @@ -200,7 +200,7 @@ static gboolean gst_qcvideodec_open (GstVideoDecoder * decoder) dec->m_vdec_ion_devicefd = open ("/dev/ion", O_RDONLY); if (dec->m_vdec_ion_devicefd < 0) { - GST_ERROR("\nERROR: ION Device open() Failed -------- \n"); + GST_ERROR("ION Device open() Failed"); return FALSE; } @@ -209,7 +209,7 @@ static gboolean gst_qcvideodec_open (GstVideoDecoder * decoder) if (dec->video_driver_fd < 0) { - GST_ERROR("\n ERROR : /dev/msm_vidc_dev Open failed ------\n"); + GST_ERROR("/dev/msm_vidc_dev Open failed"); return FALSE; } @@ -236,7 +236,7 @@ static gboolean gst_qcvideodec_open (GstVideoDecoder * decoder) if ( queue_ptr->ptr_cmdq == NULL || queue_ptr->ptr_dataq == NULL) { - GST_ERROR("\n ERROR : Not able to create Queue ------\n"); + GST_ERROR(" ERROR : Not able to create Queue ------"); return FALSE; } @@ -244,7 +244,7 @@ static gboolean gst_qcvideodec_open (GstVideoDecoder * decoder) if ( (pthread_create (&dec->videothread_id,NULL,video_thread,dec) < 0) || (pthread_create (&dec->asyncthread_id,NULL,async_thread,dec) < 0)) { - GST_ERROR("\n ERROR : Not able to create threads ------\n"); + GST_ERROR("Not able to create threads"); return FALSE; } @@ -267,7 +267,7 @@ static gboolean gst_qcvideodec_stop (GstVideoDecoder * decoder) if (ioctl(dec->video_driver_fd,VDEC_IOCTL_CMD_FLUSH, &ioctl_msg) < 0) { - GST_ERROR("\n Flush input failed"); + GST_ERROR("Flush input failed"); } else { @@ -281,23 +281,23 @@ static gboolean gst_qcvideodec_stop (GstVideoDecoder * decoder) if (ioctl(dec->video_driver_fd,VDEC_IOCTL_CMD_FLUSH, &ioctl_msg) < 0) { - GST_ERROR("\n Flush output failed"); + GST_ERROR("Flush output failed"); } else { sem_wait (&dec->sem_synchronize); } - GST_DEBUG("\n I/p and O/p ION buffers FLUSHED properly "); + GST_DEBUG("I/p and O/p ION buffers FLUSHED properly"); if (ioctl(dec->video_driver_fd,VDEC_IOCTL_CMD_STOP, NULL) < 0) { - GST_ERROR("\n Stop failed"); + GST_ERROR("Stop failed"); } else { sem_wait (&dec->sem_synchronize); - GST_DEBUG("\n VDEC driver STOPPED successfully\n"); + GST_DEBUG("VDEC driver STOPPED successfully"); } /* Release the buffers in the pool and then pool */ gst_buffer_pool_set_active(dec->bufpool,FALSE); @@ -341,9 +341,9 @@ static gboolean gst_qcvideodec_set_format (GstVideoDecoder * decoder,GstVideoCod gst_pad_set_caps (dec->srcpad, caps); gst_caps_unref (caps); - GST_DEBUG("\n gst_qcvideodec_set_format Enter: caps_data : %s \n",caps_data); - GST_DEBUG("\n gst_qcvideodec_set_format Enter: data_size : %d \n",minfo.size); - GST_DEBUG("\n gst_qcvideodec_set_format Enter: width : %d , Height : %d \n",Vinfo->width,Vinfo->height); + GST_DEBUG("gst_qcvideodec_set_format Enter: caps_data : %s ",caps_data); + GST_DEBUG("gst_qcvideodec_set_format Enter: data_size : %d ",minfo.size); + GST_DEBUG("gst_qcvideodec_set_format Enter: width : %d , Height : %d ",Vinfo->width,Vinfo->height); structure = gst_caps_get_structure (state->caps, 0); @@ -366,15 +366,15 @@ static gboolean gst_qcvideodec_set_format (GstVideoDecoder * decoder,GstVideoCod dec->decoder_format = VDEC_CODECTYPE_DIVX_6; break; default: - GST_ERROR("OUCH\n"); + GST_ERROR("OUCH"); } } else if (gst_structure_has_name(structure, "video/x-h264")) { dec->decoder_format = VDEC_CODECTYPE_H264; } else { - GST_ERROR("OUCH\n"); + GST_ERROR("OUCH"); } - GST_DEBUG("set_format decoder_format is %d\n", dec->decoder_format); + GST_DEBUG("set_format decoder_format is %d", dec->decoder_format); /*Initialize Decoder with codec type and resolution*/ ioctl_msg.in = &dec->decoder_format; @@ -383,7 +383,7 @@ static gboolean gst_qcvideodec_set_format (GstVideoDecoder * decoder,GstVideoCod if (ioctl (dec->video_driver_fd,VDEC_IOCTL_SET_CODEC, (void*)&ioctl_msg) < 0) { - GST_ERROR("\n Set codec type failed"); + GST_ERROR("Set codec type failed"); return FALSE; } @@ -394,7 +394,7 @@ static gboolean gst_qcvideodec_set_format (GstVideoDecoder * decoder,GstVideoCod if (ioctl (dec->video_driver_fd,VDEC_IOCTL_SET_OUTPUT_FORMAT, (void*)&ioctl_msg) < 0) { - GST_ERROR("\n Set output format failed"); + GST_ERROR("Set output format failed"); return FALSE; } @@ -408,7 +408,7 @@ static gboolean gst_qcvideodec_set_format (GstVideoDecoder * decoder,GstVideoCod if (ioctl (dec->video_driver_fd,VDEC_IOCTL_SET_PICRES, (void*)&ioctl_msg) < 0) { - GST_ERROR("\n Set Resolution failed"); + GST_ERROR("Set Resolution failed"); return FALSE; } @@ -420,11 +420,11 @@ static gboolean gst_qcvideodec_set_format (GstVideoDecoder * decoder,GstVideoCod if (ioctl (dec->video_driver_fd,VDEC_IOCTL_GET_BUFFER_REQ, (void*)&ioctl_msg) < 0) { - GST_ERROR("\n Requesting for input buffer requirements failed"); + GST_ERROR("Requesting for input buffer requirements failed"); return FALSE; } - GST_DEBUG("\n input Size=%d min count =%d actual count = %d, maxcount = %d,alignment = %d,buf_poolid= %d,meta_buffer_size=%d \n",\ + GST_DEBUG("input Size=%d min count =%d actual count = %d, maxcount = %d,alignment = %d,buf_poolid= %d,meta_buffer_size=%d ",\ dec->input_buffer.buffer_size,\ dec->input_buffer.mincount,\ dec->input_buffer.actualcount,\ @@ -442,7 +442,7 @@ static gboolean gst_qcvideodec_set_format (GstVideoDecoder * decoder,GstVideoCod if (ioctl (dec->video_driver_fd,VDEC_IOCTL_SET_BUFFER_REQ, (void*)&ioctl_msg) < 0) { - GST_ERROR("\n Set Buffer Requirements Failed"); + GST_ERROR("Set Buffer Requirements Failed"); return FALSE; } @@ -454,11 +454,11 @@ static gboolean gst_qcvideodec_set_format (GstVideoDecoder * decoder,GstVideoCod if (ioctl (dec->video_driver_fd,VDEC_IOCTL_GET_BUFFER_REQ, (void*)&ioctl_msg) < 0) { - GST_ERROR("\n Requesting for output buffer requirements failed"); + GST_ERROR("Requesting for output buffer requirements failed"); return FALSE; } - GST_DEBUG("\n output_buffer Size=%d min count =%d actual count = %d, maxcount = %d,alignment = %d,buf_poolid= %d,meta_buffer_size=%d\n",\ + GST_DEBUG("output_buffer Size=%d min count =%d actual count = %d, maxcount = %d,alignment = %d,buf_poolid= %d,meta_buffer_size=%d",\ dec->output_buffer.buffer_size,\ dec->output_buffer.mincount,\ dec->output_buffer.actualcount,\ @@ -472,13 +472,13 @@ static gboolean gst_qcvideodec_set_format (GstVideoDecoder * decoder,GstVideoCod if ((ion_allocate_buffer(VDEC_BUFFER_TYPE_INPUT, dec)== -1)) { - GST_ERROR("\n Error in input Buffer allocation"); + GST_ERROR("Error in input Buffer allocation"); return FALSE; } if ((ion_allocate_buffer(VDEC_BUFFER_TYPE_OUTPUT, dec)== -1)) { - GST_ERROR("\n Error in output Buffer allocation"); + GST_ERROR("Error in output Buffer allocation"); return FALSE; } if(dec->decoder_format == VDEC_CODECTYPE_H264) @@ -505,11 +505,11 @@ static gboolean gst_qcvideodec_set_format (GstVideoDecoder * decoder,GstVideoCod /*TODO: Time stamp needs to be updated*/ ioctl_msg.in = &frameinfo; ioctl_msg.out = NULL; - //GST_ERROR ("\n input frame Client Data address = %p and buff add : %p",frameinfo.client_data,frameinfo.bufferaddr); + //GST_ERROR ("input frame Client Data address = %p and buff add : %p",frameinfo.client_data,frameinfo.bufferaddr); if (ioctl (dec->video_driver_fd,VDEC_IOCTL_DECODE_FRAME, &ioctl_msg) < 0) { - GST_ERROR("\n Decoder frame failed"); + GST_ERROR("Decoder frame failed"); return FALSE; } sem_wait(&dec->sem_input_buf_done); @@ -566,12 +566,12 @@ static gboolean gst_qcvideodec_set_output_buffers (Gstqcvideodec * decoder) if (ioctl (dec->video_driver_fd, VDEC_IOCTL_FILL_OUTPUT_BUFFER,&ioctl_msg) < 0) { - GST_ERROR("\n Decoder frame failed"); + GST_ERROR("Decoder frame failed"); return FALSE; } index++; } - GST_DEBUG("\n output buffers set properly"); + GST_DEBUG("output buffers set properly"); return TRUE; } static gboolean gst_qcvideodec_start_decoder(Gstqcvideodec * decoder) @@ -588,11 +588,11 @@ static gboolean gst_qcvideodec_start_decoder(Gstqcvideodec * decoder) if (ioctl (dec->video_driver_fd,VDEC_IOCTL_CMD_START,NULL) < 0) { - GST_ERROR("\n Start failed"); + GST_ERROR("Start failed"); return FALSE; } - GST_DEBUG("\n Start Issued successfully waiting for Start Done"); + GST_DEBUG("Start Issued successfully waiting for Start Done"); /*Wait for Start command response*/ sem_wait (&dec->sem_synchronize); gst_qcvideodec_set_output_buffers (dec); @@ -609,7 +609,7 @@ static gboolean gst_qcvideodec_close (GstVideoDecoder *decoder) free_buffer(VDEC_BUFFER_TYPE_INPUT,dec); free_buffer(VDEC_BUFFER_TYPE_OUTPUT,dec); - GST_DEBUG("\n I/p and O/p ION freed successfully \n"); + GST_DEBUG("I/p and O/p ION freed successfully "); if (dec->queue_context.ptr_cmdq) { @@ -646,7 +646,7 @@ static gboolean gst_qcvideodec_close (GstVideoDecoder *decoder) sem_destroy (&dec->sem_synchronize); pthread_mutex_destroy(&dec->queue_context.mutex); - GST_DEBUG("\n ************ qcvideodec is closed and return *********** \n"); + GST_DEBUG("************ qcvideodec is closed and return *********** "); return TRUE; } @@ -656,7 +656,8 @@ static GstFlowReturn gst_qcvideodec_handle_frame (GstVideoDecoder *decoder_cxt,G GstFlowReturn res; Gstqcvideodec *dec = GST_QCVIDEODEC (decoder_cxt); GST_VIDEO_DECODER_STREAM_UNLOCK (decoder_cxt); - GST_DEBUG("\n gst_qcvideodec_handle_frame Enter with frame number : %d \n",frame->system_frame_number); + GST_DEBUG("gst_qcvideodec_handle_frame Enter with frame number : %d, TS: %"GST_TIME_FORMAT", system_frame_number: %d, distance: %d, count: %d", + frame->system_frame_number, GST_TIME_ARGS(frame->pts), frame->system_frame_number, frame->distance_from_sync, frame->ref_count); GST_VIDEO_DECODER_STREAM_LOCK (decoder_cxt); res = gst_qcvideodec_decode_buffer (dec, frame->input_buffer, frame); @@ -700,7 +701,7 @@ static GstFlowReturn gst_qcvideodec_decode_buffer(Gstqcvideodec *dec, GstBuffer if (ioctl(decode_context->video_driver_fd,VDEC_IOCTL_DECODE_FRAME, &ioctl_msg) < 0) { - GST_ERROR("\n Decoder frame failed"); + GST_ERROR("Decoder frame failed"); sem_post (&decode_context->sem_synchronize); return GST_FLOW_ERROR; } @@ -740,7 +741,7 @@ int free_buffer ( enum vdec_buffer buffer_dir,Gstqcvideodec *decoder_context) if (ioctl (dec->video_driver_fd, VDEC_IOCTL_FREE_BUFFER, &ioctl_msg) < 0) { - GST_ERROR("\n Release output buffer failed in VCD"); + GST_ERROR("Release output buffer failed in VCD"); } munmap ( ptemp [i].bufferaddr,ptemp [i].mmaped_size); @@ -765,19 +766,19 @@ int free_buffer ( enum vdec_buffer buffer_dir,Gstqcvideodec *decoder_context) munmap(h264_mv_buff.buffer, h264_mv_buff.size); if (close(dec->h264_mv.fd_ion_data.fd)) { - GST_ERROR("\n ION: close(%d) failed", + GST_ERROR("ION: close(%d) failed", dec->h264_mv.fd_ion_data.fd); } /* if(ioctl(dec->h264_mv.ion_device_fd,ION_IOC_FREE, &dec->h264_mv.ion_alloc_data.handle)) { - GST_ERROR("\n ION: free failed, dev_fd = %d, handle = 0x%p", + GST_ERROR("ION: free failed, dev_fd = %d, handle = 0x%p", dec->h264_mv.ion_device_fd, dec->h264_mv.ion_alloc_data.handle); }*/ dec->h264_mv.ion_device_fd = -1; dec->h264_mv.ion_alloc_data.handle = NULL; dec->h264_mv.fd_ion_data.fd = -1; - GST_DEBUG(" Cleaning H264_MV buffer of size %d",h264_mv_buff.size); + GST_DEBUG("Cleaning H264_MV buffer of size %d",h264_mv_buff.size); h264_mv_buff.pmem_fd = -1; h264_mv_buff.offset = 0; h264_mv_buff.size = 0; @@ -800,7 +801,7 @@ int free_buffer ( enum vdec_buffer buffer_dir,Gstqcvideodec *decoder_context) if (ioctl (dec->video_driver_fd, VDEC_IOCTL_FREE_BUFFER, &ioctl_msg) < 0) { - GST_ERROR("\n Release output buffer failed in VCD"); + GST_ERROR("Release output buffer failed in VCD"); } munmap ( ptemp [i].bufferaddr,ptemp [i].mmaped_size); ptemp [i].bufferaddr = NULL; @@ -835,7 +836,7 @@ static int ion_allocate_buffer (enum vdec_buffer buffer_dir,Gstqcvideodec *decod if ( decode_context == NULL) { - GST_ERROR ("\nallocate_buffer: context is NULL"); + GST_ERROR ("allocate_buffer: context is NULL"); return -1; } @@ -844,17 +845,17 @@ static int ion_allocate_buffer (enum vdec_buffer buffer_dir,Gstqcvideodec *decod /*Check if buffers are allocated*/ if (decode_context->ptr_inputbuffer != NULL) { - GST_ERROR ("\nallocate_buffer: decode_context->ptr_inputbuffer is set"); + GST_ERROR ("allocate_buffer: decode_context->ptr_inputbuffer is set"); return -1; } - /* GST_ERROR("\n Allocate i/p buffer Header: Cnt(%d) Sz(%d) \n", - decode_context->input_buffer.actualcount,decode_context->input_buffer.buffer_size); */ + GST_DEBUG("Allocate i/p buffer Header: Cnt(%d) Sz(%d) ", + decode_context->input_buffer.actualcount,decode_context->input_buffer.buffer_size); decode_context->ptr_inputbuffer = (struct vdec_bufferpayload *) \ calloc ((sizeof (struct vdec_bufferpayload)),decode_context->input_buffer.actualcount); if (decode_context->ptr_inputbuffer == NULL) { - GST_ERROR("\n ptr_inputbuffer allocated FAIL ---\n"); + GST_ERROR("ptr_inputbuffer allocated FAIL"); return -1; } decode_context->ip_buf_ion_info = (struct vdec_ion *) \ @@ -862,7 +863,7 @@ static int ion_allocate_buffer (enum vdec_buffer buffer_dir,Gstqcvideodec *decod if (decode_context->ip_buf_ion_info == NULL) { - GST_ERROR("\n ip_buf_ion_info allocated FAIL ---\n"); + GST_ERROR("ip_buf_ion_info allocated FAIL"); return -1; } for (i=0; i < decode_context->input_buffer.actualcount; i++) @@ -883,16 +884,16 @@ static int ion_allocate_buffer (enum vdec_buffer buffer_dir,Gstqcvideodec *decod rc = ioctl(fd,ION_IOC_ALLOC,alloc_data); if (rc || !alloc_data->handle) { - GST_ERROR("\n ION ALLOC failed, fd = %d, rc = %d, handle = 0x%p, " + GST_ERROR("ION ALLOC failed, fd = %d, rc = %d, handle = 0x%p, " "errno ", fd, rc, alloc_data->handle); alloc_data->handle = NULL; return -1; } - GST_DEBUG("ION memory allocated successfully \n"); + GST_LOG("ION memory allocated successfully "); fd_data->handle = alloc_data->handle; rc = ioctl(fd,ION_IOC_MAP,fd_data); if (rc) { - GST_ERROR("\n ION MAP failed, fd = %d, handle = 0x%p, errno =", + GST_ERROR("ION MAP failed, fd = %d, handle = 0x%p, errno =", fd, fd_data->handle); fd_data->fd = -1; return -1; @@ -906,7 +907,7 @@ static int ion_allocate_buffer (enum vdec_buffer buffer_dir,Gstqcvideodec *decod if (buf_addr == MAP_FAILED) { pmem_fd = -1; - GST_ERROR("\n Map Failed to allocate input buffer"); + GST_ERROR("Map Failed to allocate input buffer"); return -1; } decode_context->ptr_inputbuffer [i].bufferaddr = buf_addr; @@ -923,17 +924,17 @@ static int ion_allocate_buffer (enum vdec_buffer buffer_dir,Gstqcvideodec *decod if (ioctl (decode_context->video_driver_fd,VDEC_IOCTL_SET_BUFFER, &ioctl_msg) < 0) { - GST_ERROR("\n Set Buffers Failed"); + GST_ERROR("Set Buffers Failed"); return -1; } - GST_INFO("\ninput ion_alloc: buf_addr = %p, len = %d, size = %d, \n",\ + GST_DEBUG("input ion_alloc: buf_addr = %p, len = %d, size = %d, ",\ buf_addr,decode_context->input_buffer.buffer_size,decode_context->input_buffer.buffer_size); }/* for loop*/ - GST_DEBUG ("\nInput buffers ion_allocate_buffer: Success"); + GST_DEBUG("Input buffers ion_allocate_buffer: Success"); } /* VDEC_BUFFER_TYPE_INPUT */ if( buffer_dir == VDEC_BUFFER_TYPE_OUTPUT ) { - GST_INFO("\n\nAllocate o/p buffer Header: Cnt(%d) Sz(%d)",\ + GST_DEBUG("Allocate o/p buffer Header: Cnt(%d) Sz(%d)",\ decode_context->output_buffer.actualcount,\ decode_context->output_buffer.buffer_size); @@ -969,7 +970,7 @@ static int ion_allocate_buffer (enum vdec_buffer buffer_dir,Gstqcvideodec *decod rc = ioctl(fd,ION_IOC_ALLOC,alloc_data); if (rc || !alloc_data->handle) { - GST_ERROR("\n ION ALLOC failed, fd = %d, rc = %d, handle = 0x%p, " + GST_ERROR("ION ALLOC failed, fd = %d, rc = %d, handle = 0x%p, " "errno ", fd, rc, alloc_data->handle); alloc_data->handle = NULL; return -1; @@ -977,7 +978,7 @@ static int ion_allocate_buffer (enum vdec_buffer buffer_dir,Gstqcvideodec *decod fd_data->handle = alloc_data->handle; rc = ioctl(fd,ION_IOC_MAP,fd_data); if (rc) { - GST_ERROR("\n ION MAP failed, fd = %d, handle = 0x%p, errno", + GST_ERROR("ION MAP failed, fd = %d, handle = 0x%p, errno", fd, fd_data->handle); fd_data->fd = -1; return -1; @@ -991,7 +992,7 @@ static int ion_allocate_buffer (enum vdec_buffer buffer_dir,Gstqcvideodec *decod if (buf_addr == MAP_FAILED) { pmem_fd = -1; - GST_ERROR("\n Map Failed to allocate input buffer"); + GST_ERROR("Map Failed to allocate input buffer"); return -1; } decode_context->ptr_outputbuffer [i].bufferaddr = buf_addr; @@ -1008,14 +1009,14 @@ static int ion_allocate_buffer (enum vdec_buffer buffer_dir,Gstqcvideodec *decod if (ioctl (decode_context->video_driver_fd,VDEC_IOCTL_SET_BUFFER, &ioctl_msg) < 0) { - GST_ERROR("\n Set Buffers Failed"); + GST_ERROR("Set Buffers Failed"); return -1; } - GST_INFO("\noutput ion_alloc: buf_addr = %p, len = %d, size = %d, \n",\ + GST_INFO("output ion_alloc: buf_addr = %p, len = %d, size = %d, ",\ buf_addr,decode_context->output_buffer.buffer_size,decode_context->output_buffer.buffer_size); } /* for loop */ - GST_DEBUG ("\nprasanth --------- output ion_allocate_buffer: Success"); + GST_DEBUG("output ion_allocate_buffer: Success"); } /* VDEC_BUFFER_TYPE_OUTPUT */ return 1; } @@ -1043,18 +1044,18 @@ int vdec_alloc_h264_mv(Gstqcvideodec *decoder_cxt) if (ioctl (decode_context->video_driver_fd,VDEC_IOCTL_GET_MV_BUFFER_SIZE, (void*)&ioctl_msg) < 0) { - GST_ERROR("\n GET_MV_BUFFER_SIZE Failed for width: %d, Height %d" , + GST_ERROR("GET_MV_BUFFER_SIZE Failed for width: %d, Height %d" , mv_buff_size.width, mv_buff_size.height); return -1; } - GST_INFO("\nGET_MV_BUFFER_SIZE returned: Size: %d and alignment: %d",\ + GST_INFO("GET_MV_BUFFER_SIZE returned: Size: %d and alignment: %d",\ mv_buff_size.size, mv_buff_size.alignment); size = mv_buff_size.size * decode_context->output_buffer.actualcount; // alignment = mv_buff_size.alignment; - GST_INFO("\nEntered vdec_alloc_h264_mv act_width: %d, act_height: %d, size: %d, alignment %d",\ + GST_INFO("Entered vdec_alloc_h264_mv act_width: %d, act_height: %d, size: %d, alignment %d",\ decode_context->video_resoultion.frame_width, decode_context->video_resoultion.frame_height,size,mv_buff_size.alignment); struct ion_allocation_data *alloc_data = &decode_context->h264_mv.ion_alloc_data; @@ -1066,7 +1067,7 @@ int vdec_alloc_h264_mv(Gstqcvideodec *decoder_cxt) alloc_data->heap_mask = 0x2000000; rc = ioctl(fd,ION_IOC_ALLOC,alloc_data); if (rc || !alloc_data->handle) { - GST_ERROR("\n ION ALLOC failed, fd = %d, rc = %d, handle = 0x%p, " + GST_ERROR("ION ALLOC failed, fd = %d, rc = %d, handle = 0x%p, " "errno ", fd, rc, alloc_data->handle); alloc_data->handle = NULL; return -1; @@ -1074,7 +1075,7 @@ int vdec_alloc_h264_mv(Gstqcvideodec *decoder_cxt) fd_data->handle = alloc_data->handle; rc = ioctl(fd,ION_IOC_MAP,fd_data); if (rc) { - GST_ERROR("\n ION MAP failed, fd = %d, handle = 0x%p, errno =", + GST_ERROR("ION MAP failed, fd = %d, handle = 0x%p, errno =", fd, fd_data->handle); fd_data->fd = -1; return -1; @@ -1089,7 +1090,7 @@ int vdec_alloc_h264_mv(Gstqcvideodec *decoder_cxt) if (buf_addr == (void*) MAP_FAILED) { pmem_fd = -1; - GST_ERROR("Error returned in allocating recon buffers buf_addr: %p\n",buf_addr); + GST_ERROR("Error returned in allocating recon buffers buf_addr: %p",buf_addr); return -1; } GST_INFO("Allocated virt:%p, FD: %d of size %d count: %d", buf_addr, @@ -1105,7 +1106,7 @@ int vdec_alloc_h264_mv(Gstqcvideodec *decoder_cxt) if (ioctl (decode_context->video_driver_fd,VDEC_IOCTL_SET_H264_MV_BUFFER, (void*)&ioctl_msg) < 0) { - GST_ERROR("Failed to set the H264_mv_buffers\n"); + GST_ERROR("Failed to set the H264_mv_buffers"); return -1; } @@ -1138,11 +1139,11 @@ int allocate_reconfig_buff(Gstqcvideodec *dec) if (ioctl (decode_context->video_driver_fd,VDEC_IOCTL_GET_BUFFER_REQ, (void*)&ioctl_msg) < 0) { - GST_ERROR("\n 2nd time Requesting for output buffer requirements failed"); + GST_ERROR("2nd time Requesting for output buffer requirements failed"); return -1; } - GST_DEBUG("\n 2nd time output_buffer Size=%d min count =%d actual count = %d, maxcount = %d,alignment = %d,buf_poolid= %d,meta_buffer_size=%d\n\n",\ + GST_DEBUG("2nd time output_buffer Size=%d min count =%d actual count = %d, maxcount = %d,alignment = %d,buf_poolid= %d,meta_buffer_size=%d",\ decode_context->output_buffer.buffer_size,\ decode_context->output_buffer.mincount,\ decode_context->output_buffer.actualcount,\ @@ -1161,7 +1162,7 @@ int allocate_reconfig_buff(Gstqcvideodec *dec) if (ioctl (dec->video_driver_fd,VDEC_IOCTL_SET_BUFFER_REQ, (void*)&ioctl_msg) < 0) { - GST_ERROR("\n Set Buffer Requirements Failed"); + GST_ERROR("Set Buffer Requirements Failed"); return FALSE; } decode_context->output_buffer.buffer_type = VDEC_BUFFER_TYPE_OUTPUT; @@ -1171,10 +1172,10 @@ int allocate_reconfig_buff(Gstqcvideodec *dec) if (ioctl (decode_context->video_driver_fd,VDEC_IOCTL_GET_BUFFER_REQ, (void*)&ioctl_msg) < 0) { - GST_ERROR("\n 3rd time Requesting for output buffer requirements failed"); + GST_ERROR("3rd time Requesting for output buffer requirements failed"); return -1; } - GST_DEBUG("\n 3rd time output_buffer Size=%d min count =%d actual count = %d, maxcount = %d,alignment = %d,buf_poolid= %d,meta_buffer_size=%d\n\n",\ + GST_DEBUG("3rd time output_buffer Size=%d min count =%d actual count = %d, maxcount = %d,alignment = %d,buf_poolid= %d,meta_buffer_size=%d",\ decode_context->output_buffer.buffer_size,\ decode_context->output_buffer.mincount,\ decode_context->output_buffer.actualcount,\ @@ -1190,7 +1191,7 @@ int allocate_reconfig_buff(Gstqcvideodec *dec) if ((ion_allocate_buffer(VDEC_BUFFER_TYPE_OUTPUT, decode_context)== -1)) { - GST_ERROR("\n Error in output Buffer allocation"); + GST_ERROR("Error in output Buffer allocation"); return -1; } gst_qcvideodec_set_output_buffers(decode_context); @@ -1222,7 +1223,7 @@ gst_qc_video_dec_get_oldest_frame (GstVideoDecoder * decoder) } if (frame) { - GST_INFO("Oldest frame is %d %" GST_TIME_FORMAT " and %d frames left", + GST_LOG("Oldest frame is %d %" GST_TIME_FORMAT " and %d frames left", frame->system_frame_number, GST_TIME_ARGS (frame->pts), count - 1); gst_video_codec_frame_ref (frame); } @@ -1250,7 +1251,7 @@ static void* video_thread (void *context) if (decode_context == NULL) { - GST_ERROR("\n video thread recieved NULL context"); + GST_ERROR("video thread recieved NULL context"); return NULL; } @@ -1265,50 +1266,56 @@ static void* video_thread (void *context) switch (queueitem->cmd) { case VDEC_MSG_EVT_HW_ERROR: - GST_ERROR("\n FATAL ERROR "); + GST_ERROR("FATAL ERROR "); break; case VDEC_MSG_RESP_INPUT_FLUSHED: + GST_LOG("Received command: VDEC_MSG_RESP_INPUT_FLUSHED"); break; case VDEC_MSG_RESP_OUTPUT_FLUSHED: + GST_LOG("Received command: VDEC_MSG_RESP_OUTPUT_FLUSHED"); break; case VDEC_MSG_RESP_START_DONE: - GST_DEBUG("\n Recived start done command"); + GST_DEBUG("Received command: VDEC_MSG_RESP_START_DONE"); sem_post (&decode_context->sem_synchronize); break; case VDEC_MSG_RESP_STOP_DONE: + GST_DEBUG("Received command: VDEC_MSG_RESP_STOP_DONE"); sem_post (&decode_context->sem_synchronize); break; case VDEC_MSG_RESP_INPUT_BUFFER_DONE: + GST_LOG("Received command: VDEC_MSG_RESP_INPUT_BUFFER_DONE"); // GST_VIDEO_DECODER_STREAM_LOCK (decoder_cxt); temp_input_buffer = (struct vdec_bufferpayload *)queueitem->clientdata; if (temp_input_buffer == NULL) { - GST_ERROR("\n FATAL ERROR input buffer address is bad : %p",queueitem->clientdata); + GST_ERROR("Input buffer address is bad : %p",queueitem->clientdata); sem_post (&decode_context->sem_synchronize); // break; } /*To-do read the next frame*/ - GST_INFO("\nVDEC_MSG_RESP_INPUT_BUFFER_DONE Input buffer done for index "); + GST_LOG("VDEC_MSG_RESP_INPUT_BUFFER_DONE Input buffer done for index "); sem_post(&decode_context->sem_input_buf_done); // GST_VIDEO_DECODER_STREAM_LOCK (decoder_cxt); break; case VDEC_MSG_EVT_CONFIG_CHANGED: + GST_DEBUG("Received command: VDEC_MSG_EVT_CONFIG_CHANGED"); reconfig =1; - GST_DEBUG("\n Got VDEC_MSG_EVT_CONFIG_CHANGED \n"); ioctl_msg.in = &decode_context->output_buffer; ioctl_msg.out = NULL; if (ioctl(decode_context->video_driver_fd, VDEC_IOCTL_CMD_FLUSH, &ioctl_msg) < 0) { - GST_ERROR("\n Flush Port Failed "); + GST_ERROR("Flush Port Failed "); } (void)free_buffer(VDEC_BUFFER_TYPE_OUTPUT,decode_context); break; case VDEC_MSG_RESP_OUTPUT_BUFFER_DONE: + GST_LOG("Received command: VDEC_MSG_RESP_OUTPUT_BUFFER_DONE"); + GST_VIDEO_DECODER_STREAM_LOCK (decoder_cxt); outputbuffer = (struct vdec_output_frameinfo *)\ queueitem->clientdata; @@ -1316,13 +1323,13 @@ static void* video_thread (void *context) if (outputbuffer == NULL || outputbuffer->bufferaddr == NULL || outputbuffer->client_data == NULL ) { - GST_ERROR("\n FATAL ERROR output buffer is bad"); - GST_ERROR("\nValues outputbuffer = %p",outputbuffer); + GST_ERROR("Output buffer is bad"); + GST_ERROR("Values outputbuffer = %p",outputbuffer); if (outputbuffer != NULL) { - GST_ERROR("\nValues outputbuffer->bufferaddr = %p",\ + GST_ERROR("Values outputbuffer->bufferaddr = %p",\ outputbuffer->bufferaddr); - GST_ERROR("\nValues outputbuffer->client_data = %p",\ + GST_ERROR("Values outputbuffer->client_data = %p",\ outputbuffer->client_data); } sem_post (&decode_context->sem_synchronize); @@ -1333,13 +1340,13 @@ static void* video_thread (void *context) if (outputbuffer->len == 0) { Completed_frm_decode = TRUE; - g_print("\n -------------- Total decoded buffers are : %d -------------- \n",frm_count); + GST_INFO("Total decoded buffers are : %d", frm_count); sem_post (&decode_context->sem_synchronize); // break; } g_frame = gst_qc_video_dec_get_oldest_frame(GST_VIDEO_DECODER(decode_context)); // g_frame = gst_video_decoder_get_frame(GST_VIDEO_DECODER(decode_context),frm_count); - GST_DEBUG("\n VDEC_MSG_RESP_OUTPUT_BUFFER_DONE for the buffer index : %d and len : %d\n",frm_count,outputbuffer->len); + GST_DEBUG("VDEC_MSG_RESP_OUTPUT_BUFFER_DONE for the buffer index : %d and len : %d",frm_count,outputbuffer->len); if(g_frame != NULL) { /* ret = gst_video_decoder_allocate_output_frame(GST_VIDEO_DECODER(decode_context),g_frame); @@ -1369,14 +1376,15 @@ static void* video_thread (void *context) flow = gst_buffer_pool_acquire_buffer (decode_context->bufpool, &gst_local_buf, NULL); if (flow != GST_FLOW_OK) { - GST_DEBUG("\ngst_buffer_pool_acquire_buffer failed and GST_FLOW_Error \n"); + GST_ERROR("gst_buffer_pool_acquire_buffer failed and GST_FLOW_Error "); 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) - { - GST_DEBUG("\n finish_frame FAILED in video decoder \n"); + flow = gst_video_decoder_finish_frame(GST_VIDEO_DECODER(decode_context),g_frame); + if (flow != GST_FLOW_OK) + { + GST_ERROR("finish_frame FAILED in video decoder: %d", flow); } gst_buffer_unref(gst_local_buf); } @@ -1393,40 +1401,41 @@ static void* video_thread (void *context) if (ioctl (decode_context->video_driver_fd, VDEC_IOCTL_FILL_OUTPUT_BUFFER,&ioctl_msg) < 0) { - GST_ERROR("\n Decoder frame failed"); + GST_ERROR("Decoder frame failed"); return NULL; } GST_VIDEO_DECODER_STREAM_UNLOCK (decoder_cxt); break; case VDEC_MSG_RESP_FLUSH_INPUT_DONE: + GST_LOG("Received command: VDEC_MSG_RESP_FLUSH_INPUT_DONE"); sem_post (&decode_context->sem_synchronize); break; case VDEC_MSG_RESP_FLUSH_OUTPUT_DONE: - GST_DEBUG("\n -------------- Flush output complete -------------- "); + GST_LOG("Received command: VDEC_MSG_RESP_FLUSH_OUTPUT_DONE"); if(reconfig == 1) { allocate_reconfig_buff(decode_context); - GST_ERROR("\n ---------- reconfig set to 0 -----------------"); + GST_LOG("reconfig set to 0"); reconfig = 0; } else sem_post (&decode_context->sem_synchronize); break; default : - GST_ERROR("\n Video thread default case:: \n"); + GST_ERROR("Video thread default case, received: %d",queueitem->cmd); } if (queueitem->cmd == VDEC_MSG_RESP_STOP_DONE) { - GST_DEBUG(" \n -------------- video_thread is going to close -------------- \n"); + GST_INFO("Video_thread is going to close"); return NULL; } } else { - GST_ERROR("\n Error condition recieved NULL from Queue"); + GST_ERROR(" Error condition recieved NULL from Queue"); } } @@ -1445,7 +1454,7 @@ static void* async_thread (void *context) if (decode_context == NULL) { - GST_ERROR("\n aynsc thread recieved NULL context"); + GST_ERROR("aynsc thread recieved NULL context"); return NULL; } // decode_context = (struct video_decoder_context *) context; @@ -1458,11 +1467,11 @@ static void* async_thread (void *context) if (ioctl (decode_context->video_driver_fd,VDEC_IOCTL_GET_NEXT_MSG,\ (void*)&ioctl_msg) < 0) { - GST_ERROR("\n Error in ioctl read next msg"); + GST_ERROR(" Error in ioctl read next msg"); } else { - GST_INFO("\n\nasync_thread ioctl read next msg code : %d",vdec_msg.msgcode); + GST_LOG("async_thread ioctl received command : %d",vdec_msg.msgcode); switch (vdec_msg.msgcode) { case VDEC_MSG_RESP_FLUSH_INPUT_DONE: @@ -1505,7 +1514,7 @@ static void* async_thread (void *context) queueitem.clientdata = (void *)outputframe; break; default: - GST_DEBUG("\nIn Default of get next message %d",vdec_msg.msgcode); + GST_ERROR("In Default of get next message %d",vdec_msg.msgcode); queueitem.cmd = vdec_msg.msgcode; queueitem.status = vdec_msg.status_code; queueitem.clientdata = NULL; @@ -1520,13 +1529,13 @@ static void* async_thread (void *context) if (result == -1) { - GST_ERROR("\n FATAL ERROR WITH Queue"); + GST_ERROR(" FATAL ERROR WITH Queue"); } } if (vdec_msg.msgcode == VDEC_MSG_RESP_STOP_DONE) { /*Thread can exit at this point*/ - GST_INFO(" \n -------------- async_thread is going to close --------------\n"); + GST_LOG(" -------------- async_thread is going to close --------------"); return NULL; } } @@ -1541,7 +1550,7 @@ gst_qcvideodec_class_init (GstqcvideodecClass * klass) GstElementClass *gstelement_class = (GstElementClass *) klass; GstVideoDecoderClass *video_decoder_class = GST_VIDEO_DECODER_CLASS (klass); - GST_DEBUG("\nclass_init Enter\n"); + GST_DEBUG("class_init Enter"); gobject_class->set_property = gst_qcvideodec_set_property; gobject_class->get_property = gst_qcvideodec_get_property; @@ -1572,7 +1581,7 @@ gst_qcvideodec_class_init (GstqcvideodecClass * klass) GST_DEBUG_CATEGORY_INIT (gst_qcvideodec_debug, "mpeg4dec", 0, "QC MPEG-4 Video Decoder"); - GST_DEBUG("\nclass_init Exit\n"); + GST_DEBUG("class_init Exit"); } /* initialize the new element @@ -1583,7 +1592,7 @@ gst_qcvideodec_class_init (GstqcvideodecClass * klass) static void gst_qcvideodec_init (Gstqcvideodec * filter) { - GST_DEBUG("\nqcvideodec_init Enter ----\n"); + GST_DEBUG("qcvideodec_init Enter"); filter->sinkpad = gst_pad_new_from_static_template (&sink_factory, "qcsink"); GST_PAD_SET_PROXY_CAPS (filter->sinkpad); |