Removed compile warnings. 17/12017/4
authorKitae Kim <kt920.kim@samsung.com>
Mon, 11 Nov 2013 06:34:59 +0000 (15:34 +0900)
committerGerrit Code Review <gerrit@review.vlan103.tizen.org>
Tue, 12 Nov 2013 11:44:05 +0000 (03:44 -0800)
Modified deprecated g_mutex function and removed unused variables.

Change-Id: Ie3b63e8d66ea90fcd313709b60729ec8107a54ef
Signed-off-by: Kitae Kim <kt920.kim@samsung.com>
src/gstmaru.c
src/gstmaru.h
src/gstmarudec.c
src/gstmarudevice.c
src/gstmaruenc.c
src/gstmaruutils.c
src/gstmaruutils.h

index e524e00..81f472e 100644 (file)
@@ -56,15 +56,15 @@ gboolean gst_maruenc_register (GstPlugin *plugin, GList *element);
 
 static GList *codec_element = NULL;
 static gboolean codec_element_init = FALSE;
-static GStaticMutex gst_maru_mutex = G_STATIC_MUTEX_INIT;
+static GMutex gst_maru_mutex;
 
 static gboolean
 gst_maru_codec_element_init ()
 {
-  int fd = 0, size = 0;
+  int fd = 0;
   int version = 0;
-  int data_length = 0;
   int i, elem_cnt = 0;
+  uint32_t data_length = 0;
   void *buffer = NULL;
   CodecElement *elem = NULL;
 
@@ -138,16 +138,16 @@ plugin_init (GstPlugin *plugin)
 
   gst_maru_init_pix_fmt_info ();
 
-  g_static_mutex_lock (&gst_maru_mutex);
+  g_mutex_lock (&gst_maru_mutex);
   if (!codec_element_init) {
     if (!gst_maru_codec_element_init ()) {
-      g_static_mutex_unlock (&gst_maru_mutex);
+      g_mutex_unlock (&gst_maru_mutex);
 
       GST_ERROR ("failed to get codec elements from QEMU");
       return FALSE;
     }
   }
-  g_static_mutex_unlock (&gst_maru_mutex);
+  g_mutex_unlock (&gst_maru_mutex);
 
   if (!gst_marudec_register (plugin, codec_element)) {
     GST_ERROR ("failed to register decoder elements");
index 604d353..3ff33c7 100644 (file)
@@ -65,8 +65,8 @@ enum codec_log_level {
   } while (0)
 
 #define FF_INPUT_BUFFER_PADDING_SIZE  8
-#define FF_MAX_AUDIO_FRAME_SIZE     192000 // 1 second of 48khz 32bit audio
-#define FF_MIN_BUFFER_SIZE        16384
+#define FF_MAX_AUDIO_FRAME_SIZE       192000 // 1 second of 48khz 32bit audio
+#define FF_MIN_BUFFER_SIZE            16384
 
 #define GEN_MASK(x) ((1<<(x))-1)
 #define ROUND_UP_X(v, x) (((v) + GEN_MASK(x)) & ~GEN_MASK(x))
index 7f23ad3..26f60f4 100644 (file)
@@ -233,12 +233,12 @@ flush_queued (GstMaruDec *marudec)
 static void
 gst_marudec_drain (GstMaruDec *marudec)
 {
+#if 0
   GstMaruDecClass *oclass;
-
   oclass = (GstMaruDecClass *) (G_OBJECT_GET_CLASS (marudec));
+#endif
 
   CODEC_LOG (DEBUG, "drain frame\n");
-#if 1
   {
     gint have_data, len, try = 0;
 
@@ -253,7 +253,6 @@ gst_marudec_drain (GstMaruDec *marudec)
       }
     } while (try++ < 10);
   }
-#endif
 
   if (marudec->segment.rate < 0.0) {
     CODEC_LOG (DEBUG, "reverse playback\n");
@@ -979,6 +978,7 @@ gst_marudec_video_frame (GstMaruDec *marudec, guint8 *data, guint size,
   const GstTSInfo *out_info;
 
   decode = gst_marudec_do_qos (marudec, dec_info->timestamp, &mode_switch);
+  CODEC_LOG (DEBUG, "decode: %d\n", decode);
 
   CODEC_LOG (DEBUG, "decode video: input buffer size: %d\n", size);
   len =
@@ -1309,7 +1309,7 @@ gst_marudec_chain (GstPad *pad, GstBuffer *buffer)
   GstMaruDec *marudec;
   GstMaruDecClass *oclass;
   guint8 *in_buf;
-  gint in_size, len, have_data;
+  gint in_size, have_data;
   GstFlowReturn ret = GST_FLOW_OK;
   GstClockTime in_timestamp;
   GstClockTime in_duration;
@@ -1402,8 +1402,7 @@ gst_marudec_chain (GstPad *pad, GstBuffer *buffer)
 
   dec_info = in_info;
 
-  len =
-    gst_marudec_frame (marudec, in_buf, in_size, &have_data, dec_info, in_offset, &ret);
+  gst_marudec_frame (marudec, in_buf, in_size, &have_data, dec_info, in_offset, &ret);
 
 #if 0
   if (marudec->clear_ts) {
index ecd5326..ed5c852 100644 (file)
@@ -41,7 +41,7 @@
 #include "gstmaruinterface.h"
 #include "gstmarudevice.h"
 
-static GStaticMutex gst_avcodec_mutex = G_STATIC_MUTEX_INIT;
+static GMutex gst_avcodec_mutex;
 
 #define CODEC_DEVICE_MEM_SIZE 32 * 1024 * 1024
 
@@ -53,7 +53,6 @@ int
 gst_maru_codec_device_open (CodecDevice *dev, int media_type)
 {
   int fd;
-  void *mmapbuf;
 
   CODEC_LOG (DEBUG, "enter: %s\n", __func__);
 
@@ -73,18 +72,19 @@ gst_maru_codec_device_open (CodecDevice *dev, int media_type)
 
   CODEC_LOG (DEBUG, "before mmap. buf_size: %d\n", dev->buf_size);
 
-  g_static_mutex_lock (&gst_avcodec_mutex);
+  g_mutex_lock (&gst_avcodec_mutex);
   if (!device_mem) {
     device_mem = mmap (NULL, CODEC_DEVICE_MEM_SIZE, PROT_READ | PROT_WRITE,
         MAP_SHARED, fd, 0);
     if (device_mem == MAP_FAILED) {
       perror("Failed to map device memory of codec.");
       dev->buf = NULL;
+      g_mutex_unlock (&gst_avcodec_mutex);
       return -1;
     }
   }
   opened_cnt++;
-  g_static_mutex_unlock (&gst_avcodec_mutex);
+  g_mutex_unlock (&gst_avcodec_mutex);
 
   dev->buf = device_mem;
 
@@ -101,7 +101,6 @@ int
 gst_maru_codec_device_close (CodecDevice *dev)
 {
   int fd = 0;
-  void *mmapbuf = NULL;
 
   CODEC_LOG (DEBUG, "enter: %s\n", __func__);
 
@@ -113,7 +112,7 @@ gst_maru_codec_device_close (CodecDevice *dev)
 
   ioctl(fd, CODEC_CMD_RELEASE_BUFFER, &dev->mem_info.offset);
 
-  g_static_mutex_lock (&gst_avcodec_mutex);
+  g_mutex_lock (&gst_avcodec_mutex);
   opened_cnt--;
   if (!opened_cnt) {
     CODEC_LOG (INFO, "Release memory region of %p.\n", device_mem);
@@ -123,7 +122,7 @@ gst_maru_codec_device_close (CodecDevice *dev)
     }
   }
   device_mem = NULL;
-  g_static_mutex_unlock (&gst_avcodec_mutex);
+  g_mutex_unlock (&gst_avcodec_mutex);
 
   dev->buf = NULL;
 
@@ -150,9 +149,9 @@ gst_maru_avcodec_open (CodecContext *ctx,
     return -1;
   }
 
-  g_static_mutex_lock (&gst_avcodec_mutex);
+  g_mutex_lock (&gst_avcodec_mutex);
   ret = codec_init (ctx, codec, dev);
-  g_static_mutex_unlock (&gst_avcodec_mutex);
+  g_mutex_unlock (&gst_avcodec_mutex);
 
   return ret;
 }
@@ -164,9 +163,9 @@ gst_maru_avcodec_close (CodecContext *ctx, CodecDevice *dev)
 
   CODEC_LOG (DEBUG, "gst_maru_avcodec_close\n");
 
-  g_static_mutex_lock (&gst_avcodec_mutex);
+  g_mutex_lock (&gst_avcodec_mutex);
   codec_deinit (ctx, dev);
-  g_static_mutex_unlock (&gst_avcodec_mutex);
+  g_mutex_unlock (&gst_avcodec_mutex);
 
   ret = gst_maru_codec_device_close (dev);
 
index 4b09718..5bfcad2 100644 (file)
@@ -802,7 +802,7 @@ static GstFlowReturn
 gst_maruenc_chain_audio (GstPad *pad, GstBuffer *buffer)
 {
   GstMaruEnc *maruenc;
-  GstMaruEncClass *oclass;
+//  GstMaruEncClass *oclass;
   GstClockTime timestamp, duration;
   guint in_size, frame_size;
   gint osize;
@@ -813,7 +813,7 @@ gst_maruenc_chain_audio (GstPad *pad, GstBuffer *buffer)
   CodecContext *ctx;
 
   maruenc = (GstMaruEnc *) (GST_OBJECT_PARENT (pad));
-  oclass = (GstMaruEncClass *) G_OBJECT_GET_CLASS (maruenc);
+//  oclass = (GstMaruEncClass *) G_OBJECT_GET_CLASS (maruenc);
 
   ctx = maruenc->context;
 
index 1c4e483..cabdd07 100644 (file)
@@ -523,7 +523,9 @@ gst_maru_caps_with_codecname (const char *name, int media_type,
 }
 
 void
-gst_maru_caps_to_codecname (const GstCaps *caps, gchar *codec_name, CodecContext *context)
+gst_maru_caps_to_codecname (const GstCaps *caps,
+                            gchar *codec_name,
+                            CodecContext *context)
 {
   const gchar *mimetype;
   const GstStructure *str;
index 3b57176..2a7f6dd 100644 (file)
@@ -33,7 +33,7 @@
 
 #include "gstmaru.h"
 
-// FFmpeg
+// libav
 #include "audioconvert.h"
 
 /* Audio channel masks */
@@ -107,6 +107,8 @@ GstCaps *gst_maru_smpfmt_to_caps (int8_t sample_fmt, CodecContext *ctx, const ch
 
 GstCaps *gst_maru_codecname_to_caps (const char *name, CodecContext *ctx, gboolean encode);
 
+void gst_maru_caps_to_codecname (const GstCaps *caps, gchar *codec_name, CodecContext *context);
+
 void gst_maru_init_pix_fmt_info (void);
 
 int gst_maru_avpicture_size (int pix_fmt, int width, int height);