1 /* 2 Copyright (c) 2013, Broadcom Europe Ltd 3 Copyright (c) 2013, James Hughes 4 All rights reserved. 5 6 Redistribution and use in source and binary forms, with or without 7 modification, are permitted provided that the following conditions are met: 8 * Redistributions of source code must retain the above copyright 9 notice, this list of conditions and the following disclaimer. 10 * Redistributions in binary form must reproduce the above copyright 11 notice, this list of conditions and the following disclaimer in the 12 documentation and/or other materials provided with the distribution. 13 * Neither the name of the copyright holder nor the 14 names of its contributors may be used to endorse or promote products 15 derived from this software without specific prior written permission. 16 17 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 18 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 19 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 20 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY 21 DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 22 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 23 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 24 ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 26 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 */ 28 29 #ifndef RASPIPREVIEW_H_ 30 #define RASPIPREVIEW_H_ 31 32 /// Layer that preview window should be displayed on 33 #define PREVIEW_LAYER 2 34 35 // Frames rates of 0 implies variable, but denominator needs to be 1 to prevent div by 0 36 #define PREVIEW_FRAME_RATE_NUM 0 37 #define PREVIEW_FRAME_RATE_DEN 1 38 39 #define FULL_RES_PREVIEW_FRAME_RATE_NUM 0 40 #define FULL_RES_PREVIEW_FRAME_RATE_DEN 1 41 42 #define FULL_FOV_PREVIEW_16x9_X 1280 43 #define FULL_FOV_PREVIEW_16x9_Y 720 44 45 #define FULL_FOV_PREVIEW_4x3_X 1296 46 #define FULL_FOV_PREVIEW_4x3_Y 972 47 48 #define FULL_FOV_PREVIEW_FRAME_RATE_NUM 0 49 #define FULL_FOV_PREVIEW_FRAME_RATE_DEN 1 50 51 typedef struct 52 { 53 MMAL_COMPONENT_T *preview_component; /// Pointer to the created preview display component 54 int havePreview; /// component is preview, else null sink 55 } RASPIPREVIEW_STATE; 56 57 typedef struct 58 { 59 int wantPreview; /// Display a preview 60 int wantFullScreenPreview; /// 0 is use previewRect, non-zero to use full screen 61 int opacity; /// Opacity of window - 0 = transparent, 255 = opaque 62 MMAL_RECT_T previewWindow; /// Destination rectangle for the preview window. 63 } RASPIPREVIEW_PARAMETERS; 64 65 MMAL_STATUS_T raspipreview_create(RASPIPREVIEW_STATE *state, 66 RASPIPREVIEW_PARAMETERS *config); 67 void raspipreview_destroy(RASPIPREVIEW_STATE *state); 68 void raspipreview_set_defaults(RASPIPREVIEW_PARAMETERS *config); 69 void raspipreview_dump_parameters(RASPIPREVIEW_PARAMETERS *config); 70 int raspipreview_parse_cmdline(RASPIPREVIEW_PARAMETERS *config, const char *arg1, const char *arg2); 71 void raspipreview_display_help(); 72 MMAL_STATUS_T raspipreview_update_config (RASPIPREVIEW_STATE *state, 73 RASPIPREVIEW_PARAMETERS *config); 74 75 #endif /* RASPIPREVIEW_H_ */ 76