• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 SetAvailableCapability(const StreamCapability &streamCapability) = 0;
60     virtual int32_t SetSpeed(const PlaybackSpeed speed) = 0;
61     virtual int32_t GetPlayerStatus(PlayerStates &playerStates) = 0;
62     virtual int32_t GetPosition(int &position) = 0;
63     virtual int32_t GetDuration(int &duration) = 0;
64     virtual int32_t GetVolume(int &volume, int &maxVolume) = 0;
65     virtual int32_t GetMute(bool &mute) = 0;
66     virtual int32_t GetLoopMode(LoopMode &loopMode) = 0;
67     virtual int32_t GetAvailableCapability(StreamCapability &streamCapability) = 0;
68     virtual int32_t GetPlaySpeed(PlaybackSpeed &playbackSpeed) = 0;
69     virtual int32_t GetMediaInfoHolder(MediaInfoHolder &mediaInfoHolder) = 0;
70     virtual int32_t ProvideKeyResponse(const std::string &mediaId, const std::vector<uint8_t> &response) = 0;
71     virtual int32_t Release() = 0;
72 
73 protected:
74     enum {
75         REGISTER_LISTENER = 1,
76         UNREGISTER_LISTENER,
77         SET_SURFACE,
78         PLAY_INDEX,
79         LOAD,
80         START,
81         PAUSE,
82         PLAY,
83         STOP,
84         NEXT,
85         PREVIOUS,
86         SEEK,
87         FAST_FORWARD,
88         FAST_REWIND,
89         SET_VOLUME,
90         SET_MUTE,
91         SET_LOOP_MODE,
92         SET_AVAILABLE_CAPABILITY,
93         SET_SPEED,
94         GET_PLAYER_STATUS,
95         GET_POSITION,
96         GET_DURATION,
97         GET_VOLUME,
98         GET_MUTE,
99         GET_LOOP_MODE,
100         GET_AVAILABLE_CAPABILITY,
101         GET_PLAY_SPEED,
102         GET_MEDIA_INFO_HOLDER,
103         PROVIDE_KEY_RESPONSE,
104         RELEASE
105     };
106     static const size_t MAX_PLAY_LIST_SIZE = 100;
107 };
108 } // namespace CastEngine
109 } // namespace OHOS
110 
111 #endif
112