1 /*
2  * Copyright (c) 2021-2021 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  */
15 
16 #ifndef MULTIMEDIA_PLAYER_INTERFACE_H
17 #define MULTIMEDIA_PLAYER_INTERFACE_H
18 
19 #include "format.h"
20 #include "player.h"
21 #include "source.h"
22 #ifndef SURFACE_DISABLED
23 #include "surface.h"
24 #endif
25 
26 namespace OHOS {
27 namespace Media {
28 class PlayerInterface {
29 public:
30     virtual ~PlayerInterface() = default;
31     virtual int32_t SetSource(const Source &source) = 0;
32     virtual int32_t Prepare() = 0;
33     virtual int32_t Play() = 0;
34     virtual bool IsPlaying() = 0;
35     virtual int32_t Pause() = 0;
36     virtual int32_t Stop() = 0;
37     virtual int32_t Rewind(int64_t mSeconds, int32_t mode) = 0;
38     virtual int32_t SetVolume(float leftVolume, float rightVolume) = 0;
39 #ifndef SURFACE_DISABLED
40     virtual int32_t SetSurface(Surface *surface) = 0;
41 #endif
42     virtual bool IsSingleLooping() = 0;
43     virtual int32_t GetPlayerState(int32_t &state) = 0;
44     virtual int32_t GetCurrentPosition(int64_t &currentPosition) = 0;
45     virtual int32_t GetDuration(int64_t &duration) = 0;
46     virtual int32_t GetVideoWidth(int32_t &videoWidth) = 0;
47     virtual int32_t GetVideoHeight(int32_t &videoHeight) = 0;
48     virtual int32_t SetPlaybackSpeed(float speed) = 0;
49     virtual int32_t GetPlaybackSpeed(float &speed) = 0;
50     virtual int32_t SetAudioStreamType(int32_t type) = 0;
51     virtual void GetAudioStreamType(int32_t &type) = 0;
52     virtual int32_t Reset(void) = 0;
53     virtual int32_t Release() = 0;
54     virtual int32_t SetLoop(bool loop) = 0;
55     virtual void SetPlayerCallback(const std::shared_ptr<PlayerCallback> &cb) = 0;
56     virtual int32_t Init(void) = 0;
57     virtual int32_t DeInit(void) = 0;
58     virtual int32_t SetParameter(const Format &params) = 0;
59 };
60 } // namespace Media
61 } // namespace OHOS
62 #endif // MULTIMEDIA_PLAYER_INTERFACE_H
63