12e147c35Sopenharmony_ci/*
22e147c35Sopenharmony_ci * Copyright (C) 2023-2023 Huawei Device Co., Ltd.
32e147c35Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
42e147c35Sopenharmony_ci * you may not use this file except in compliance with the License.
52e147c35Sopenharmony_ci * You may obtain a copy of the License at
62e147c35Sopenharmony_ci *
72e147c35Sopenharmony_ci *     http://www.apache.org/licenses/LICENSE-2.0
82e147c35Sopenharmony_ci *
92e147c35Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software
102e147c35Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
112e147c35Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
122e147c35Sopenharmony_ci * See the License for the specific language governing permissions and
132e147c35Sopenharmony_ci * limitations under the License.
142e147c35Sopenharmony_ci * Description: supply Stream Player definition.
152e147c35Sopenharmony_ci * Author: huangchanggui
162e147c35Sopenharmony_ci * Create: 2023-01-12
172e147c35Sopenharmony_ci */
182e147c35Sopenharmony_ci
192e147c35Sopenharmony_ci#ifndef STREAM_PLAYER_H
202e147c35Sopenharmony_ci#define STREAM_PLAYER_H
212e147c35Sopenharmony_ci
222e147c35Sopenharmony_ci#include "i_stream_player.h"
232e147c35Sopenharmony_ci#include "i_stream_player_ipc.h"
242e147c35Sopenharmony_ci#include "cast_engine_common.h"
252e147c35Sopenharmony_ci
262e147c35Sopenharmony_cinamespace OHOS {
272e147c35Sopenharmony_cinamespace CastEngine {
282e147c35Sopenharmony_cinamespace CastEngineClient {
292e147c35Sopenharmony_ciclass StreamPlayer : public IStreamPlayer {
302e147c35Sopenharmony_cipublic:
312e147c35Sopenharmony_ci    explicit StreamPlayer(sptr<IStreamPlayerIpc> proxy) : proxy_(proxy) {}
322e147c35Sopenharmony_ci    ~StreamPlayer() override;
332e147c35Sopenharmony_ci
342e147c35Sopenharmony_ci    int32_t RegisterListener(std::shared_ptr<IStreamPlayerListener> listener) override;
352e147c35Sopenharmony_ci    int32_t UnregisterListener() override;
362e147c35Sopenharmony_ci    int32_t SetSurface(const std::string &surfaceId) override;
372e147c35Sopenharmony_ci    int32_t Load(const MediaInfo &mediaInfo) override;
382e147c35Sopenharmony_ci    int32_t Play(const MediaInfo &mediaInfo) override;
392e147c35Sopenharmony_ci    int32_t Play(int index) override;
402e147c35Sopenharmony_ci    int32_t Play() override;
412e147c35Sopenharmony_ci    int32_t Pause() override;
422e147c35Sopenharmony_ci    int32_t Stop() override;
432e147c35Sopenharmony_ci    int32_t Next() override;
442e147c35Sopenharmony_ci    int32_t Previous() override;
452e147c35Sopenharmony_ci    int32_t Seek(int position) override;
462e147c35Sopenharmony_ci    int32_t FastForward(int delta) override;
472e147c35Sopenharmony_ci    int32_t FastRewind(int delta) override;
482e147c35Sopenharmony_ci    int32_t SetVolume(int volume) override;
492e147c35Sopenharmony_ci    int32_t SetMute(bool mute) override;
502e147c35Sopenharmony_ci    int32_t SetLoopMode(const LoopMode mode) override;
512e147c35Sopenharmony_ci    int32_t SetSpeed(const PlaybackSpeed speed) override;
522e147c35Sopenharmony_ci    int32_t GetPlayerStatus(PlayerStates &playerStates) override;
532e147c35Sopenharmony_ci    int32_t GetPosition(int &position) override;
542e147c35Sopenharmony_ci    int32_t GetDuration(int &duration) override;
552e147c35Sopenharmony_ci    int32_t GetVolume(int &volume, int &maxVolume) override;
562e147c35Sopenharmony_ci    int32_t GetMute(bool &mute) override;
572e147c35Sopenharmony_ci    int32_t GetLoopMode(LoopMode &loopMode) override;
582e147c35Sopenharmony_ci    int32_t GetPlaySpeed(PlaybackSpeed &playbackSpeed) override;
592e147c35Sopenharmony_ci    int32_t GetMediaInfoHolder(MediaInfoHolder &mediaInfoHolder) override;
602e147c35Sopenharmony_ci    int32_t Release() override;
612e147c35Sopenharmony_ci
622e147c35Sopenharmony_ciprivate:
632e147c35Sopenharmony_ci    static const int GET_FAILED = -1;
642e147c35Sopenharmony_ci    sptr<IStreamPlayerIpc> proxy_;
652e147c35Sopenharmony_ci};
662e147c35Sopenharmony_ci} // namespace CastEngineClient
672e147c35Sopenharmony_ci} // namespace CastEngine
682e147c35Sopenharmony_ci} // namespace OHOS
692e147c35Sopenharmony_ci
702e147c35Sopenharmony_ci#endif
71