/*=======================================================================================
| INCLUDE FILES |
========================================================================================*/
+#include <gio/gio.h>
#include <linux/magic.h>
+#include <storage.h>
#ifdef __cplusplus
| MACRO DEFINITIONS |
========================================================================================*/
#ifndef CLEAR
-#define CLEAR(x) memset (&(x), 0, sizeof (x))
+#define CLEAR(x) memset(&(x), 0, sizeof(x))
#endif
#define MMCAMCORDER_ADD_BUFFER_PROBE(x_pad, x_category, x_callback, x_hcamcorder) \
item->category = x_category; \
item->handler_id = gst_pad_add_probe(x_pad, GST_PAD_PROBE_TYPE_BUFFER, x_callback, x_hcamcorder, NULL); \
x_hcamcorder->buffer_probes = g_list_append(x_hcamcorder->buffer_probes, item); \
- _mmcam_dbg_log("Adding buffer probe on [%s:%s] - [ID : %lu], [Category : %x] ", GST_DEBUG_PAD_NAME(item->object), item->handler_id, item->category); \
+ _mmcam_dbg_log("Adding buffer probe on [%s:%s] - [ID : %lu], [Category : %x] ", \
+ GST_DEBUG_PAD_NAME(item->object), item->handler_id, item->category); \
} \
} while (0);
else if (x_category == 0 || !(x_category & _MMCAMCORDER_HANDLER_CATEGORY_ALL)) { \
_mmcam_dbg_err("Invalid handler category : %x \n", x_category); \
} else { \
- item->object =G_OBJECT(x_pad); \
+ item->object = G_OBJECT(x_pad); \
item->category = x_category; \
item->handler_id = gst_pad_add_probe(x_pad, GST_PAD_PROBE_TYPE_EVENT_BOTH, x_callback, x_hcamcorder, NULL); \
x_hcamcorder->event_probes = g_list_append(x_hcamcorder->event_probes, item); \
- _mmcam_dbg_log("Adding event probe on [%s:%s] - [ID : %lu], [Category : %x] ", GST_DEBUG_PAD_NAME(item->object), item->handler_id, item->category); \
+ _mmcam_dbg_log("Adding event probe on [%s:%s] - [ID : %lu], [Category : %x] ", \
+ GST_DEBUG_PAD_NAME(item->object), item->handler_id, item->category); \
} \
} while (0);
-#define MMCAMCORDER_SIGNAL_CONNECT( x_object, x_category, x_signal, x_callback, x_hcamcorder) \
+#define MMCAMCORDER_SIGNAL_CONNECT(x_object, x_category, x_signal, x_callback, x_hcamcorder) \
do { \
MMCamcorderHandlerItem* item = NULL; \
item = (MMCamcorderHandlerItem *) g_malloc(sizeof(MMCamcorderHandlerItem)); \
if (!item) { \
- _mmcam_dbg_err("Cannot connect signal [%s]\n", x_signal ); \
+ _mmcam_dbg_err("Cannot connect signal [%s]\n", x_signal); \
} else if (x_category == 0 || !(x_category & _MMCAMCORDER_HANDLER_CATEGORY_ALL)) { \
_mmcam_dbg_err("Invalid handler category : %x \n", x_category); \
} else { \
item->object = G_OBJECT(x_object); \
item->category = x_category; \
- item->handler_id = g_signal_connect(G_OBJECT(x_object), x_signal,\
- G_CALLBACK(x_callback), x_hcamcorder ); \
+ item->handler_id = g_signal_connect(G_OBJECT(x_object), x_signal, \
+ G_CALLBACK(x_callback), x_hcamcorder); \
x_hcamcorder->signals = g_list_append(x_hcamcorder->signals, item); \
- _mmcam_dbg_log("Connecting signal on [%s][%p] - [ID : %lu], [Category : %x] ", GST_OBJECT_NAME(item->object), item->object, item->handler_id, item->category); \
+ _mmcam_dbg_log("Connecting signal on [%s][%p] - [ID : %lu], [Category : %x] ", \
+ GST_OBJECT_NAME(item->object), item->object, item->handler_id, item->category); \
} \
} while (0);
#define MMCAMCORDER_G_OBJECT_GET(obj, name, value) \
do { \
if (obj) { \
- if(g_object_class_find_property(G_OBJECT_GET_CLASS(G_OBJECT(obj)), name)) { \
+ if (g_object_class_find_property(G_OBJECT_GET_CLASS(G_OBJECT(obj)), name)) { \
g_object_get(G_OBJECT(obj), name, value, NULL); \
} else { \
- _mmcam_dbg_warn ("The object doesn't have a property named(%s)", name); \
+ _mmcam_dbg_warn("The object doesn't have a property named(%s)", name); \
} \
} else { \
_mmcam_dbg_err("Null object"); \
} \
-} while(0);
+} while (0);
#define MMCAMCORDER_G_OBJECT_SET(obj, name, value) \
do { \
if (obj) { \
GParamSpec *spec = g_object_class_find_property(G_OBJECT_GET_CLASS(G_OBJECT(obj)), name);\
- if(spec) { \
+ if (spec) { \
if (spec->value_type == G_TYPE_INT64) {\
g_object_set(G_OBJECT(obj), name, (gint64)value, NULL); \
} else if (spec->value_type == G_TYPE_UINT64) { \
g_object_set(G_OBJECT(obj), name, value, NULL); \
} \
} else { \
- _mmcam_dbg_warn ("The object doesn't have a property named(%s)", name); \
+ _mmcam_dbg_warn("The object doesn't have a property named(%s)", name); \
} \
} else { \
_mmcam_dbg_err("Null object"); \
} \
-} while(0);
+} while (0);
#define MMCAMCORDER_G_OBJECT_SET_POINTER(obj, name, value) \
do { \
if (obj) { \
GParamSpec *spec = g_object_class_find_property(G_OBJECT_GET_CLASS(G_OBJECT(obj)), name);\
- if(spec) { \
+ if (spec) { \
g_object_set(G_OBJECT(obj), name, value, NULL); \
} else { \
- _mmcam_dbg_warn ("The object doesn't have a property named(%s)", name); \
+ _mmcam_dbg_warn("The object doesn't have a property named(%s)", name); \
} \
} else { \
_mmcam_dbg_err("Null object"); \
} \
-} while(0);
+} while (0);
-#define MMCAM_FOURCC(a,b,c,d) (guint32)((a)|(b)<<8|(c)<<16|(d)<<24)
+#define MMCAM_FOURCC(a, b, c, d) (guint32)((a)|(b)<<8|(c)<<16|(d)<<24)
#define MMCAM_FOURCC_ARGS(fourcc) \
- ((gchar)((fourcc)&0xff)), \
- ((gchar)(((fourcc)>>8)&0xff)), \
- ((gchar)(((fourcc)>>16)&0xff)), \
- ((gchar)(((fourcc)>>24)&0xff))
+ ((gchar)((fourcc)&0xff)), \
+ ((gchar)(((fourcc)>>8)&0xff)), \
+ ((gchar)(((fourcc)>>16)&0xff)), \
+ ((gchar)(((fourcc)>>24)&0xff))
#define MMCAM_SEND_MESSAGE(handle, msg_id, msg_code) \
{\
| ENUM DEFINITIONS |
========================================================================================*/
/**
+ * Structure of GDBus Callback.
+ */
+typedef struct {
+ GCond sync_cond;
+ GMutex sync_mutex;
+ int param;
+ int is_playing;
+ guint subscribe_id;
+ void *mm_handle;
+} _MMCamcorderGDbusCbInfo;
+
+/**
*Type define of util.
*/
typedef enum {
* Structure of message item
*/
typedef struct {
- MMHandleType handle; /**< handle */
- int id; /**< message id */
- MMMessageParamType param; /**< message parameter */
- pthread_mutex_t lock; /**< mutex for item */
+ MMHandleType handle; /**< handle */
+ int id; /**< message id */
+ MMMessageParamType param; /**< message parameter */
+ GMutex lock; /**< mutex for item */
} _MMCamcorderMsgItem;
+/**
+ * Structure of storage information
+ */
+typedef struct {
+ storage_type_e type;
+ int id;
+} _MMCamcorderStorageInfo;
+
/*=======================================================================================
| CONSTANT DEFINITIONS |
========================================================================================*/
+#define G_DBUS_TIMEOUT 3000
#define FAT32_FILE_SYSTEM_MAX_SIZE (4294967295UL) /* 4 GigaByte - 1 byte */
#define NANO_SEC_PER_MILI_SEC 1000000
#define _MMCAMCORDER_HANDLER_CATEGORY_ALL \
(_MMCAMCORDER_HANDLER_PREVIEW | _MMCAMCORDER_HANDLER_VIDEOREC |_MMCAMCORDER_HANDLER_STILLSHOT | _MMCAMCORDER_HANDLER_AUDIOREC)
-#define G_DBUS_REPLY_TIMEOUT (120 * 1000)
+
/*=======================================================================================
| GLOBAL FUNCTION PROTOTYPES |
void _mmcamcorder_element_release_noti(gpointer data, GObject *where_the_object_was);
gboolean _mmcamcorder_add_elements_to_bin(GstBin *bin, GList *element_list);
gboolean _mmcamcorder_link_elements(GList *element_list);
-gboolean _mmcamcorder_filtered_link_elements(GList *element_list, GstCaps *caps);
/* Message */
+#ifdef _MMCAMCORDER_ENABLE_IDLE_MESSAGE_CALLBACK
gboolean _mmcamcorder_msg_callback(void *data);
+#endif /* _MMCAMCORDER_ENABLE_IDLE_MESSAGE_CALLBACK */
gboolean _mmcamcorder_send_message(MMHandleType handle, _MMCamcorderMsgItem *data);
void _mmcamcorder_remove_message_all(MMHandleType handle);
/* JPEG encode */
gboolean _mmcamcorder_encode_jpeg(void *src_data, unsigned int src_width, unsigned int src_height,
- int src_format, unsigned int src_length, unsigned int jpeg_quality,
- void **result_data, unsigned int *result_length);
+ int src_format, unsigned int src_length, unsigned int jpeg_quality,
+ void **result_data, unsigned int *result_length);
/* resize */
gboolean _mmcamcorder_resize_frame(unsigned char *src_data, unsigned int src_width, unsigned int src_height, unsigned int src_length, int src_format,
- unsigned char **dst_data, unsigned int *dst_width, unsigned int *dst_height, unsigned int *dst_length);
+ unsigned char **dst_data, unsigned int *dst_width, unsigned int *dst_height, unsigned int *dst_length);
gboolean _mmcamcorder_downscale_UYVYorYUYV(unsigned char *src, unsigned int src_width, unsigned int src_height,
- unsigned char **dst, unsigned int dst_width, unsigned int dst_height);
+ unsigned char **dst, unsigned int dst_width, unsigned int dst_height);
/* Recording */
/* find top level tag only, do not use this function for finding sub level tags.
gint32 _mmcamcorder_double_to_fix(gdouble d_number);
gboolean _mmcamcorder_update_size(FILE *f, gint64 prev_pos, gint64 curr_pos);
gboolean _mmcamcorder_write_loci(FILE *f, _MMCamcorderLocationInfo info);
-gboolean _mmcamcorder_write_geodata(FILE *f,_MMCamcorderLocationInfo info);
+gboolean _mmcamcorder_write_geodata(FILE *f, _MMCamcorderLocationInfo info);
gboolean _mmcamcorder_write_udta(FILE *f, int gps_enable, _MMCamcorderLocationInfo info, _MMCamcorderLocationInfo geotag);
guint64 _mmcamcorder_get_container_size(const guchar *size);
guint64 _mmcamcorder_get_container_size64(const guchar *size);
gboolean _mmcamcorder_update_composition_matrix(FILE *f, int orientation);
/* File system */
-int _mmcamcorder_get_freespace(const gchar *path, const gchar *root_directory, guint64 *free_space);
+int _mmcamcorder_get_storage_info(const gchar *path, const gchar *root_directory, _MMCamcorderStorageInfo *storage_info);
+int _mmcamcorder_get_freespace(storage_type_e type, guint64 *free_space);
int _mmcamcorder_get_file_size(const char *filename, guint64 *size);
int _mmcamcorder_get_file_system_type(const gchar *path, int *file_system_type);
void *_mmcamcorder_util_task_thread_func(void *data);
/* device */
-int _mmcamcorder_get_device_flash_brightness(int *brightness);
+int _mmcamcorder_get_device_flash_brightness(GDBusConnection *conn, int *brightness);
+
+/* sound play via dbus*/
+int _mmcamcorder_send_sound_play_message(GDBusConnection *conn, _MMCamcorderGDbusCbInfo *gdbus_info,
+ const char *sample_name, const char *stream_role, const char *volume_gain, int sync_play);
+
+/* request to show pop-up related DPM policy */
+void _mmcamcorder_request_dpm_popup(GDBusConnection *conn, const char *restricted_policy);
+
+/* dbus signal emit */
+void _mmcamcorder_emit_dbus_signal(GDBusConnection *conn, const char *object_name,
+ const char *interface_name, const char *signal_name, int value);
+
+/* audio buffer */
+int _mmcamcorder_get_audiosrc_blocksize(int samplerate, int format, int channel, int interval, int *blocksize);
#ifdef __cplusplus
}