1 | /* |
2 | Copyright (c) 2012, Broadcom Europe Ltd |
3 | All rights reserved. |
4 | |
5 | Redistribution and use in source and binary forms, with or without |
6 | modification, are permitted provided that the following conditions are met: |
7 | * Redistributions of source code must retain the above copyright |
8 | notice, this list of conditions and the following disclaimer. |
9 | * Redistributions in binary form must reproduce the above copyright |
10 | notice, this list of conditions and the following disclaimer in the |
11 | documentation and/or other materials provided with the distribution. |
12 | * Neither the name of the copyright holder nor the |
13 | names of its contributors may be used to endorse or promote products |
14 | derived from this software without specific prior written permission. |
15 | |
16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND |
17 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
18 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
19 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY |
20 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
21 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
22 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
23 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
25 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | */ |
27 | #ifndef MMALCAM_MMALCAM_H_ |
28 | #define MMALCAM_MMALCAM_H_ |
29 | |
30 | #define VCOS_LOG_CATEGORY (&mmalcam_log_category) |
31 | #include "interface/vcos/vcos.h" |
32 | #include "interface/mmal/mmal.h" |
33 | |
34 | extern VCOS_LOG_CAT_T mmalcam_log_category; |
35 | |
36 | typedef enum |
37 | { |
38 | MMALCAM_CHANGE_NONE, |
39 | MMALCAM_CHANGE_IMAGE_EFFECT, |
40 | MMALCAM_CHANGE_ROTATION, |
41 | MMALCAM_CHANGE_ZOOM, |
42 | MMALCAM_CHANGE_FOCUS, |
43 | MMALCAM_CHANGE_DRC, |
44 | MMALCAM_CHANGE_HDR, |
45 | MMALCAM_CHANGE_CONTRAST, |
46 | MMALCAM_CHANGE_BRIGHTNESS, |
47 | MMALCAM_CHANGE_SATURATION, |
48 | MMALCAM_CHANGE_SHARPNESS, |
49 | } MMALCAM_CHANGE_T; |
50 | |
51 | typedef enum |
52 | { |
53 | MMALCAM_INIT_SUCCESS, |
54 | MMALCAM_INIT_ERROR_EVENT_FLAGS, |
55 | MMALCAM_INIT_ERROR_VCSM_INIT, |
56 | MMALCAM_INIT_ERROR_CAMERA, |
57 | MMALCAM_INIT_ERROR_RENDER, |
58 | MMALCAM_INIT_ERROR_VIEWFINDER, |
59 | MMALCAM_INIT_ERROR_ENCODER, |
60 | MMALCAM_INIT_ERROR_ENCODER_IN, |
61 | MMALCAM_INIT_ERROR_ENCODER_OUT, |
62 | MMALCAM_INIT_ERROR_WRITER, |
63 | MMALCAM_INIT_ERROR_CAMERA_CAPTURE, |
64 | } MMALCAM_INIT_STATUS_T; |
65 | |
66 | typedef struct MMALCAM_BEHAVIOUR_T |
67 | { |
68 | const char *uri; /**< Output URI for recording */ |
69 | const char *vformat; /**< Video resolution and encoding format */ |
70 | MMAL_RECT_T display_area; /**< Size and position of viewfinder on screen */ |
71 | uint32_t layer; /**< Layer number of the viewfinder */ |
72 | MMALCAM_CHANGE_T change; /**< Camera change to make, if any */ |
73 | uint32_t seconds_per_change; /**< Number of seconds between changes */ |
74 | MMAL_RATIONAL_T frame_rate; /**< Frame rate, or zero for variable */ |
75 | MMAL_BOOL_T zero_copy; /**< Enable zero copy if set */ |
76 | MMAL_BOOL_T tunneling; /**< Enable port tunneling if set */ |
77 | MMAL_BOOL_T opaque; /**< Enable opaque image support */ |
78 | VCOS_SEMAPHORE_T init_sem; /**< Semaphore signalled once initialisation is complete */ |
79 | MMALCAM_INIT_STATUS_T init_result; /**< Result of initialisation */ |
80 | MMAL_PARAMETER_STATISTICS_T render_stats; /**< Video render stats */ |
81 | MMAL_PARAMETER_STATISTICS_T encoder_stats; /**< Video encoder output stats */ |
82 | uint32_t bit_rate; /**< Video encoder bit rate */ |
83 | MMAL_PARAM_FOCUS_T focus_test; /**< Set to given focus, MMAL_PARAM_FOCUS_MAX to disable */ |
84 | uint32_t camera_num; /**< camera number */ |
85 | } MMALCAM_BEHAVIOUR_T; |
86 | |
87 | /** Start the camcorder. |
88 | * |
89 | * Starts a viewfinder/preview on screen and optionally encodes the camera |
90 | * output to a URI. |
91 | * |
92 | * @param stop When this is set to 1 externally, the camcorder will be stopped. |
93 | * @param behaviour Defines the behaviour of the camcorder, for automation |
94 | * purposes. |
95 | */ |
96 | int test_mmal_start_camcorder(volatile int *stop, MMALCAM_BEHAVIOUR_T *behaviour); |
97 | |
98 | #endif /* MMALCAM_MMALCAM_H_ */ |
99 | |