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__
20 #include "playback-mgr.h"
22 class IMusicControllerListener {
24 enum SUsbStorageStatus {
25 USB_STORAGE_CONNECTED,
26 USB_STORAGE_DISCONNECTED
30 //! This function is invoked when playback is complete.
31 virtual void OnComplete(void) {}
32 //! This function is invoked when playback occurs any error.
33 virtual void OnError(void) {}
34 //! This function is invoked when usb is connected or not.
35 virtual void OnUsbStatusChanged(SUsbStorageStatus status) {}
36 //! This function is invoked when content is updated..
37 virtual void OnUpdateContent(void) {}
38 //! This function is invoked when new song is played.
39 virtual void OnStartPlayback(void) {}
40 //! This function is invoked when the playback is stopped.
41 virtual void OnStopPlayback(void) {}
42 //! This function is invoked when playback is paused.
43 virtual void OnPausePlayback(void) {}
44 //! This function is invoked when playback is resumed.
45 virtual void OnResumePlayback(void) {}
47 virtual void OnPosition(int milsec) {}
49 virtual void OnEmptyPlaylist(void) {}
51 virtual void OnPlayerModeChanged(EPlayerMode mode) {}
53 virtual void OnEditButtonsPressed(EPlayerEditBtns editBtns) {}
55 virtual void OnRemoteButtonEvent(Evas_Object *eoBtn, EPlayerBtnsEvent ev) {}
57 virtual void OnUpdatePlayerUI(void) {}
61 class CMusicController {
63 struct SMusicController *m;
66 CMusicController() : m(0) {}
67 virtual ~CMusicController() {}
68 bool FlagCreate(void) { return !!m; }
71 virtual void Destroy(void);
78 bool AddListener(IMusicControllerListener *listener);
79 bool RemoveListener(IMusicControllerListener *listener);
81 bool GetCurrentSongIndex(int *ind);
82 bool GetTotalSongs(int *ts);
83 bool GetSonginfoFromIndex(int index, CSongInfo **const csinfo);
85 bool SetPosition(int milsec);
86 bool GetPosition(int *const milseconds);
88 bool SetCurrentSong(char *mediaid);
89 bool GetCurrentSong(CSongInfo **const sinfo);
91 bool UpdatePlaylist(Eina_List *slist, int addmode);
92 bool EmptyPlaylist(void);
94 bool PlayPreviousSong(void);
95 bool PlayNextSong(void);
96 bool PlayIndexSong(int index);
98 bool RemoveSong(CSongInfo *sinfo, int index);
100 bool MediaGetList(int EListType, void *info, Eina_List **list);
101 bool MediaInsertPlaylist(const char *name, Eina_List *idlist);
102 bool MediaExistPlaylist(const char *name);
103 bool MediaDeletePlaylist(int id);
104 bool MediaRenamePlaylist(int id, const char *name);
105 bool MediaAddmediaPlaylist(int id, Eina_List *idlist);
106 bool MediaRemovemediaPlaylist(int id, Eina_List *idlist);
107 bool MediaAddsongsPlaylist(int lid, Eina_List *list);
109 CSongInfo *MediaSongByUri(char *uri);
111 bool SetPlayState(EPlayStatus state);
112 EPlayStatus PlayState(void);
114 bool SetShuffleState(EShuffleStatus state);
115 EShuffleStatus ShuffleState(void);
117 bool SetRepeatState(ERepeatStatus state);
118 ERepeatStatus RepeatState(void);
120 void ChangePlayerMode(EPlayerMode mode);
121 void HandlePlaylistEditButtons(EPlayerEditBtns btnId);
122 void HandleRemoteButtons(Evas_Object *eoBtn, EPlayerBtnsEvent ev);
123 void UpdatePlayerUI(void);
127 #endif /*__MUSIC_CONTROLLER_H__*/