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.
19 #include <AppCommon.h>
20 #include "song_info.h"
22 #include "music-controller.h"
23 #include "MusicControllerImpl.h"
26 struct SMusicController {
27 static CMusicControllerImpl ref;
32 CMusicControllerImpl SMusicController::ref;
33 int SMusicController::refCnt = 0;
36 bool CMusicController::Create(void)
40 m = new SMusicController;
45 if (!m->ref.Create()) {
57 void CMusicController::Destroy(void)
70 bool CMusicController::Start(void)
74 return m->ref.Start();
78 bool CMusicController::Stop(void)
86 bool CMusicController::Resume(void)
90 return m->ref.Resume();
94 bool CMusicController::Pause(void)
98 return m->ref.Pause();
102 bool CMusicController::AddListener(IMusicControllerListener *listener)
106 return m->ref.AddListener(listener);
110 bool CMusicController::RemoveListener(IMusicControllerListener *listener)
114 return m->ref.RemoveListener(listener);
118 bool CMusicController::GetCurrentSongIndex(int *ind)
122 return m->ref.GetCurrentSongIndex(ind);
126 bool CMusicController::GetTotalSongs(int *ts)
130 return m->ref.GetTotalSongs(ts);
134 bool CMusicController::GetSonginfoFromIndex(int index, CSongInfo **const csinfo)
138 return m->ref.GetSonginfoFromIndex(index, csinfo);
142 bool CMusicController::SetPosition(int milsec)
146 return m->ref.SetPosition(milsec);
150 bool CMusicController::GetPosition(int *const milseconds)
154 return m->ref.GetPosition(milseconds);
158 bool CMusicController::SetCurrentSong(char *mediaid)
162 return m->ref.SetCurrentSong(mediaid);
166 bool CMusicController::GetCurrentSong(CSongInfo **const sinfo)
170 return m->ref.GetCurrentSong(sinfo);
174 bool CMusicController::UpdatePlaylist(Eina_List *slist, int addmode)
178 return m->ref.UpdatePlaylist(slist, addmode);
182 bool CMusicController::EmptyPlaylist(void)
186 return m->ref.EmptyPlaylist();
190 bool CMusicController::PlayPreviousSong(void)
194 return m->ref.PlayPreviousSong();
198 bool CMusicController::PlayNextSong(void)
202 return m->ref.PlayNextSong();
206 bool CMusicController::PlayIndexSong(int index)
210 return m->ref.PlayIndexSong(index);
214 bool CMusicController::RemoveSong(CSongInfo *sinfo, int index)
218 return m->ref.RemoveSong(sinfo, index);
222 bool CMusicController::MediaGetList(int EListType, void *info, Eina_List **list)
226 return m->ref.MediaGetList(EListType, info, list);
230 bool CMusicController::MediaInsertPlaylist(const char *name, Eina_List *idlist)
234 return m->ref.MediaInsertPlaylist(name, idlist);
238 bool CMusicController::MediaExistPlaylist(const char *name)
242 return m->ref.MediaExistPlaylist(name);
246 bool CMusicController::MediaDeletePlaylist(int id)
250 return m->ref.MediaDeletePlaylist(id);
254 bool CMusicController::MediaRenamePlaylist(int id, const char *name)
258 return m->ref.MediaRenamePlaylist(id, name);
262 bool CMusicController::MediaAddmediaPlaylist(int id, Eina_List *idlist)
266 return m->ref.MediaAddmediaPlaylist(id, idlist);
270 bool CMusicController::MediaRemovemediaPlaylist(int id, Eina_List *idlist)
274 return m->ref.MediaRemovemediaPlaylist(id, idlist);
278 bool CMusicController::MediaAddsongsPlaylist(int lid, Eina_List *list)
282 return m->ref.MediaAddsongsPlaylist(lid, list);
286 CSongInfo *CMusicController::MediaSongByUri(char *uri)
290 return m->ref.MediaSongByUri(uri);
294 bool CMusicController::SetPlayState(EPlayStatus state)
298 return m->ref.SetPlayState(state);
302 EPlayStatus CMusicController::PlayState(void)
306 return m->ref.PlayState();
310 bool CMusicController::SetShuffleState(EShuffleStatus state)
314 return m->ref.SetShuffleState(state);
318 EShuffleStatus CMusicController::ShuffleState(void)
322 return m->ref.ShuffleState();
326 bool CMusicController::SetRepeatState(ERepeatStatus state)
330 return m->ref.SetRepeatState(state);
334 ERepeatStatus CMusicController::RepeatState(void)
338 return m->ref.RepeatState();
342 void CMusicController::ChangePlayerMode(EPlayerMode mode)
346 m->ref.ChangePlayerMode(mode);
350 void CMusicController::HandlePlaylistEditButtons(EPlayerEditBtns editBtn)
354 m->ref.HandlePlaylistEditButtons(editBtn);
358 void CMusicController::HandleRemoteButtons(Evas_Object *eoBtn, EPlayerBtnsEvent ev)
362 m->ref.HandleRemoteButtons(eoBtn, ev);
366 void CMusicController::UpdatePlayerUI(void)
370 m->ref.UpdatePlayerUI();