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>
23 #include "playback-mgr.h"
26 class IMusicControllerListener {
28 enum SUsbStorageStatus {
29 USB_STORAGE_CONNECTED,
30 USB_STORAGE_DISCONNECTED
34 //! This function is invoked when playback is complete.
35 virtual void OnComplete(void) {}
36 //! This function is invoked when playback occurs any error.
37 virtual void OnError(void) {}
38 //! This function is invoked when usb is connected or not.
39 virtual void OnUsbStatusChanged(SUsbStorageStatus status) {}
40 //! This function is invoked when content is updated..
41 virtual void OnUpdateContent(void) {}
42 //! This function is invoked when new song is played.
43 virtual void OnStartPlayback(void) {}
44 //! This function is invoked when the playback is stopped.
45 virtual void OnStopPlayback(void) {}
46 //! This function is invoked when playback is paused.
47 virtual void OnPausePlayback(void) {}
48 //! This function is invoked when playback is resumed.
49 virtual void OnResumePlayback(void) {}
51 virtual void OnPosition(int milsec) {}
55 class CMusicController {
57 struct SMusicController *m;
60 CMusicController() : m(0) {}
61 virtual ~CMusicController() {}
62 bool FlagCreate(void) { return !!m; }
65 virtual void Destroy(void);
72 bool AddListener(IMusicControllerListener *listener);
73 bool RemoveListener(IMusicControllerListener *listener);
75 bool GetCurrentSongIndex(int *ind);
76 bool GetTotalSongs(int *ts);
77 bool GetSonginfoFromIndex(int index, CSongInfo **const csinfo);
79 bool SetPosition(int milsec);
80 bool GetPosition(int *const milseconds);
82 bool SetCurrentSong(char *mediaid);
83 bool GetCurrentSong(CSongInfo **const sinfo);
85 bool UpdatePlaylist(Eina_List *slist, int addmode);
86 bool EmptyPlaylist(void);
88 bool PlayPreviousSong(void);
89 bool PlayNextSong(void);
90 bool PlayIndexSong(int index);
92 bool RemoveSong(CSongInfo *sinfo, int index);
94 bool MediaGetList(int EListType, void *info, Eina_List **list);
95 bool MediaInsertPlaylist(const char *name, Eina_List *idlist);
96 bool MediaExistPlaylist(const char *name);
97 bool MediaDeletePlaylist(int id);
98 bool MediaRenamePlaylist(int id, const char *name);
99 bool MediaAddmediaPlaylist(int id, Eina_List *idlist);
100 bool MediaRemovemediaPlaylist(int id, Eina_List *idlist);
101 bool MediaAddsongsPlaylist(int lid, Eina_List *list);
103 CSongInfo *MediaSongByUri(char *uri);
105 bool SetPlayState(EPlayStatus state);
106 EPlayStatus PlayState(void);
108 bool SetShuffleState(EShuffleStatus state);
109 EShuffleStatus ShuffleState(void);
111 bool SetRepeatState(ERepeatStatus state);
112 ERepeatStatus RepeatState(void);
116 #endif /*__MUSIC_CONTROLLER_H__*/