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 MMAL_EVENTS_H |
29 | #define MMAL_EVENTS_H |
30 | |
31 | #ifdef __cplusplus |
32 | extern "C" { |
33 | #endif |
34 | |
35 | #include "mmal_common.h" |
36 | #include "mmal_parameters.h" |
37 | #include "mmal_port.h" |
38 | |
39 | /** \defgroup MmalEvents List of pre-defined event types |
40 | * This defines a list of standard event types. Components can still define proprietary |
41 | * event types by using their own FourCC and defining their own event structures. */ |
42 | /* @{ */ |
43 | |
44 | /** \name Pre-defined event FourCCs */ |
45 | /* @{ */ |
46 | |
47 | /** Error event. Data contains a \ref MMAL_STATUS_T */ |
48 | #define MMAL_EVENT_ERROR MMAL_FOURCC('E','R','R','O') |
49 | |
50 | /** End-of-stream event. Data contains a \ref MMAL_EVENT_END_OF_STREAM_T */ |
51 | #define MMAL_EVENT_EOS MMAL_FOURCC('E','E','O','S') |
52 | |
53 | /** Format changed event. Data contains a \ref MMAL_EVENT_FORMAT_CHANGED_T */ |
54 | #define MMAL_EVENT_FORMAT_CHANGED MMAL_FOURCC('E','F','C','H') |
55 | |
56 | /** Parameter changed event. Data contains the new parameter value, see |
57 | * \ref MMAL_EVENT_PARAMETER_CHANGED_T |
58 | */ |
59 | #define MMAL_EVENT_PARAMETER_CHANGED MMAL_FOURCC('E','P','C','H') |
60 | |
61 | /* @} */ |
62 | |
63 | |
64 | /** End-of-stream event. */ |
65 | typedef struct MMAL_EVENT_END_OF_STREAM_T |
66 | { |
67 | MMAL_PORT_TYPE_T port_type; /**< Type of port that received the end of stream */ |
68 | uint32_t port_index; /**< Index of port that received the end of stream */ |
69 | } MMAL_EVENT_END_OF_STREAM_T; |
70 | |
71 | /** Format changed event data. */ |
72 | typedef struct MMAL_EVENT_FORMAT_CHANGED_T |
73 | { |
74 | uint32_t buffer_size_min; /**< Minimum size of buffers the port requires */ |
75 | uint32_t buffer_num_min; /**< Minimum number of buffers the port requires */ |
76 | uint32_t buffer_size_recommended; /**< Size of buffers the port recommends for optimal performance. |
77 | A value of zero means no special recommendation. */ |
78 | uint32_t buffer_num_recommended; /**< Number of buffers the port recommends for optimal |
79 | performance. A value of zero means no special recommendation. */ |
80 | |
81 | MMAL_ES_FORMAT_T *format; /**< New elementary stream format */ |
82 | } MMAL_EVENT_FORMAT_CHANGED_T; |
83 | |
84 | /** Parameter changed event data. |
85 | * This is a variable sized event. The full parameter is included in the event |
86 | * data, not just the header. Use the \ref MMAL_PARAMETER_HEADER_T::id field to determine how to |
87 | * cast the structure. The \ref MMAL_PARAMETER_HEADER_T::size field can be used to check validity. |
88 | */ |
89 | typedef struct MMAL_EVENT_PARAMETER_CHANGED_T |
90 | { |
91 | MMAL_PARAMETER_HEADER_T hdr; |
92 | } MMAL_EVENT_PARAMETER_CHANGED_T; |
93 | |
94 | /** Get a pointer to the \ref MMAL_EVENT_FORMAT_CHANGED_T structure contained in the buffer header. |
95 | * Note that the pointer will point inside the data contained in the buffer header |
96 | * so doesn't need to be freed explicitly. |
97 | * |
98 | * @param buffer buffer header containing the MMAL_EVENT_FORMAT_CHANGED event. |
99 | * @return pointer to a MMAL_EVENT_FORMAT_CHANGED_T structure. |
100 | */ |
101 | MMAL_EVENT_FORMAT_CHANGED_T *mmal_event_format_changed_get(MMAL_BUFFER_HEADER_T *buffer); |
102 | |
103 | /* @} */ |
104 | |
105 | #ifdef __cplusplus |
106 | } |
107 | #endif |
108 | |
109 | #endif /* MMAL_EVENTS_H */ |
110 | |