Fix build warnings

Debugging actual issues is needlessly hard when there are
tons of warnings.

Change-Id: I08d109bc7e541947a1bf2e34e2fc2a7b3b73596e
diff --git a/libs/gstimxcommon.c b/libs/gstimxcommon.c
index eb808b9..3244cc0 100644
--- a/libs/gstimxcommon.c
+++ b/libs/gstimxcommon.c
@@ -36,12 +36,12 @@
   int ret, fd;
 
   if (dmafd < 0)
-    return NULL;
+    return 0;
   
 #if LINUX_VERSION_CODE < KERNEL_VERSION(4, 14, 34)
   fd = open(dev_ion, O_RDWR);
   if(fd < 0) {
-    return NULL;
+    return 0;
   }
 
   struct ion_phys_dma_data data = {
@@ -58,7 +58,7 @@
   ret = ioctl(fd, ION_IOC_CUSTOM, &custom);
   close(fd);
   if (ret < 0)
-    return NULL;
+    return 0;
 
   return data.phys;
 #else
@@ -66,12 +66,12 @@
 
   ret = ioctl(dmafd, DMA_BUF_IOCTL_PHYS, &dma_phys);
   if (ret < 0)
-    return NULL;
+    return 0;
 
   return dma_phys.phys;
 #endif
 #else
-  return NULL;
+  return 0;
 #endif
 }
 
@@ -81,7 +81,7 @@
   int ret, fd;
 
   if (!vaddr)
-    return NULL;
+    return 0;
   
 #if LINUX_VERSION_CODE < KERNEL_VERSION(4, 14, 34)
   fd = open(dev_ion, O_RDWR);
@@ -103,13 +103,13 @@
   ret = ioctl(fd, ION_IOC_CUSTOM, &custom);
   close(fd);
   if (ret < 0)
-    return NULL;
+    return 0;
 
   return data.phys;
 #else
-  return NULL;
+  return 0;
 #endif
 #else
-  return NULL;
+  return 0;
 #endif
 }
diff --git a/plugins/compositor/gstimxcompositor.c b/plugins/compositor/gstimxcompositor.c
index 92d611b..5813fc4 100755
--- a/plugins/compositor/gstimxcompositor.c
+++ b/plugins/compositor/gstimxcompositor.c
@@ -772,14 +772,13 @@
 }
 
 static gboolean
-gst_imxcompositor_negotiated_caps (GstVideoAggregator * vagg, GstCaps * caps)
+gst_imxcompositor_negotiated_caps (GstAggregator * agg, GstCaps * caps)
 {
-  GstImxCompositor *imxcomp = (GstImxCompositor *) (vagg);
+  GstImxCompositor *imxcomp = (GstImxCompositor *) (agg);
   GstQuery *query;
   gboolean result = TRUE;
   GstStructure *config = NULL;
   guint size, num, min = 0, max = 0;
-  GstAggregator *agg = GST_AGGREGATOR (imxcomp);
 
   GST_DEBUG("negotiated caps: %" GST_PTR_FORMAT, caps);
 
@@ -933,8 +932,7 @@
 }
 
 static GstCaps *
-gst_imxcompositor_update_caps (GstVideoAggregator * vagg, GstCaps * caps,
-    GstCaps * filter)
+gst_imxcompositor_update_caps (GstVideoAggregator * vagg, GstCaps * caps)
 {
   GList *l;
   gint best_width = -1, best_height = -1;
@@ -1162,7 +1160,7 @@
   if (dmabuf_meta)
     drm_modifier = dmabuf_meta->drm_modifier;
 
-  GST_INFO_OBJECT (pad, "buffer modifier type %d", drm_modifier);
+  GST_INFO_OBJECT (pad, "buffer modifier type %ld", drm_modifier);
 
   if (drm_modifier == DRM_FORMAT_MOD_AMPHION_TILED)
     src->info.tile_type = IMX_2D_TILE_AMHPION;
diff --git a/plugins/videoconvert/gstimxvideoconvert.c b/plugins/videoconvert/gstimxvideoconvert.c
index f7644e7..5069deb 100755
--- a/plugins/videoconvert/gstimxvideoconvert.c
+++ b/plugins/videoconvert/gstimxvideoconvert.c
@@ -1383,7 +1383,7 @@
     dmabuf_meta->drm_modifier = 0;
   }
 
-  GST_INFO_OBJECT (imxvct, "buffer modifier type %d", drm_modifier);
+  GST_INFO_OBJECT (imxvct, "buffer modifier type %ld", drm_modifier);
 
   if (drm_modifier == DRM_FORMAT_MOD_AMPHION_TILED)
     src.info.tile_type = IMX_2D_TILE_AMHPION;
@@ -1510,7 +1510,7 @@
   if (!src.mem->paddr)
     src.mem->paddr = _get_cached_phyaddr (gst_buffer_peek_memory (input_frame->buffer, 0));
   if (!src.mem->user_data && src.fd[1])
