1 /*
2  * main_dev_manager.h - main device manager
3  *
4  *  Copyright (c) 2015 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: John Ye <john.ye@intel.com>
19  * Author: Wind Yuan <feng.yuan@intel.com>
20  */
21 
22 #ifndef XCAMSRC_MAIN_DEV_MANAGER_H
23 #define XCAMSRC_MAIN_DEV_MANAGER_H
24 
25 #ifdef HAVE_CONFIG_H
26 #  include <config.h>
27 #endif
28 #include <base/xcam_common.h>
29 #include <linux/videodev2.h>
30 #include <stdint.h>
31 #include <unistd.h>
32 
33 #include <gst/video/video.h>
34 #include <gst/gst.h>
35 
36 #include <queue>
37 
38 #include <xcam_mutex.h>
39 #include <video_buffer.h>
40 #include <v4l2_buffer_proxy.h>
41 #include <v4l2_device.h>
42 #include <device_manager.h>
43 #if HAVE_IA_AIQ
44 #include <isp/atomisp_device.h>
45 #include <isp/isp_controller.h>
46 #include <isp/isp_image_processor.h>
47 #include <isp/x3a_analyzer_aiq.h>
48 #endif
49 #if HAVE_LIBCL
50 #include <ocl/cl_3a_image_processor.h>
51 #include <ocl/cl_post_image_processor.h>
52 #endif
53 #include <x3a_analyzer_simple.h>
54 
55 namespace GstXCam {
56 
57 class MainDeviceManager;
58 
59 class MainDeviceManager
60     : public XCam::DeviceManager
61 {
62 public:
63     MainDeviceManager ();
64     ~MainDeviceManager ();
65 
66     XCam::SmartPtr<XCam::VideoBuffer> dequeue_buffer ();
67     void pause_dequeue ();
68     void resume_dequeue ();
69 
70 #if HAVE_LIBCL
71 public:
set_cl_image_processor(XCam::SmartPtr<XCam::CL3aImageProcessor> & processor)72     void set_cl_image_processor (XCam::SmartPtr<XCam::CL3aImageProcessor> &processor) {
73         _cl_image_processor = processor;
74     }
75 
get_cl_image_processor()76     XCam::SmartPtr<XCam::CL3aImageProcessor> &get_cl_image_processor () {
77         return _cl_image_processor;
78     }
79 
set_cl_post_image_processor(XCam::SmartPtr<XCam::CLPostImageProcessor> & processor)80     void set_cl_post_image_processor (XCam::SmartPtr<XCam::CLPostImageProcessor> &processor) {
81         _cl_post_image_processor = processor;
82     }
83 
get_cl_post_image_processor()84     XCam::SmartPtr<XCam::CLPostImageProcessor> &get_cl_post_image_processor () {
85         return _cl_post_image_processor;
86     }
87 #endif
88 
89 protected:
90     virtual void handle_message (const XCam::SmartPtr<XCam::XCamMessage> &msg);
91     virtual void handle_buffer (const XCam::SmartPtr<XCam::VideoBuffer> &buf);
92 
93 private:
94     XCam::SafeList<XCam::VideoBuffer>         _ready_buffers;
95 #if HAVE_LIBCL
96     XCam::SmartPtr<XCam::CL3aImageProcessor>   _cl_image_processor;
97     XCam::SmartPtr<XCam::CLPostImageProcessor> _cl_post_image_processor;
98 #endif
99 };
100 
101 };
102 
103 #endif  //XCAMSRC_MAIN_DEV_MANAGER_H
104