1 /* 2 * Copyright (C) 2023-2023 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 * Description: supply stream player implement ipc interface. 15 * Author: zhangjingnan 16 * Create: 2023-08-29 17 */ 18 19 #ifndef I_STREAM_PLAYER_IPC_H 20 #define I_STREAM_PLAYER_IPC_H 21 22 #include <string> 23 #include "surface_utils.h" 24 #include "cast_engine_common.h" 25 #include "cast_service_common.h" 26 #include "i_stream_player_listener_impl.h" 27 #include "iremote_broker.h" 28 29 namespace OHOS { 30 namespace CastEngine { 31 class IStreamPlayerIpc : public IRemoteBroker { 32 public: 33 DECLARE_INTERFACE_DESCRIPTOR(u"OHOS.CastEngine.IStreamPlayerIpc"); 34 35 IStreamPlayerIpc() = default; 36 IStreamPlayerIpc(const IStreamPlayerIpc &) = delete; 37 IStreamPlayerIpc &operator=(const IStreamPlayerIpc &) = delete; 38 IStreamPlayerIpc(IStreamPlayerIpc &&) = delete; 39 IStreamPlayerIpc &operator=(IStreamPlayerIpc &&) = delete; 40 virtual ~IStreamPlayerIpc() override = default; 41 42 virtual int32_t RegisterListener(sptr<IStreamPlayerListenerImpl> listener) = 0; 43 virtual int32_t UnregisterListener() = 0; 44 virtual int32_t SetSurface(sptr<IBufferProducer> producer) = 0; 45 virtual int32_t Load(const MediaInfo &mediaInfo) = 0; 46 virtual int32_t Play(const MediaInfo &mediaInfo) = 0; 47 virtual int32_t Play(int index) = 0; 48 virtual int32_t Play() = 0; 49 virtual int32_t Pause() = 0; 50 virtual int32_t Stop() = 0; 51 virtual int32_t Next() = 0; 52 virtual int32_t Previous() = 0; 53 virtual int32_t Seek(int position) = 0; 54 virtual int32_t FastForward(int delta) = 0; 55 virtual int32_t FastRewind(int delta) = 0; 56 virtual int32_t SetVolume(int volume) = 0; 57 virtual int32_t SetMute(bool mute) = 0; 58 virtual int32_t SetLoopMode(const LoopMode mode) = 0; 59 virtual int32_t SetSpeed(const PlaybackSpeed speed) = 0; 60 virtual int32_t GetPlayerStatus(PlayerStates &playerStates) = 0; 61 virtual int32_t GetPosition(int &position) = 0; 62 virtual int32_t GetDuration(int &duration) = 0; 63 virtual int32_t GetVolume(int &volume, int &maxVolume) = 0; 64 virtual int32_t GetMute(bool &mute) = 0; 65 virtual int32_t GetLoopMode(LoopMode &loopMode) = 0; 66 virtual int32_t GetPlaySpeed(PlaybackSpeed &playbackSpeed) = 0; 67 virtual int32_t GetMediaInfoHolder(MediaInfoHolder &mediaInfoHolder) = 0; 68 virtual int32_t Release() = 0; 69 70 protected: 71 enum { 72 REGISTER_LISTENER = 1, 73 UNREGISTER_LISTENER, 74 SET_SURFACE, 75 PLAY_INDEX, 76 LOAD, 77 START, 78 PAUSE, 79 PLAY, 80 STOP, 81 NEXT, 82 PREVIOUS, 83 SEEK, 84 FAST_FORWARD, 85 FAST_REWIND, 86 SET_VOLUME, 87 SET_MUTE, 88 SET_LOOP_MODE, 89 SET_SPEED, 90 GET_PLAYER_STATUS, 91 GET_POSITION, 92 GET_DURATION, 93 GET_VOLUME, 94 GET_MUTE, 95 GET_LOOP_MODE, 96 GET_PLAY_SPEED, 97 GET_MEDIA_INFO_HOLDER, 98 RELEASE 99 }; 100 static const size_t MAX_PLAY_LIST_SIZE = 100; 101 }; 102 } // namespace CastEngine 103 } // namespace OHOS 104 105 #endif 106