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