xref: /OK3568_Linux_fs/external/rockit/tgi/sdk/include/RTTaskNodeContextManager.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1 /*
2  * Copyright 2020 Rockchip Electronics Co. LTD
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  * src author: <mediapipe-team@google.com>
17  * new author: modified by <rimon.xu@rock-chips.com>
18  *       date: 2020-03-23
19  *  reference: https://github.com/google/mediapipe
20  */
21 
22 #ifndef SRC_RT_TASK_TASK_GRAPH_RTTASKNODECONTEXTMANAGER_H_
23 #define SRC_RT_TASK_TASK_GRAPH_RTTASKNODECONTEXTMANAGER_H_
24 
25 #include <memory>
26 #include <vector>
27 
28 #include "rt_header.h"
29 #include "rt_metadata.h"
30 #include "RTStreamInfo.h"
31 #include "RTTaskNodeContext.h"
32 
33 class RTTaskNodeContextManager {
34  public:
RTTaskNodeContextManager()35     RTTaskNodeContextManager() {}
~RTTaskNodeContextManager()36     virtual ~RTTaskNodeContextManager() {}
37 
38     RT_RET initialize(
39         std::string nodeName,
40         INT32 nodeId,
41         std::vector<RTStreamInfo *> *inputInfo,
42         std::vector<RTStreamInfo *> *outputInfo,
43         bool isParallelRunning);
44 
45     RT_RET prepareForRun(RtMetaData *options);
46     RT_RET cleanupAfterRun();
47 
48     RTTaskNodeContext *getDefaultNodeContext() const;
49 
50  private:
51     std::unique_ptr<RTTaskNodeContext> mDefaultContext;
52     std::vector<RTStreamInfo *> *mInputInfos;
53     std::vector<RTStreamInfo *> *mOutputInfos;
54     bool        mParallelRunning;
55     RtMetaData* mOptions;
56     std::string mNodeName;
57     INT32       mNodeId;
58 };
59 
60 #endif  // SRC_RT_TASK_TASK_GRAPH_RTTASKNODECONTEXTMANAGER_H_
61 
62