| 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 | /** \file | 
| 29 |  * MMAL test application which plays back video files | 
| 30 |  * Note: this is test code. Do not use this in your app. It *will* change or even be removed without notice. | 
| 31 |  */ | 
| 32 |  | 
| 33 | #include "interface/mmal/mmal.h" | 
| 34 |  | 
| 35 | #define VCOS_LOG_CATEGORY (&mmalplay_log_category) | 
| 36 | #include "interface/vcos/vcos.h" | 
| 37 |  | 
| 38 | extern VCOS_LOG_CAT_T mmalplay_log_category; | 
| 39 |  | 
| 40 | /** MMALPLAY instance id. | 
| 41 |  */ | 
| 42 | typedef struct MMALPLAY_T MMALPLAY_T; | 
| 43 |  | 
| 44 | /** MMALPLAY configuration options. | 
| 45 |  */ | 
| 46 | typedef struct { | 
| 47 |    uint32_t output_format; | 
| 48 |    MMAL_RECT_T output_rect; | 
| 49 |    uint32_t render_format; | 
| 50 |    MMAL_RECT_T render_rect; | 
| 51 |    uint32_t render_layer; | 
| 52 |  | 
| 53 |    int copy_input; | 
| 54 |    int copy_output; | 
| 55 |  | 
| 56 |    int tunnelling; | 
| 57 |    unsigned int output_num; | 
| 58 |  | 
| 59 |    int disable_playback; | 
| 60 |    int disable_video; | 
| 61 |    int disable_audio; | 
| 62 |    int enable_scheduling; | 
| 63 |    int disable_video_decode; | 
| 64 |  | 
| 65 |    const char *component_container_reader; | 
| 66 |    const char *component_video_decoder; | 
| 67 |    const char *component_splitter; | 
| 68 |    const char *component_video_render; | 
| 69 |    const char *component_video_converter; | 
| 70 |    const char *component_video_scheduler; | 
| 71 |  | 
| 72 |    const char *component_audio_decoder; | 
| 73 |    const char *component_audio_render; | 
| 74 |  | 
| 75 |    const char *audio_destination; | 
| 76 |    unsigned int video_destination; | 
| 77 |  | 
| 78 |    const char *output_uri; | 
| 79 |  | 
| 80 |    int window; | 
| 81 |  | 
| 82 |    float seeking; | 
| 83 |    int stepping; | 
| 84 |  | 
| 85 |    int audio_passthrough; | 
| 86 | } MMALPLAY_OPTIONS_T; | 
| 87 |  | 
| 88 | /** Create an instance of mmalplay. | 
| 89 |  * | 
| 90 |  * @param uri URI for the video stream to play | 
| 91 |  * @param opts configuration options for the instance to be created | 
| 92 |  * @param status status of the operation | 
| 93 |  * | 
| 94 |  * @return a MMALPLAY_T instance id on success | 
| 95 |  */ | 
| 96 | MMALPLAY_T *mmalplay_create(const char *uri, MMALPLAY_OPTIONS_T *opts, MMAL_STATUS_T *status); | 
| 97 |  | 
| 98 | /** Start playback on an instance of mmalplay. | 
| 99 |  * | 
| 100 |  * @param MMALPLAY instance id | 
| 101 |  * | 
| 102 |  * @return MMAL_SUCCESS on success | 
| 103 |  */ | 
| 104 | MMAL_STATUS_T mmalplay_play(MMALPLAY_T *ctx); | 
| 105 |  | 
| 106 | /** Stop the playback on an instance of mmalplay. | 
| 107 |  * | 
| 108 |  * @param MMALPLAY instance id | 
| 109 |  */ | 
| 110 | void mmalplay_stop(MMALPLAY_T *ctx); | 
| 111 |  | 
| 112 | /** Destroys an instance of mmalplay. | 
| 113 |  * | 
| 114 |  * @param MMALPLAY instance id | 
| 115 |  */ | 
| 116 | void mmalplay_destroy(MMALPLAY_T *ctx); | 
| 117 |  |