-    src.mem->user_data = _get_cached_phyaddr (gst_buffer_peek_memory (input_frame->buffer, 1));
+    src.mem->user_data = (gpointer*)_get_cached_phyaddr (gst_buffer_peek_memory (input_frame->buffer, 1));
   if (!dst.mem->paddr)
     dst.mem->paddr = _get_cached_phyaddr (gst_buffer_peek_memory (out->buffer, 0));
 
@@ -1521,7 +1521,7 @@
     if (!_get_cached_phyaddr (gst_buffer_peek_memory (input_frame->buffer, 0)))
       _set_cached_phyaddr (gst_buffer_peek_memory (input_frame->buffer, 0), src.mem->paddr);
     if (src.fd[1] && !_get_cached_phyaddr (gst_buffer_peek_memory (input_frame->buffer, 1)))
-      _set_cached_phyaddr (gst_buffer_peek_memory (input_frame->buffer, 1), src.mem->user_data);
+      _set_cached_phyaddr (gst_buffer_peek_memory (input_frame->buffer, 1), (guint8*)src.mem->user_data);
     if (!_get_cached_phyaddr (gst_buffer_peek_memory (out->buffer, 0)))
       _set_cached_phyaddr (gst_buffer_peek_memory (out->buffer, 0), dst.mem->paddr);
 
diff --git a/plugins/vpu/gstvpu.c b/plugins/vpu/gstvpu.c
index c2454bc..a179f46 100644
--- a/plugins/vpu/gstvpu.c
+++ b/plugins/vpu/gstvpu.c
@@ -20,6 +20,7 @@
 #include "gstvpuenc.h"
 #include <gst/allocators/gstphysmemory.h>
 #include "gstimxcommon.h"
+#include "gstimx.h"
 
 gint
 gst_vpu_find_std (GstCaps * caps)
