1 /* 2 * Copyright (C) 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 PLAYER_SERVICE_PROXY_H 17 #define PLAYER_SERVICE_PROXY_H 18 19 #include "i_standard_player_service.h" 20 #include "media_parcel.h" 21 22 namespace OHOS { 23 namespace Media { 24 class PlayerServiceProxy : public IRemoteProxy<IStandardPlayerService> { 25 public: 26 explicit PlayerServiceProxy(const sptr<IRemoteObject> &impl); 27 virtual ~PlayerServiceProxy(); 28 int32_t SetListenerObject(const sptr<IRemoteObject> &object) override; 29 int32_t SetSource(const std::string &url) override; 30 int32_t Reset() override; 31 int32_t Prepare() override; 32 int32_t Pause() override; 33 int32_t SetSource(const sptr<IRemoteObject> &object) override; 34 int32_t SetSource(int32_t fd, int64_t offset, int64_t size) override; 35 int32_t SetRenderFirstFrame(bool display) override; 36 int32_t SetPlayRange(int64_t start, int64_t end) override; 37 int32_t SetPlayRangeWithMode(int64_t start, int64_t end, PlayerSeekMode mode) override; 38 int32_t PrepareAsync() override; 39 int32_t Play() override; 40 int32_t GetAudioTrackInfo(std::vector<Format> &audioTrack) override; 41 int32_t AddSubSource(const std::string &url) override; 42 int32_t SetPlaybackSpeed(PlaybackRateMode mode) override; 43 int32_t SetMediaSource(const std::shared_ptr<AVMediaSource> &mediaSource, AVPlayStrategy strategy) override; 44 int32_t AddSubSource(int32_t fd, int64_t offset, int64_t size) override; 45 int32_t Seek(int32_t mSeconds, PlayerSeekMode mode) override; 46 int32_t Stop() override; 47 int32_t GetPlaybackSpeed(PlaybackRateMode &mode) override; 48 int32_t Release() override; 49 int32_t GetVideoHeight() override; 50 int32_t ReleaseSync() override; 51 int32_t GetVideoWidth() override; 52 int32_t SetVolume(float leftVolume, float rightVolume) override; 53 int32_t GetCurrentTime(int32_t ¤tTime) override; 54 int32_t GetPlaybackPosition(int32_t ¤tTime) override; 55 int32_t GetVideoTrackInfo(std::vector<Format> &videoTrack) override; 56 int32_t GetPlaybackInfo(Format& playbackInfo) override; 57 int32_t GetSubtitleTrackInfo(std::vector<Format> &subtitleTrack) override; 58 int32_t GetDuration(int32_t &duration) override; 59 int32_t SetPlaybackStrategy(AVPlayStrategy playbackStrategy) override; 60 int32_t SetMediaMuted(OHOS::Media::MediaType mediaType, bool isMuted) override; 61 #ifdef SUPPORT_VIDEO 62 int32_t SetVideoSurface(sptr<Surface> surface) override; 63 #endif 64 bool IsPlaying() override; 65 bool IsLooping() override; 66 int32_t GetCurrentTrack(int32_t trackType, int32_t &index) override; 67 int32_t SetPlayerCallback() override; 68 int32_t SelectBitRate(uint32_t bitRate) override; 69 int32_t SelectTrack(int32_t index, PlayerSwitchMode mode) override; 70 int32_t SetLooping(bool loop) override; 71 int32_t SetParameter(const Format ¶m) override; 72 int32_t DeselectTrack(int32_t index) override; 73 int32_t DestroyStub() override; 74 int32_t SetDecryptConfig(const sptr<DrmStandard::IMediaKeySessionService> &keySessionProxy, 75 bool svp) override; 76 int32_t SetMaxAmplitudeCbStatus(bool status) override; 77 int32_t SetDeviceChangeCbStatus(bool status) override; 78 private: 79 int32_t SendRequest(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option); 80 static inline BrokerDelegator<PlayerServiceProxy> delegator_; 81 std::map<uint32_t, std::string> playerFuncs_; 82 }; 83 } // namespace Media 84 } // namespace OHOS 85 #endif // PLAYER_SERVICE_PROXY_H 86