Modified deprecated g_mutex function and removed unused variables.
Change-Id: Ie3b63e8d66ea90fcd313709b60729ec8107a54ef
Signed-off-by: Kitae Kim <kt920.kim@samsung.com>
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;
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");
} 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))
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;
}
} while (try++ < 10);
}
-#endif
if (marudec->segment.rate < 0.0) {
CODEC_LOG (DEBUG, "reverse playback\n");
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 =
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;
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) {
#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
gst_maru_codec_device_open (CodecDevice *dev, int media_type)
{
int fd;
- void *mmapbuf;
CODEC_LOG (DEBUG, "enter: %s\n", __func__);
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;
gst_maru_codec_device_close (CodecDevice *dev)
{
int fd = 0;
- void *mmapbuf = NULL;
CODEC_LOG (DEBUG, "enter: %s\n", __func__);
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);
}
}
device_mem = NULL;
- g_static_mutex_unlock (&gst_avcodec_mutex);
+ g_mutex_unlock (&gst_avcodec_mutex);
dev->buf = NULL;
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;
}
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);
gst_maruenc_chain_audio (GstPad *pad, GstBuffer *buffer)
{
GstMaruEnc *maruenc;
- GstMaruEncClass *oclass;
+// GstMaruEncClass *oclass;
GstClockTime timestamp, duration;
guint in_size, frame_size;
gint osize;
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;
}
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;
#include "gstmaru.h"
-// FFmpeg
+// libav
#include "audioconvert.h"
/* Audio channel masks */
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);