• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * pipe_manager.h - pipe manager
3  *
4  *  Copyright (c) 2016 Intel Corporation
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  *      http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  *
18  * Author: Wind Yuan <feng.yuan@intel.com>
19  * Author: Yinhang Liu <yinhangx.liu@intel.com>
20  */
21 
22 #ifndef XCAM_PIPE_MANAGER_H
23 #define XCAM_PIPE_MANAGER_H
24 
25 #include <xcam_std.h>
26 #include <smart_analyzer.h>
27 #include <x3a_image_process_center.h>
28 #include <stats_callback_interface.h>
29 
30 namespace XCam {
31 
32 class PipeManager
33     : public StatsCallback
34     , public AnalyzerCallback
35     , public ImageProcessCallback
36 {
37 public:
38     PipeManager ();
39     virtual ~PipeManager ();
40 
41     bool set_smart_analyzer (SmartPtr<SmartAnalyzer> analyzer);
42     bool add_image_processor (SmartPtr<ImageProcessor> processor);
43 
is_running()44     bool is_running () const {
45         return _is_running;
46     }
47 
48     XCamReturn start ();
49     XCamReturn stop ();
50 
51     virtual XCamReturn push_buffer (SmartPtr<VideoBuffer> &buf);
52 
53 protected:
54     virtual void post_buffer (const SmartPtr<VideoBuffer> &buf) = 0;
55 
56     // virtual functions derived from PollCallback
57     virtual XCamReturn scaled_image_ready (const SmartPtr<VideoBuffer> &buffer);
58 
59     // virtual functions derived from AnalyzerCallback
60     virtual void x3a_calculation_done (XAnalyzer *analyzer, X3aResultList &results);
61     virtual void x3a_calculation_failed (XAnalyzer *analyzer, int64_t timestamp, const char *msg);
62 
63     // virtual functions derived from ImageProcessCallback
64     virtual void process_buffer_done (ImageProcessor *processor, const SmartPtr<VideoBuffer> &buf);
65     virtual void process_buffer_failed (ImageProcessor *processor, const SmartPtr<VideoBuffer> &buf);
66     virtual void process_image_result_done (ImageProcessor *processor, const SmartPtr<X3aResult> &result);
67 
68 private:
69     XCAM_DEAD_COPY (PipeManager);
70 
71 protected:
72     bool                             _is_running;
73     SmartPtr<SmartAnalyzer>          _smart_analyzer;
74     SmartPtr<X3aImageProcessCenter>  _processor_center;
75 };
76 
77 };
78 
79 #endif // XCAM_PIPE_MANAGER_H
80