xref: /rockchip-linux_mpp/utils/camera_source.h (revision 437bfbeb9567cca9cd9080e3f6954aa9d6a94f18)
1*437bfbebSnyanmisaka /*
2*437bfbebSnyanmisaka  * Copyright 2015 Rockchip Electronics Co. LTD
3*437bfbebSnyanmisaka  *
4*437bfbebSnyanmisaka  * Licensed under the Apache License, Version 2.0 (the "License");
5*437bfbebSnyanmisaka  * you may not use this file except in compliance with the License.
6*437bfbebSnyanmisaka  * You may obtain a copy of the License at
7*437bfbebSnyanmisaka  *
8*437bfbebSnyanmisaka  *      http://www.apache.org/licenses/LICENSE-2.0
9*437bfbebSnyanmisaka  *
10*437bfbebSnyanmisaka  * Unless required by applicable law or agreed to in writing, software
11*437bfbebSnyanmisaka  * distributed under the License is distributed on an "AS IS" BASIS,
12*437bfbebSnyanmisaka  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13*437bfbebSnyanmisaka  * See the License for the specific language governing permissions and
14*437bfbebSnyanmisaka  * limitations under the License.
15*437bfbebSnyanmisaka  */
16*437bfbebSnyanmisaka 
17*437bfbebSnyanmisaka #ifndef __CAMERA_SOURCE_H__
18*437bfbebSnyanmisaka #define __CAMERA_SOURCE_H__
19*437bfbebSnyanmisaka 
20*437bfbebSnyanmisaka #include "mpp_frame.h"
21*437bfbebSnyanmisaka 
22*437bfbebSnyanmisaka typedef struct CamSource CamSource;
23*437bfbebSnyanmisaka 
24*437bfbebSnyanmisaka #ifdef __cplusplus
25*437bfbebSnyanmisaka extern "C" {
26*437bfbebSnyanmisaka #endif
27*437bfbebSnyanmisaka 
28*437bfbebSnyanmisaka // Create a new context to capture frames from <fname>. Returns NULL on error.
29*437bfbebSnyanmisaka CamSource* camera_source_init(const char *device, RK_U32 bufcnt, RK_U32 width, RK_U32 height, MppFrameFormat fmt);
30*437bfbebSnyanmisaka 
31*437bfbebSnyanmisaka // Stop capturing and free a context.
32*437bfbebSnyanmisaka MPP_RET camera_source_deinit(CamSource *ctx);
33*437bfbebSnyanmisaka 
34*437bfbebSnyanmisaka // Returns the next captured frame and its meta-data.
35*437bfbebSnyanmisaka RK_S32 camera_source_get_frame(CamSource *ctx);
36*437bfbebSnyanmisaka 
37*437bfbebSnyanmisaka // Tells the kernel it's OK to overwrite a frame captured
38*437bfbebSnyanmisaka MPP_RET camera_source_put_frame(CamSource *ctx, RK_S32 idx);
39*437bfbebSnyanmisaka 
40*437bfbebSnyanmisaka MppBuffer camera_frame_to_buf(CamSource *ctx, RK_S32 idx);
41*437bfbebSnyanmisaka 
42*437bfbebSnyanmisaka #ifdef __cplusplus
43*437bfbebSnyanmisaka }
44*437bfbebSnyanmisaka #endif
45*437bfbebSnyanmisaka 
46*437bfbebSnyanmisaka #endif /* __CAMERA_SOURCE_H__ */
47