| 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 | |
| 28 | #ifndef VIDTEX_H |
| 29 | #define VIDTEX_H |
| 30 | |
| 31 | #ifdef __cplusplus |
| 32 | extern "C" { |
| 33 | #endif |
| 34 | |
| 35 | /** \file Video-on-texture display. |
| 36 | * Displays video decoded from a media URI or from camera preview onto an EGL surface. |
| 37 | */ |
| 38 | #include <EGL/egl.h> |
| 39 | #include "interface/vcos/vcos.h" |
| 40 | #include "interface/vcos/vcos_stdint.h" |
| 41 | #include "svp.h" |
| 42 | |
| 43 | /** Max length of a vidtex URI */ |
| 44 | #define VIDTEX_MAX_URI 256 |
| 45 | |
| 46 | /** Test option - create + destroy EGL image every frame */ |
| 47 | #define VIDTEX_OPT_IMG_PER_FRAME (1 << 0) |
| 48 | |
| 49 | /** Test option - display the Y' plane as greyscale texture */ |
| 50 | #define VIDTEX_OPT_Y_TEXTURE (1 << 1) |
| 51 | |
| 52 | /** Test option - display the U plane as greyscale texture */ |
| 53 | #define VIDTEX_OPT_U_TEXTURE (1 << 2) |
| 54 | |
| 55 | /** Test option - display the V plane as greyscale texture */ |
| 56 | #define VIDTEX_OPT_V_TEXTURE (1 << 3) |
| 57 | |
| 58 | /** Parameters to vidtex run. |
| 59 | * N.B. Types need to be bitwise copyable, and between C and C++, so don't use pointers, bool |
| 60 | * or anything else liable for problems. |
| 61 | */ |
| 62 | typedef struct VIDTEX_PARAMS_T |
| 63 | { |
| 64 | /** Duration of playback, in milliseconds. 0 = default, which is full duration for media and |
| 65 | * a limited duration for camera. |
| 66 | */ |
| 67 | uint32_t duration_ms; |
| 68 | |
| 69 | /** Media URI, or empty string to use camera preview */ |
| 70 | char uri[VIDTEX_MAX_URI]; |
| 71 | |
| 72 | /** Test options; bitmask of VIDTEX_OPT_XXX values */ |
| 73 | uint32_t opts; |
| 74 | } VIDTEX_PARAMS_T; |
| 75 | |
| 76 | /** Run video-on-texture. |
| 77 | * @param params Parameters to video-on-texture display. |
| 78 | * @param win Native window handle. |
| 79 | * @return 0 on success; -1 on failure. |
| 80 | * It is considered successful if the video decode completed without error and at least |
| 81 | * one EGL image was shown. |
| 82 | */ |
| 83 | int vidtex_run(const VIDTEX_PARAMS_T *params, EGLNativeWindowType win); |
| 84 | |
| 85 | #ifdef __cplusplus |
| 86 | } |
| 87 | #endif |
| 88 | |
| 89 | #endif |
| 90 | |