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 MEDIA_PIPELINE_PLAYER_EXECUTOR_H
17#define MEDIA_PIPELINE_PLAYER_EXECUTOR_H
18
19#include <memory>
20#include "pipeline/core/error_code.h"
21#include "plugin/common/media_source.h"
22
23namespace OHOS {
24namespace Media {
25using MediaSource = Plugin::MediaSource;
26
27struct SeekInfo {
28    int64_t hstTime;
29    Plugin::SeekMode mode;
30};
31
32class PlayExecutor {
33public:
34    virtual ~PlayExecutor()
35    {
36    }
37
38    virtual bool IsSingleLoop() = 0;
39
40    virtual ErrorCode PrepareFilters()
41    {
42        return ErrorCode::SUCCESS;
43    }
44
45    virtual ErrorCode DoSetSource(const std::shared_ptr<MediaSource>& source)
46    {
47        (void)source;
48        return ErrorCode::SUCCESS;
49    }
50
51    virtual ErrorCode DoPlay()
52    {
53        return ErrorCode::SUCCESS;
54    }
55
56    virtual ErrorCode DoPause()
57    {
58        return ErrorCode::SUCCESS;
59    }
60
61    virtual ErrorCode DoResume()
62    {
63        return ErrorCode::SUCCESS;
64    }
65
66    virtual ErrorCode DoStop()
67    {
68        return ErrorCode::SUCCESS;
69    }
70
71    virtual ErrorCode DoReset()
72    {
73        return ErrorCode::SUCCESS;
74    }
75
76    virtual ErrorCode DoSeek(int64_t hstTime, Plugin::SeekMode mode, bool appTriggered)
77    {
78        (void)hstTime;
79        (void)mode;
80        (void)appTriggered;
81        return ErrorCode::SUCCESS;
82    }
83
84    virtual ErrorCode DoOnReady()
85    {
86        return ErrorCode::SUCCESS;
87    }
88
89    virtual ErrorCode DoOnComplete()
90    {
91        return ErrorCode::SUCCESS;
92    }
93
94    virtual ErrorCode DoOnError(ErrorCode errorCode)
95    {
96        (void)errorCode;
97        return ErrorCode::SUCCESS;
98    }
99};
100} // namespace Media
101} // namespace OHOS
102
103#endif
104