2 * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the License);
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an AS IS BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 #ifndef __MUSIC_CONTROLLER_H__
18 #define __MUSIC_CONTROLLER_H__
22 //#include <usb-device.h>
28 class IMusicControllerListener {
30 static void sm_CbComplete(void *cookie);
31 static void sm_CbError(void *cookie);
32 static void sm_CbUsbConnected(void *cookie);
33 static void sm_CbUpdateContent(void *cookie);
36 virtual void t_OnComplete(void) = 0;
37 virtual void t_OnError(void) = 0;
38 virtual void t_OnUsbConnected(void) = 0;
39 virtual void t_OnUpdateContent(void) = 0;
43 class CMusicController {
45 static CMusicController *instance;
47 struct SMusicController *m;
62 virtual ~CMusicController() {}
65 static void sm_CbPlaybackCompletion(void *data);
66 void m_OnPlaybackCompletion(void);
68 //static void sm_CbConnected(usb_device_h usb_device, char *action, void *dt);
69 //void m_OnConnected(usb_device_h usb_device, char *action);
72 bool t_PlayNext(int direction, int playnext_type);
73 SMusicController* t_Create(void);
77 static bool Initialize(void);
78 static void Finalize(void);
80 static CMusicController* GetInstance(void);
87 bool AddListener(IMusicControllerListener *listener);
88 bool RemoveListener(IMusicControllerListener *listener);
90 bool GetCurrentSongIndex(int *ind);
91 bool SetCurrentSongIndex(int ind);
92 bool GetTotalSongs(int *ts);
93 bool GetSonginfoFromIndex(int index, struct SSongInfo **const csinfo);
96 bool SetPlayState(int state);
98 int ShuffleState(void);
99 bool SetShuffleState(int state);
101 int RepeatState(void);
102 bool SetRepeatState(int state);
104 int SourceType(void);
107 bool SetSourceType(int type);
108 bool SetSortType(int type);
109 bool SetPosition(int milsec);
110 bool GetPosition(int *const milseconds);
112 bool SetCurrentSong(char *mediaid);
114 bool GetCurrentSong(struct SSongInfo **const sinfo);
115 bool SetCurrentAlbum(struct album_info *alinfo);
117 struct album_info *CurrentAlbum(void);
119 bool UpdatePlaylist(Eina_List *slist, int addmode);
120 bool EmptyPlaylist(void);
121 bool PlaylistUpdateShuffle(void);
122 bool PlayPreviousSong(void);
123 bool PlayNextSong(void);
124 bool PlayIndexSong(int index);
125 bool RemoveSong(struct SSongInfo *sinfo, int index);
128 bool MediaGetList(int EListType, void *info, Eina_List **list);
129 bool MediaInsertPlaylist(const char *name, Eina_List *idlist);
130 bool MediaExistPlaylist(const char *name);
131 bool MediaDeletePlaylist(int id);
132 bool MediaRenamePlaylist(int id, const char *name);
133 bool MediaAddmediaPlaylist(int id, Eina_List *idlist);
134 bool MediaRemovemediaPlaylist(int id, Eina_List *idlist);
135 bool MediaAddsongsPlaylist(int lid, Eina_List *list);
136 struct SSongInfo *MediaSongByUri(char *uri);
141 #endif /*__MUSIC_CONTROLLER_H__*/