• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 HISTREAMER_PIPELINE_CORE_PIPELINE_H
17 #define HISTREAMER_PIPELINE_CORE_PIPELINE_H
18 
19 #include <initializer_list>
20 #include <memory>
21 
22 #include "filter.h"
23 
24 namespace OHOS {
25 namespace Media {
26 namespace Pipeline {
27 class Pipeline : public Filter {
28 public:
29     ~Pipeline() override = default;
30 
31     /**
32      * 添加Filter到Pipeline
33      *
34      * 添加后的Filter,才会被初始化,才能使用。
35      *
36      * @param filters 要添加的filter
37      * @return
38      */
39     virtual ErrorCode AddFilters(std::initializer_list<Filter*> filters) = 0;
40 
41     virtual ErrorCode RemoveFilter(Filter* filter) = 0;
42 
43     virtual ErrorCode RemoveFilterChain(Filter* firstFilter) = 0;
44 
45     /**
46      * 连接Filter的默认端口
47      *
48      * 前一个Filter的默认输出端口,与后一个Filter的默认输入端口连接
49      *
50      * @param filters 要连接的filter
51      * @return
52      */
53     virtual ErrorCode LinkFilters(std::initializer_list<Filter*> filters) = 0;
54 
55     /**
56      * 连接两个端口
57      *
58      * 端口所属的Filter必须已经添加到Pipeline,否则报错
59      *
60      * @param port1 前一个节点的输出端口
61      * @return
62      */
63     virtual ErrorCode LinkPorts(std::shared_ptr<OutPort> port1, std::shared_ptr<InPort> port2) = 0;
64 };
65 } // namespace Pipeline
66 } // namespace Media
67 } // namespace OHOS
68 
69 #endif // HISTREAMER_PIPELINE_CORE_PIPELINE_H