int msc_remove_extract_request(const ms_comm_msg_s *recv_msg);
int msc_set_cancel_extract_item(const char* path, int pid);
void msc_set_extract_blocked_path(const char *blocked_path);
+void msc_send_power_off_request_to_extractor(void);
void msc_remove_folder_extract_request(ms_comm_msg_s *recv_msg);
#endif /*_MEDIA_SCANNER_EXTRACT_V2_H_*/
void msc_init_scanner(void);
void msc_deinit_scanner(void);
int msc_push_scan_request(ms_scan_type_e scan_type, ms_comm_msg_s *recv_msg);
+void msc_send_power_off_request(void);
void msc_remove_dir_scan_request(ms_comm_msg_s *recv_msg);
#endif /*_MEDIA_SCANNER_SCAN_V2_H_*/
#include "media-scanner-extract-v2.h"
GAsyncQueue *storage_extract_queue;
-GAsyncQueue *folder_extract_queue;
+static GAsyncQueue *folder_extract_queue;
static GMutex extract_req_mutex;
static GMutex extract_blocked_mutex;
static char *g_extract_blocked_path;
return res;
}
+void msc_send_power_off_request_to_extractor(void)
+{
+ ms_comm_msg_s *data = NULL;
+
+ if (storage_extract_queue) {
+ data = g_new0(ms_comm_msg_s, 1);
+
+ data->pid = POWEROFF;
+ g_async_queue_push(storage_extract_queue, data);
+ }
+
+ if (folder_extract_queue) {
+ data = g_new0(ms_comm_msg_s, 1);
+
+ data->pid = POWEROFF;
+ g_async_queue_push(folder_extract_queue, data);
+ }
+}
+
void msc_remove_folder_extract_request(ms_comm_msg_s *recv_msg)
{
int i = 0;
#define DIR_SCAN_NON_RECURSIVE 2
GAsyncQueue *storage_queue2;
-GAsyncQueue *scan_queue2;
-GAsyncQueue *reg_queue2;
+static GAsyncQueue *scan_queue2;
+static GAsyncQueue *reg_queue2;
static GMutex scan_req_mutex2;
static GMutex blocked_mutex2;
static GMutex storage_scan_mutex2;
return ret;
}
+void msc_send_power_off_request(void)
+{
+ ms_comm_msg_s *data = NULL;
+
+ if (scan_queue2) {
+ data = g_new0(ms_comm_msg_s, 1);
+
+ data->pid = POWEROFF;
+ msc_push_scan_request(MS_SCAN_DIRECTORY, data);
+ }
+
+ if (reg_queue2) {
+ data = g_new0(ms_comm_msg_s, 1);
+
+ data->pid = POWEROFF;
+ msc_push_scan_request(MS_SCAN_REGISTER, data);
+ }
+
+ if (storage_queue2) {
+ data = g_new0(ms_comm_msg_s, 1);
+
+ data->pid = POWEROFF;
+ msc_push_scan_request(MS_SCAN_STORAGE, data);
+ }
+}
+
void msc_remove_dir_scan_request(ms_comm_msg_s *recv_msg)
{
char *cancel_path = recv_msg->msg;
#define MSC_VCONF_KEY_SCANNER_POWEROFF_STATUS "db/mediascanner/poweroff_status"
-extern GAsyncQueue *storage_queue2;
-extern GAsyncQueue *scan_queue2;
-extern GAsyncQueue *reg_queue2;
-extern GAsyncQueue *storage_extract_queue;
-extern GAsyncQueue *folder_extract_queue;
-
static GMainLoop *scanner_mainloop2 = NULL;
static guint scanner_source_id2;
static void __msc_add_event_receiver(void *data);
static void __msc_remove_event_receiver(void);
-static void __push_power_off(GAsyncQueue *queue)
-{
- if (!queue)
- return;
-
- ms_comm_msg_s *_data = g_new0(ms_comm_msg_s, 1);
- _data->pid = POWEROFF;
-
- g_async_queue_push(queue, _data);
-}
-
static void __power_off_cb(void)
{
MS_DBG_ERR("POWER OFF CB Begin");
_msc_set_power_status(true);
- __push_power_off(scan_queue2);
- __push_power_off(reg_queue2);
- __push_power_off(storage_queue2);
- __push_power_off(storage_extract_queue);
- __push_power_off(folder_extract_queue);
+ msc_send_power_off_request();
+ msc_send_power_off_request_to_extractor();
g_source_remove(scanner_source_id2);