@@ -111,7 +112,7 @@
 
   for (i=0; i<g_list_length (gstbuffer_in_vpudec); i++) {
     buffer = g_list_nth_data (gstbuffer_in_vpudec, i);
-    GST_DEBUG ("gstbuffer index: %d get from list: %x\n", \
+    GST_DEBUG ("gstbuffer index: %d get from list: %p\n", \
         i, buffer);
     vpu_frame = &(vpuframebuffers[i]);
 
@@ -137,7 +138,7 @@
     }
 
     if (gst_is_phys_memory (gst_buffer_peek_memory (buffer, 0))) {
-      vpu_frame->pbufY = gst_phys_memory_get_phys_addr(gst_buffer_peek_memory (buffer, 0));
+      vpu_frame->pbufY = (guchar*)gst_phys_memory_get_phys_addr(gst_buffer_peek_memory (buffer, 0));
       GST_DEBUG ("video buffer phys add: %p", vpu_frame->pbufY);
     } else {
       mem_block = gst_buffer_query_phymem_block (buffer);
diff --git a/plugins/vpu/gstvpuallocator.c b/plugins/vpu/gstvpuallocator.c
index 68e6f25..e8edd2b 100755
--- a/plugins/vpu/gstvpuallocator.c
+++ b/plugins/vpu/gstvpuallocator.c
@@ -59,7 +59,7 @@
 	VpuDecRetCode ret;
 	VpuMemDesc mem_desc;
 
-	GST_DEBUG_OBJECT(allocator, "vpu allocator malloc size: %d\n", memory->size);
+	GST_DEBUG_OBJECT(allocator, "vpu allocator malloc size: %zu\n", memory->size);
 	memset(&mem_desc, 0, sizeof(VpuMemDesc));
   // VPU allocate momory is page alignment, so it is ok align size to page.
   // V4l2 capture will check physical memory size when registry buffer.
@@ -71,7 +71,7 @@
 		memory->paddr        = (guint8 *)(mem_desc.nPhyAddr);
 		memory->vaddr         = (guint8 *)(mem_desc.nVirtAddr);
 		memory->caddr         = (guint8 *)(mem_desc.nCpuAddr);
-    GST_DEBUG_OBJECT(allocator, "vpu allocator malloc paddr: %x vaddr: %x\n", \
+    GST_DEBUG_OBJECT(allocator, "vpu allocator malloc paddr: %p vaddr: %p\n", \
         memory->paddr, memory->vaddr);
     return 0;
 	} else {
@@ -85,7 +85,7 @@
   VpuDecRetCode ret;
   VpuMemDesc mem_desc;
 
-	GST_DEBUG_OBJECT(allocator, "vpu allocator free size: %d\n", memory->size);
+	GST_DEBUG_OBJECT(allocator, "vpu allocator free size: %zu\n", memory->size);
   memset(&mem_desc, 0, sizeof(VpuMemDesc));
 	mem_desc.nSize     = memory->size;
 	mem_desc.nPhyAddr  = (unsigned long)(memory->paddr);
@@ -104,7 +104,7 @@
   VpuDecRetCode ret;
   VpuMemDesc mem_desc;
 
-  GST_DEBUG_OBJECT(allocator, "vpu allocator copy size: %d\n", src_mem->size);
+  GST_DEBUG_OBJECT(allocator, "vpu allocator copy size: %zu\n", src_mem->size);
   memset(&mem_desc, 0, sizeof(VpuMemDesc));
 
   if (size > src_mem->size - offset)
@@ -118,7 +118,7 @@
     dest_mem->paddr        = (guint8 *)(mem_desc.nPhyAddr);
     dest_mem->vaddr         = (guint8 *)(mem_desc.nVirtAddr);
     dest_mem->caddr         = (guint8 *)(mem_desc.nCpuAddr);
-    GST_DEBUG_OBJECT(allocator, "vpu allocator malloc paddr: %x vaddr: %x\n", \
+    GST_DEBUG_OBJECT(allocator, "vpu allocator malloc paddr: %p vaddr: %p\n", \
         dest_mem->paddr, dest_mem->vaddr);
 
     memcpy(dest_mem->vaddr, src_mem->vaddr+offset, size);
diff --git a/plugins/vpu/gstvpudec.c b/plugins/vpu/gstvpudec.c
index 482de8e..e623d6e 100755
--- a/plugins/vpu/gstvpudec.c
+++ b/plugins/vpu/gstvpudec.c
@@ -391,7 +391,7 @@
             const GValue *val;
             val = gst_value_list_get_value (vdrm_modifier, j);
             guint64 drm_modifier = g_value_get_uint64 (val);
-            GST_DEBUG_OBJECT (dec, "dmabuf meta has modifier: %lld", drm_modifier);
+            GST_DEBUG_OBJECT (dec, "dmabuf meta has modifier: %ld", drm_modifier);
             if (IS_AMPHION() && drm_modifier == DRM_FORMAT_MOD_AMPHION_TILED)
               dec->vpu_dec_object->drm_modifier = drm_modifier;
             else if (IS_HANTRO() && drm_modifier == DRM_FORMAT_MOD_VSI_G2_TILED_COMPRESSED
@@ -408,13 +408,13 @@
         } else if (meta = gst_structure_to_string (params)) {
           guint64 drm_modifier;
           GST_DEBUG_OBJECT (dec, "dmabuf meta has modifier: %s", meta);
-          sscanf (meta, "GstDmabufMeta, dmabuf.drm_modifier=(guint64){ %lld };", &drm_modifier);
-          GST_DEBUG_OBJECT (dec, "dmabuf meta has modifier: %lld", drm_modifier);
+          sscanf (meta, "GstDmabufMeta, dmabuf.drm_modifier=(guint64){ %lu };", &drm_modifier);
+          GST_DEBUG_OBJECT (dec, "dmabuf meta has modifier: %ld", drm_modifier);
           if (drm_modifier == DRM_FORMAT_MOD_AMPHION_TILED) {
-            GST_DEBUG_OBJECT (dec, "video sink support modifier: %lld", drm_modifier);
+            GST_DEBUG_OBJECT (dec, "video sink support modifier: %ld", drm_modifier);
             dec->vpu_dec_object->drm_modifier = drm_modifier;
           } else {
-            GST_WARNING_OBJECT (dec, "video sink can't support modifier: %lld",
+            GST_WARNING_OBJECT (dec, "video sink can't support modifier: %llu",
                 DRM_FORMAT_MOD_AMPHION_TILED);
           }
         }
@@ -455,7 +455,7 @@
 
     dec->vpu_dec_object->drm_modifier_pre = dec->vpu_dec_object->drm_modifier;
   }
-  GST_DEBUG_OBJECT (dec, "used modifier: %lld", dec->vpu_dec_object->drm_modifier);
+  GST_DEBUG_OBJECT (dec, "used modifier: %lu", dec->vpu_dec_object->drm_modifier);
 
   if (dec->vpu_dec_object->vpu_need_reconfig == FALSE
     && dec->vpu_dec_object->use_my_pool
diff --git a/plugins/vpu/gstvpudecobject.c b/plugins/vpu/gstvpudecobject.c
index 07ad86b..249cbfb 100644
--- a/plugins/vpu/gstvpudecobject.c
+++ b/plugins/vpu/gstvpudecobject.c
@@ -23,7 +23,9 @@
 #include <gst/video/gstvideometa.h>
 #include <gst/video/gstvideohdr10meta.h>
 #include "gstimxcommon.h"
+#include <gst/allocators/gstdmabufmeta.h>
 #include <gst/allocators/gstphymemmeta.h>
+#include <gst/allocators/gstphysmemory.h>
 #include "gstvpuallocator.h"
 #include "gstvpudecobject.h"
 
@@ -415,7 +417,7 @@
 {
   VpuDecRetCode dec_ret;
 
-  GST_INFO_OBJECT(vpu_dec_object, "Video decoder frames: %lld time: %lld fps: (%.3f).\n",
+  GST_INFO_OBJECT(vpu_dec_object, "Video decoder frames: %ld time: %ld fps: (%.3f).\n",
       vpu_dec_object->total_frames, vpu_dec_object->total_time, (gfloat)1000000
       * vpu_dec_object->total_frames / vpu_dec_object->total_time);
   if (vpu_dec_object->gstbuffer_in_vpudec != NULL) {
@@ -709,8 +711,8 @@
     g_hash_table_replace(vpu_dec_object->gstbuffer2frame_table, \
         (gpointer)(buffer), \
         (gpointer)(&(vpu_dec_object->vpuframebuffers[i])));
-    GST_DEBUG_OBJECT (vpu_dec_object, "VpuFrameBuffer: 0x%x VpuFrameBuffer pbufVirtY: 0x%x GstBuffer: 0x%x\n", \
-        vpu_dec_object->vpuframebuffers[i], vpu_dec_object->vpuframebuffers[i].pbufVirtY, buffer);
+    GST_DEBUG_OBJECT (vpu_dec_object, "VpuFrameBuffer: %p VpuFrameBuffer pbufVirtY: %p GstBuffer: %p\n", \
+        &vpu_dec_object->vpuframebuffers[i], vpu_dec_object->vpuframebuffers[i].pbufVirtY, buffer);
   }
 
   if (!IS_AMPHION()) {
@@ -823,7 +825,7 @@
   vpu_dec_object->min_buf_cnt = vpu_dec_object->init_info.nMinFrameBufferCount;
   vpu_dec_object->frame_size = vpu_dec_object->init_info.nFrameSize;
   vpu_dec_object->init_info.nBitDepth;
-  GST_INFO_OBJECT(vpu_dec_object, "video bit depth: %d", vpu_dec_object->init_info.nBitDepth);
+  GST_ERROR_OBJECT(vpu_dec_object, "video bit depth: %d min_buf_cnt %d", vpu_dec_object->init_info.nBitDepth, vpu_dec_object->min_buf_cnt);
   GST_VIDEO_INFO_INTERLACE_MODE(&(state->info)) = \
     vpu_dec_object->init_info.nInterlace ? GST_VIDEO_INTERLACE_MODE_INTERLEAVED \
     : GST_VIDEO_INTERLACE_MODE_PROGRESSIVE;
@@ -874,7 +876,7 @@
     vpu_dec_object->gstbuffer_in_vpudec2 = g_list_append ( \
         vpu_dec_object->gstbuffer_in_vpudec2, buffer);
     GST_DEBUG_OBJECT (vpu_dec_object, "gst_video_decoder_allocate_output_buffer end");
-    GST_DEBUG_OBJECT (vpu_dec_object, "gstbuffer get from buffer pool: %x\n", buffer);
+    GST_DEBUG_OBJECT (vpu_dec_object, "gstbuffer get from buffer pool: %p\n", buffer);
     GST_DEBUG_OBJECT (vpu_dec_object, "gstbuffer_in_vpudec list length: %d actual_buf_cnt: %d \n", \
         g_list_length (vpu_dec_object->gstbuffer_in_vpudec), vpu_dec_object->actual_buf_cnt);
   }
@@ -919,14 +921,14 @@
       vpu_dec_object->gstbuffer_in_vpudec, buffer);
   frame_buffer = g_hash_table_lookup(vpu_dec_object->gstbuffer2frame_table, buffer);
   if (!frame_buffer) {
-    GST_ERROR_OBJECT(vpu_dec_object, "buffer 0x%x not in gstbuffer2frame_table, "
+    GST_ERROR_OBJECT(vpu_dec_object, "buffer %p not in gstbuffer2frame_table, "
         "pool returned a newly allocated buffer which is not supported", buffer);
     return FALSE;
   }
   GST_DEBUG_OBJECT (vpu_dec_object, "gstbuffer_in_vpudec list length: %d\n", \
       g_list_length (vpu_dec_object->gstbuffer_in_vpudec));
 
-  GST_LOG_OBJECT (vpu_dec_object, "GstBuffer: 0x%x VpuFrameBuffer: 0x%x\n", \
+  GST_LOG_OBJECT (vpu_dec_object, "GstBuffer: %p VpuFrameBuffer: %p\n", \
       buffer, frame_buffer);
   dec_ret = VPU_DecOutFrameDisplayed(vpu_dec_object->handle, frame_buffer);
   if (dec_ret != VPU_DEC_RET_SUCCESS) {
@@ -947,7 +949,7 @@
 
   if (frame) {
     GstClockTimeDiff diff = gst_video_decoder_get_max_decode_time (bdec, frame);
-    GST_DEBUG_OBJECT(vpu_dec_object, "diff: %lld\n", diff);
+    GST_DEBUG_OBJECT(vpu_dec_object, "diff: %ld\n", diff);
     if (diff < 0) {
       if (vpu_dec_object->dropping == FALSE) { 
         GST_WARNING_OBJECT(vpu_dec_object, "decoder can't catch up. need drop frame.\n");
@@ -969,7 +971,7 @@
             gst_vpu_dec_object_strerror(ret));
         return FALSE;
       }
-      GST_WARNING_OBJECT(vpu_dec_object, "decoder can catch up. needn't drop frame. diff: %lld\n", \
+      GST_WARNING_OBJECT(vpu_dec_object, "decoder can catch up. needn't drop frame. diff: %ld\n", \
           diff);
       vpu_dec_object->dropping = FALSE;
     }
@@ -1005,14 +1007,14 @@
   g_list_free (l);
 #endif
 
-  frame_number = g_list_nth_data (vpu_dec_object->system_frame_number_in_vpu, 0);
+  frame_number = (gint)(guint64)g_list_nth_data (vpu_dec_object->system_frame_number_in_vpu, 0);
   GST_DEBUG_OBJECT(vpu_dec_object, "system frame number send out: %d list length: %d \n", \
       frame_number, g_list_length (vpu_dec_object->system_frame_number_in_vpu));
   vpu_dec_object->system_frame_number_in_vpu = g_list_remove ( \
-      vpu_dec_object->system_frame_number_in_vpu, frame_number);
+      vpu_dec_object->system_frame_number_in_vpu, (gpointer)(guint64)frame_number);
 
   out_frame = gst_video_decoder_get_frame (bdec, frame_number);
-  GST_LOG_OBJECT (vpu_dec_object, "gst_video_decoder_get_frame: 0x%x\n", \
+  GST_LOG_OBJECT (vpu_dec_object, "gst_video_decoder_get_frame: %p\n", \
       out_frame);
   if (out_frame && vpu_dec_object->frame_drop)
     gst_vpu_dec_object_process_qos (vpu_dec_object, bdec, out_frame);
@@ -1025,7 +1027,7 @@
       return GST_FLOW_ERROR;
     }
 
-    GST_LOG_OBJECT(vpu_dec_object, "vpu display buffer: 0x%x pbufVirtY: 0x%x\n", \
+    GST_LOG_OBJECT(vpu_dec_object, "vpu display buffer: %p pbufVirtY: %p\n", \
         out_frame_info.pDisplayFrameBuf, out_frame_info.pDisplayFrameBuf->pbufVirtY);
     output_pts = TSManagerSend2 (vpu_dec_object->tsm, \
         out_frame_info.pDisplayFrameBuf);
@@ -1113,7 +1115,7 @@
 
   if (vpu_dec_object->drm_modifier) {
     gst_buffer_add_dmabuf_meta(out_frame->output_buffer, vpu_dec_object->drm_modifier);
-    GST_DEBUG_OBJECT(vpu_dec_object, "add drm modifier: %lld\n", vpu_dec_object->drm_modifier);
+    GST_DEBUG_OBJECT(vpu_dec_object, "add drm modifier: %lu\n", vpu_dec_object->drm_modifier);
   }
 
   /* set physical memory padding info */
@@ -1261,7 +1263,7 @@
   gst_buffer_map (buffer, &minfo, GST_MAP_READ);
 
   if (buffer) {
-    GST_DEBUG_OBJECT (vpu_dec_object, "Chain in with size = %d", minfo.size);
+    GST_DEBUG_OBJECT (vpu_dec_object, "Chain in with size = %lu", minfo.size);
 
     if (G_UNLIKELY ((vpu_dec_object->new_segment))) {
       gdouble rate = bdec->input_segment.rate;
@@ -1322,7 +1324,7 @@
   }
 
   vpu_dec_object->system_frame_number_in_vpu = g_list_append ( \
-      vpu_dec_object->system_frame_number_in_vpu, frame->system_frame_number);
+      vpu_dec_object->system_frame_number_in_vpu, (gpointer)(guint64)frame->system_frame_number);
   GST_DEBUG_OBJECT (vpu_dec_object, "vpu_dec_object received system_frame_number: %d\n", \
       frame->system_frame_number);
 
@@ -1338,7 +1340,7 @@
     gst_buffer_map (buffer2, &minfo2, GST_MAP_READ);
     vpu_buffer_node->sCodecData.nSize = minfo2.size;
     vpu_buffer_node->sCodecData.pData = minfo2.data;
-    GST_DEBUG_OBJECT (vpu_dec_object, "codec data size: %d\n", minfo2.size);
+    GST_DEBUG_OBJECT (vpu_dec_object, "codec data size: %lu\n", minfo2.size);
     gst_buffer_unmap (buffer2, &minfo2);
   }
 
@@ -1379,7 +1381,7 @@
 	VpuBufferNode in_data = {0};
 	int buf_ret;
 
-  GST_LOG_OBJECT (vpu_dec_object, "GstVideoCodecFrame: 0x%x\n", frame);
+  GST_LOG_OBJECT (vpu_dec_object, "GstVideoCodecFrame: %p\n", frame);
   gst_vpu_dec_object_handle_input_time_stamp (vpu_dec_object, bdec, frame);
   gst_vpu_dec_object_set_vpu_input_buf (vpu_dec_object, frame, &in_data);
   if (frame)
@@ -1403,7 +1405,7 @@
       return GST_FLOW_ERROR;
     }
 
-    GST_DEBUG_OBJECT (vpu_dec_object, "buf status: 0x%x time: %lld\n", \
+    GST_DEBUG_OBJECT (vpu_dec_object, "buf status: 0x%x time: %ld\n", \
         buf_ret, g_get_monotonic_time () - start_time);
     vpu_dec_object->total_time += g_get_monotonic_time () - start_time;
 
diff --git a/plugins/vpu/gstvpuenc.c b/plugins/vpu/gstvpuenc.c
index 65f1ef6..7c8d618 100644
--- a/plugins/vpu/gstvpuenc.c
+++ b/plugins/vpu/gstvpuenc.c
@@ -41,6 +41,7 @@
 #include <gst/video/gstvideometa.h>
 #include <gst/video/gstvideopool.h>
 #include <gst/allocators/gstdmabuf.h>
+#include "gstimx.h"
 #include "gstimxcommon.h"
 #include "gstvpuallocator.h"
 #include "gstvpuenc.h"
@@ -510,7 +511,7 @@
 {
   GstVpuEnc *enc = (GstVpuEnc *) benc;
 
-  GST_INFO_OBJECT(enc, "Video encoder frames: %lld time: %lld fps: (%.3f).\n",
+  GST_INFO_OBJECT(enc, "Video encoder frames: %ld time: %ld fps: (%.3f).\n",
       enc->total_frames, enc->total_time, (gfloat)1000000 * enc->total_frames / enc->total_time);
 
   if (!gst_vpu_enc_reset (enc)) {
@@ -1010,7 +1011,7 @@
             fd[i] = gst_dmabuf_memory_get_fd (gst_buffer_peek_memory (frame->input_buffer, i));
           }
           if (fd[0] >= 0)
-            phys_ptr = phy_addr_from_fd (fd[0]);
+            phys_ptr = (unsigned char *) phy_addr_from_fd (fd[0]);
         } else {
           input_phys_buffer = gst_buffer_query_phymem_block (input_buffer);
           if (input_phys_buffer == NULL) {
@@ -1031,7 +1032,7 @@
 		/* this is needed for framebuffers registration below */
 		src_stride = plane_strides[0];
 
-		GST_TRACE_OBJECT(enc, "width: %d   height: %d   stride 0: %d   stride 1: %d   offset 0: %d   offset 1: %d   offset 2: %d", GST_VIDEO_INFO_WIDTH(&(enc->state->info)), GST_VIDEO_INFO_HEIGHT(&(enc->state->info)), plane_strides[0], plane_strides[1], plane_offsets[0], plane_offsets[1], plane_offsets[2]);
+		GST_TRACE_OBJECT(enc, "width: %d   height: %d   stride 0: %d   stride 1: %d   offset 0: %zu   offset 1: %zu   offset 2: %zu", GST_VIDEO_INFO_WIDTH(&(enc->state->info)), GST_VIDEO_INFO_HEIGHT(&(enc->state->info)), plane_strides[0], plane_strides[1], plane_offsets[0], plane_offsets[1], plane_offsets[2]);
 	}
 
   // Allocate needed physical buffer.
@@ -1110,7 +1111,7 @@
       }
 
       enc->total_time += g_get_monotonic_time () - start_time;
-      GST_DEBUG_OBJECT(enc, "encoder consume time: %lld\n", \
+      GST_DEBUG_OBJECT(enc, "encoder consume time: %zu\n", \
           g_get_monotonic_time () - start_time);
 
       if (enc_enc_param.eOutRetCode & VPU_ENC_OUTPUT_SEQHEADER) {
@@ -1131,7 +1132,7 @@
       }
 
       if (enc_enc_param.eOutRetCode & VPU_ENC_OUTPUT_DIS) {
-        GST_LOG_OBJECT(enc, "processing output data: %u bytes, output buffer offset %u", \
+        GST_LOG_OBJECT(enc, "processing output data: %u bytes, output buffer offset %zu", \
             enc_enc_param.nOutOutputSize, output_buffer_offset);
 
         gst_buffer_unmap (output_buffer, &minfo);
diff --git a/tools/gplay2/gplay2.c b/tools/gplay2/gplay2.c
index 55bbb06..8593d4f 100755
--- a/tools/gplay2/gplay2.c
+++ b/tools/gplay2/gplay2.c
@@ -1429,7 +1429,7 @@
           {
             gint64 pos = 0;
             pos = gst_player_get_position (player);
-            g_print ("Current playing position : %lld\n", pos);
+            g_print ("Current playing position : %ld\n", pos);
           }
             break;
 
@@ -1437,7 +1437,7 @@
           {
             gint64 duration = 0;
             duration = gst_player_get_duration (player);
-            g_print ("Duration : %lld\n", duration);
+            g_print ("Duration : %ld\n", duration);
           }
             break;
 
diff --git a/tools/grecorder/grecorder.c b/tools/grecorder/grecorder.c
index 1fec19f..0ec3401 100644
--- a/tools/grecorder/grecorder.c
+++ b/tools/grecorder/grecorder.c
@@ -24,6 +24,8 @@
 #include <pthread.h>
 #include <signal.h>
 #include <getopt.h>
+#include <unistd.h>
+#include <glib.h>
 #define __USE_LARGEFILE64
 #include <sys/statvfs.h>
 
@@ -37,7 +39,7 @@
 
 #define START_MEDIATIME_INFO_THREAD(thread, recorder)\
   do{\
-    if (thread == NULL){\
+    if (thread == 0){\
       exit_thread = RE_BOOLEAN_FALSE;\
       pthread_create(&(thread), NULL, display_media_time, (recorder));\
     }\
@@ -48,7 +50,7 @@
     if((thread && exit_thread == RE_BOOLEAN_FALSE)) {\
       exit_thread = RE_BOOLEAN_TRUE;\
       pthread_join ((thread), NULL);\
-      (thread)=NULL;\
+      (thread)=0;\
     }\
   }while(0)
 
@@ -65,7 +67,7 @@
 
 #define START_MESSAGE_PROCESS_THREAD(thread, recorder)\
   do{\
-    if (thread == NULL){\
+    if (thread == 0){\
       exit_thread = RE_BOOLEAN_FALSE;\
       pthread_create(&(thread), NULL, process_message, (recorder));\
     }\
@@ -77,7 +79,7 @@
       exit_thread = RE_BOOLEAN_TRUE;\
       sem_post(&grecordersem);\
       pthread_join ((thread), NULL);\
-      (thread)=NULL;\
+      (thread)=0;\
     }\
   }while(0)
 
@@ -157,8 +159,8 @@
   REboolean use_default_filename;
 }REOptions;
 
-static pthread_t media_time_thread = NULL;
-static pthread_t message_process_thread = NULL;
+static pthread_t media_time_thread = 0;
+static pthread_t message_process_thread = 0;
 static REboolean exit_thread = RE_BOOLEAN_FALSE;
 static REboolean bstartmediatime = RE_BOOLEAN_FALSE;
 static REchar path[1024];
@@ -168,6 +170,8 @@
 
 static volatile sig_atomic_t quit_flag = 0;
 
+static void post_message (RecorderMessage message);
+
 static void signal_handler(int signum)
 {
   quit_flag = 1;
@@ -197,7 +201,7 @@
   }
 }
 
-static void display_media_time (void* param)
+static void* display_media_time (void* param)
 {
   RecorderEngine* recorder = 	(RecorderEngine*)param;
   REtime sCur;
@@ -214,7 +218,7 @@
       {
         Hours = (sCur/1000000) / 3600;
         Minutes = (sCur/ (60*1000000)) % 60;
-        Seconds = ((sCur %(3600*1000000)) % (60*1000000))/1000000;
+        Seconds = ((sCur %(3600L*1000000L)) % (60*1000000))/1000000;
         printf("\r[Current Media Time] %03d:%02d:%02d", 
             Hours, Minutes, Seconds);
         fflush(stdout);
@@ -228,7 +232,7 @@
       usleep (50000);
   }
 
-  return;
+  return NULL;
 }
 
 static int set_recoder_setting (RecorderEngine *recorder, REOptions * pOpt)
@@ -476,13 +480,13 @@
   return 0;
 }
 
-void post_message (RecorderMessage message)
+static void post_message (RecorderMessage message)
 {
   latest_message = message;
   sem_post(&grecordersem);
 }
 
-static void process_message (void* param)
+static void* process_message (void* param)
 {
   RecorderEngine* recorder = 	(RecorderEngine*)param;
 
@@ -520,7 +524,7 @@
     }
   }
 
-  return;
+  return NULL;
 }
 
 static void list_camera_capabilities (RecorderEngine* recorder) 
@@ -544,7 +548,7 @@
   }
 }
 
-static int event_handler(void* context, REuint32 eventID, void* Eventpayload)
+static unsigned int event_handler(void* context, REuint32 eventID, void* Eventpayload)
 {
   RecorderEngine* recorder = (RecorderEngine*) context;
   switch(eventID) {
@@ -862,7 +866,9 @@
     {
       if (read_input){
         recorder_main_menu();
-        scanf("%128s", rep);
+        ret = scanf("%128s", rep);
+        if (ret)
+          ret = 0;
       }
       read_input=RE_BOOLEAN_TRUE;
       if (quit_flag) {
diff --git a/tools/grecorder/recorder_engine.c b/tools/grecorder/recorder_engine.c
index 771c419..2106f14 100644
--- a/tools/grecorder/recorder_engine.c
+++ b/tools/grecorder/recorder_engine.c
@@ -220,8 +220,8 @@
   int x_width;
   int x_height;
 
-  GString *filename;
-  GString *host;
+  gchar *filename;
+  gchar *host;
   gint port;
   gint max_files;
   gint64 max_file_size;
@@ -284,17 +284,17 @@
       gst_caps_unref (caps);
       break;
     case RE_OUTPUT_FORMAT_MKV:
-      caps = gst_caps_new_simple ("video/x-matroska", NULL);
+      caps = gst_caps_new_empty_simple ("video/x-matroska");
       container = gst_encoding_container_profile_new ("mkv", NULL, caps, NULL);
       gst_caps_unref (caps);
       break;
     case RE_OUTPUT_FORMAT_AVI:
-      caps = gst_caps_new_simple ("video/x-msvideo", NULL);
+      caps = gst_caps_new_empty_simple ("video/x-msvideo");
       container = gst_encoding_container_profile_new ("avi", NULL, caps, NULL);
       gst_caps_unref (caps);
       break;
     case RE_OUTPUT_FORMAT_FLV:
-      caps = gst_caps_new_simple ("video/x-flv", NULL);
+      caps = gst_caps_new_empty_simple ("video/x-flv");
       container = gst_encoding_container_profile_new ("flv", NULL, caps, NULL);
       gst_caps_unref (caps);
       break;
@@ -311,7 +311,7 @@
   switch (recorder->video_encoder_format) {
     case RE_VIDEO_ENCODER_DEFAULT:
     case RE_VIDEO_ENCODER_H264:
-        caps = gst_caps_new_simple ("video/x-h264", NULL);
+        caps = gst_caps_new_empty_simple ("video/x-h264");
         sprof = (GstEncodingProfile *)
           gst_encoding_video_profile_new (caps, NULL, NULL, 1);
         //FIXME: videorate has issue.
@@ -333,7 +333,7 @@
         gst_caps_unref (caps);
         break;
      case RE_VIDEO_ENCODER_H263:
-        caps = gst_caps_new_simple ("video/x-h263", NULL);
+        caps = gst_caps_new_empty_simple ("video/x-h263");
         sprof = (GstEncodingProfile *)
           gst_encoding_video_profile_new (caps, NULL, NULL, 1);
         //FIXME: videorate has issue.
@@ -343,7 +343,7 @@
         gst_caps_unref (caps);
         break;
      case RE_VIDEO_ENCODER_MJPEG:
-        caps = gst_caps_new_simple ("image/jpeg", NULL);
+        caps = gst_caps_new_empty_simple ("image/jpeg");
         sprof = (GstEncodingProfile *)
           gst_encoding_video_profile_new (caps, NULL, NULL, 1);
         //FIXME: videorate has issue.
@@ -353,7 +353,7 @@
         gst_caps_unref (caps);
         break;
     case RE_VIDEO_ENCODER_VP8:
-        caps = gst_caps_new_simple ("video/x-vp8", NULL);
+        caps = gst_caps_new_empty_simple ("video/x-vp8");
         sprof = (GstEncodingProfile *)
           gst_encoding_video_profile_new (caps, NULL, NULL, 1);
         //FIXME: videorate has issue.
@@ -490,7 +490,7 @@
         } else if (gst_structure_has_name (st, "facedetect")) {
           const GValue *value_list = gst_structure_get_value (st, "faces");
           REVideoRect object_pos;
-          GstStructure *str;
+          const GstStructure *str;
           gchar *sstr;
           guint i, n;
 
@@ -1173,7 +1173,7 @@
   if (recorder->mode == MODE_VIDEO) {
     if (recorder->video_sink) {
       const gchar *filename_suffix;
-      const gchar *filename_str;
+      gchar *filename_str;
       filename_suffix = strrchr(recorder->filename, '.');
       filename_str =
         g_strdup_printf ("%s%s%s", recorder->filename, "%05d", filename_suffix);
@@ -1645,7 +1645,7 @@
                 "format", G_TYPE_STRING, video_format_name,
                 NULL), NULL);
 
-      GST_INFO_OBJECT (recorder->camerabin, "camera output caps is %", 
+      GST_INFO_OBJECT (recorder->camerabin, "camera output caps is %"
           GST_PTR_FORMAT, recorder->camera_output_caps);
     } else {
       recorder->camera_output_caps = gst_caps_new_full (gst_structure_new ("video/x-raw",
@@ -2230,7 +2230,7 @@
     return ret;
   }
 
-  GST_DEBUG ("current media time: %lld", cur);
+  GST_DEBUG ("current media time: %ld", cur);
   *pMediaTimeUs = cur/1000 - recorder->base_media_timeUs;
 
   return ret;