#define KEY_NEXT "Next"
#define KEY_PREVIOUS "Previous"
#define KEY_EXIT "Exit"
+#define KEY_BACK "Escape"
+#define KEY_MENU "Super_L"
#endif /* __COMMON_H__ */
#include <media_content.h>
#include "common.h"
+#include <MediaContentDbListener.h>
-class CMediadata {
+class CMediadata : public CMediaContentDbUpdateListener {
private:
struct SMediadata* m;
private:
- static void sm_CbContentUpdate(media_content_error_e err, int pid,
- media_content_db_update_item_type_e update_item,
- media_content_db_update_type_e update_type,
- media_content_type_e media_type,
- char *uuid, char *path, char *mime_type,
- void *dt);
static bool sm_CbTotalDuration(media_info_h md_h, void *dt);
static bool sm_CbEachMediaData(media_info_h md_h, void *dt);
static bool sm_CbEachFolderData(media_folder_h folder_h, void *dt);
static bool sm_CbPlaylist(media_playlist_h ph, void *dt);
private:
- void m_HandleContentUpdate(media_content_error_e err, int pid,
- media_content_db_update_item_type_e update_item,
- media_content_db_update_type_e update_type,
- media_content_type_e media_type,
- char *uuid, char *path, char *mime_type);
bool m_HandleEachMediaData(media_info_h md_h);
bool m_HandleEachFolderData(media_folder_h folder_h);
bool m_HandleEachAlbumData(media_album_h album_h);
bool RemovemediaPlaylist(int lid, Eina_List *idlist);
static Eina_List *PlaylistsForCtxt(void);
+
+public:
+ virtual void OnUpdated(const SEntity *entity);
};
#endif /*__MEDIA_DATA_H__*/
#include <Eina.h>
-//#include <usb-device.h>
+#include <UsbConnectionListener.h>
struct SSongInfo;
struct album_info;
};
-class CMusicController {
+class CMusicController : public CUsbConnectionListener {
private:
static CMusicController *instance;
static int refCnt;
static void sm_CbPlaybackCompletion(void *data);
void m_OnPlaybackCompletion(void);
- //static void sm_CbConnected(usb_device_h usb_device, char *action, void *dt);
- //void m_OnConnected(usb_device_h usb_device, char *action);
-
protected:
bool t_PlayNext(int direction, int playnext_type);
SMusicController* t_Create(void);
bool MediaRemovemediaPlaylist(int id, Eina_List *idlist);
bool MediaAddsongsPlaylist(int lid, Eina_List *list);
struct SSongInfo *MediaSongByUri(char *uri);
+
+public:
+ virtual void OnConnect(void);
};
}
};
-void CMediadata::sm_CbContentUpdate(media_content_error_e err, int pid,
- media_content_db_update_item_type_e update_item,
- media_content_db_update_type_e update_type,
- media_content_type_e media_type,
- char *uuid, char *path, char *mime_type,
- void *dt)
-{
- CMediadata *root = (CMediadata *)dt;
-
- if (!root)
- return;
-
- root->m_HandleContentUpdate(err, pid, update_item, update_type, media_type, uuid, path, mime_type);
-}
-
bool CMediadata::sm_CbTotalDuration(media_info_h md_h, void *dt)
{
}
-void CMediadata::m_HandleContentUpdate(media_content_error_e err, int pid,
- media_content_db_update_item_type_e update_item,
- media_content_db_update_type_e update_type,
- media_content_type_e media_type,
- char *uuid, char *path, char *mime_type)
-{
- Eina_List *l = NULL;
- SCbInfo *cbinfo = NULL;
- void *obj = NULL;
-
- if (err != MEDIA_CONTENT_ERROR_NONE || !m)
- return;
-
- m->source_type = SOURCE_TYPE_NONE;
- EINA_LIST_FOREACH(m->cblist, l, obj) {
- cbinfo = (SCbInfo *)obj;
- if (cbinfo->type == E_CONTENT_UPDATE && cbinfo->cb)
- cbinfo->cb(cbinfo->data);
- }
-}
-
-
bool CMediadata::m_HandleEachMediaData(media_info_h md_h)
{
SSongInfo *sinfo = NULL;
return false;
}
- media_content_set_db_updated_cb(sm_CbContentUpdate, (void *)this);
+ CMediaContentDbUpdateListener::Create();
m->source_type = SOURCE_TYPE_NONE;
free(cbinfo);
}
- free(m);
-
- media_content_unset_db_updated_cb();
+ CMediaContentDbUpdateListener::Destroy();
r = media_content_disconnect();
if (r != MEDIA_CONTENT_ERROR_NONE)
_ERR("Media Content Connect Failed");
+ delete m;
}
return list;
}
+
+
+void CMediadata::OnUpdated(const SEntity *entity)
+{
+ Eina_List *l = NULL;
+ SCbInfo *cbinfo = NULL;
+ void *obj = NULL;
+
+ if (entity->err != MEDIA_CONTENT_ERROR_NONE || !m)
+ return;
+
+ m->source_type = SOURCE_TYPE_NONE;
+ EINA_LIST_FOREACH(m->cblist, l, obj) {
+ cbinfo = (SCbInfo *)obj;
+ if (cbinfo->type == E_CONTENT_UPDATE && cbinfo->cb)
+ cbinfo->cb(cbinfo->data);
+ }
+}
\ No newline at end of file
*/
#include <app.h>
#include <string.h>
-//#include <usb-device.h>
#include <AppCommon.h>
#include <stdlib.h>
#include "dbg.h"
}
}
-bool CMusicController::CheckUsb(void)
-{
- /*if (!m)
- return false;
-
- if (usb_get_connected_device_number(USB_MASS_STORAGE) <= 0)
- return false;
-
- return true;*/
- return false;
-}
-
-/*void CMusicController::sm_CbConnected(usb_device_h usb_device, char *action, void *dt)
-{
- CMusicController *root = (CMusicController*)dt;
- if (root)
- root->m_OnConnected(usb_device, action);
-}
-
-
-void CMusicController::m_OnConnected(usb_device_h usb_device, char *action)
-{
- Eina_List *l;
- struct SCbInfo *cbinfo;
- void *obj;
-
- if (SourceType() == SOURCE_TYPE_USB) {
- if (!CheckUsb())
- SetSourceType(SOURCE_TYPE_ALL);
- }
-
- EINA_LIST_FOREACH(m->elListener, l, obj) {
- cbinfo = (SCbInfo *)obj;
- if (cbinfo->type == E_USB_CONNECT && cbinfo->cb)
- cbinfo->cb(cbinfo->data);
- }
-}*/
static void _content_update_cb(void *dt)
{
_ERR(" playback create failed ");
if (!mhandle->pPlayback->SetCallback(sm_CbPlaybackCompletion, this))
- _ERR(" playback add completion callback failed");
+ _ERR(" playback add completion callback failed ");
mhandle->cbinfo = mhandle->pMediadata->AddCallback(E_CONTENT_UPDATE, _content_update_cb, mhandle);
- //usb_device_init();
- //usb_set_connected_cb(sm_CbConnected, this);
+ if (!CUsbConnectionListener::Create()) {
+ _ERR("CUsbConnectionListener::Create failed");
+ mhandle->pPlayback->Destroy();
+ mhandle->pMediadata->Destroy();
+ delete mhandle;
+ return NULL;
+ }
return mhandle;
}
struct SCbInfo *cbinfo;
void *obj;
+ CUsbConnectionListener::Destroy();
+
if (m->pPlayback->FlagCreate()) {
if (!m->pPlayback->UnsetCallback())
_ERR(" playback remove completion callback failed");
free(cbinfo);
}
- //usb_unset_connected_cb();
- //usb_device_fini();
-
delete m;
}
return true;
}
+
+
+void CMusicController::OnConnect(void)
+{
+ if (!m)
+ return;
+
+ Eina_List *l;
+ struct SCbInfo *cbinfo;
+ void *obj;
+
+ if (SourceType() == SOURCE_TYPE_USB) {
+ if (!FlagConnected())
+ SetSourceType(SOURCE_TYPE_ALL);
+ }
+
+ EINA_LIST_FOREACH(m->elListener, l, obj) {
+ cbinfo = (SCbInfo *)obj;
+ if (cbinfo->type == E_USB_CONNECT && cbinfo->cb)
+ cbinfo->cb(cbinfo->data);
+ }
+}
\ No newline at end of file
for (i = 0; i < size; i++) {
if (btnType == BTN_SOURCE && i == SOURCE_TYPE_USB &&
- !m->mhandle->CheckUsb())
+ !m->mhandle->FlagConnected())
continue;
btn = s_AddButton(box);
void CCategoryLayout::m_EmptyLayout(bool sort_flag)
{
- if (t.grid)
+ if (t.grid) {
elm_gengrid_clear(t.grid);
+ evas_object_del(t.grid);
+ t.grid = NULL;
+ }
- if (m->glist)
+ if (m->glist) {
elm_genlist_clear(m->glist);
+ evas_object_del(m->glist);
+ m->glist = NULL;
+ }
if (!sort_flag) {
if (m->catlist) {