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 <UsbConnectionListener.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 : public CUsbConnectionListener {
45 static CMusicController *instance;
47 struct SMusicController *m;
62 virtual ~CMusicController() {}
65 static void sm_CbPlaybackCompletion(void *data);
66 void m_OnPlaybackCompletion(void);
69 bool t_PlayNext(int direction, int playnext_type);
70 SMusicController* t_Create(void);
74 static bool Initialize(void);
75 static void Finalize(void);
77 static CMusicController* GetInstance(void);
84 bool AddListener(IMusicControllerListener *listener);
85 bool RemoveListener(IMusicControllerListener *listener);
87 bool GetCurrentSongIndex(int *ind);
88 bool SetCurrentSongIndex(int ind);
89 bool GetTotalSongs(int *ts);
90 bool GetSonginfoFromIndex(int index, CSongInfo **const csinfo);
93 bool SetPlayState(int state);
95 int ShuffleState(void);
96 bool SetShuffleState(int state);
98 int RepeatState(void);
99 bool SetRepeatState(int state);
101 int SourceType(void);
104 bool SetSourceType(int type);
105 bool SetSortType(int type);
106 bool SetPosition(int milsec);
107 bool GetPosition(int *const milseconds);
109 bool SetCurrentSong(char *mediaid);
111 bool GetCurrentSong(CSongInfo **const sinfo);
112 bool SetCurrentAlbum(album_info *alinfo);
114 struct album_info *CurrentAlbum(void);
116 bool UpdatePlaylist(Eina_List *slist, int addmode);
117 bool EmptyPlaylist(void);
118 bool PlaylistUpdateShuffle(void);
119 bool PlayPreviousSong(void);
120 bool PlayNextSong(void);
121 bool PlayIndexSong(int index);
122 bool RemoveSong(CSongInfo *sinfo, int index);
125 bool MediaGetList(int EListType, void *info, Eina_List **list);
126 bool MediaInsertPlaylist(const char *name, Eina_List *idlist);
127 bool MediaExistPlaylist(const char *name);
128 bool MediaDeletePlaylist(int id);
129 bool MediaRenamePlaylist(int id, const char *name);
130 bool MediaAddmediaPlaylist(int id, Eina_List *idlist);
131 bool MediaRemovemediaPlaylist(int id, Eina_List *idlist);
132 bool MediaAddsongsPlaylist(int lid, Eina_List *list);
133 CSongInfo *MediaSongByUri(char *uri);
136 virtual void OnConnect(void);
141 #endif /*__MUSIC_CONTROLLER_H__*/