MMAL_3-15-2015
mmal_port_private.h
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_PORT_PRIVATE_H
29 #define MMAL_PORT_PRIVATE_H
30 
31 #include "interface/mmal/mmal.h"
32 #include "interface/mmal/mmal_clock.h"
33 #include "interface/mmal/core/mmal_events_private.h"
34 
35 #ifdef __cplusplus
36 extern "C" {
37 #endif
38 
40 typedef struct MMAL_PORT_PRIVATE_T
41 {
43  struct MMAL_PORT_PRIVATE_CORE_T *core;
45  struct MMAL_PORT_MODULE_T *module;
47  struct MMAL_PORT_CLOCK_T *clock;
48 
49  MMAL_STATUS_T (*pf_set_format)(MMAL_PORT_T *port);
50  MMAL_STATUS_T (*pf_enable)(MMAL_PORT_T *port, MMAL_PORT_BH_CB_T);
51  MMAL_STATUS_T (*pf_disable)(MMAL_PORT_T *port);
52  MMAL_STATUS_T (*pf_send)(MMAL_PORT_T *port, MMAL_BUFFER_HEADER_T *);
53  MMAL_STATUS_T (*pf_flush)(MMAL_PORT_T *port);
54  MMAL_STATUS_T (*pf_parameter_set)(MMAL_PORT_T *port, const MMAL_PARAMETER_HEADER_T *param);
55  MMAL_STATUS_T (*pf_parameter_get)(MMAL_PORT_T *port, MMAL_PARAMETER_HEADER_T *param);
56  MMAL_STATUS_T (*pf_connect)(MMAL_PORT_T *port, MMAL_PORT_T *other_port);
57 
58  uint8_t *(*pf_payload_alloc)(MMAL_PORT_T *port, uint32_t payload_size);
59  void (*pf_payload_free)(MMAL_PORT_T *port, uint8_t *payload);
60 
62 
65 void mmal_port_buffer_header_callback(MMAL_PORT_T *port, MMAL_BUFFER_HEADER_T *buffer);
66 
70 void mmal_port_event_send(MMAL_PORT_T *port, MMAL_BUFFER_HEADER_T *buffer);
71 
73 MMAL_PORT_T *mmal_port_alloc(MMAL_COMPONENT_T *, MMAL_PORT_TYPE_T type, unsigned int extra_size);
75 void mmal_port_free(MMAL_PORT_T *port);
77 MMAL_PORT_T **mmal_ports_alloc(MMAL_COMPONENT_T *, unsigned int ports_num, MMAL_PORT_TYPE_T type,
78  unsigned int extra_size);
80 void mmal_ports_free(MMAL_PORT_T **ports, unsigned int ports_num);
81 
83 void mmal_port_acquire(MMAL_PORT_T *port);
84 
86 MMAL_STATUS_T mmal_port_release(MMAL_PORT_T *port);
87 
89 MMAL_STATUS_T mmal_port_pause(MMAL_PORT_T *port, MMAL_BOOL_T pause);
90 
92 MMAL_BOOL_T mmal_port_is_connected(MMAL_PORT_T *port);
93 
94 /*****************************************************************************
95  * Clock Port API
96  *****************************************************************************/
103 typedef void (*MMAL_PORT_CLOCK_EVENT_CB)(MMAL_PORT_T *port, const MMAL_CLOCK_EVENT_T *event);
104 
113 MMAL_PORT_T* mmal_port_clock_alloc(MMAL_COMPONENT_T *component, unsigned int extra_size,
114  MMAL_PORT_CLOCK_EVENT_CB event_cb);
115 
120 void mmal_port_clock_free(MMAL_PORT_T *port);
121 
131 MMAL_PORT_T **mmal_ports_clock_alloc(MMAL_COMPONENT_T *component, unsigned int ports_num,
132  unsigned int extra_size, MMAL_PORT_CLOCK_EVENT_CB event_cb);
133 
139 void mmal_ports_clock_free(MMAL_PORT_T **ports, unsigned int ports_num);
140 
148 typedef void (*MMAL_PORT_CLOCK_REQUEST_CB)(MMAL_PORT_T *port, int64_t media_time, void *cb_data);
149 
160 MMAL_STATUS_T mmal_port_clock_request_add(MMAL_PORT_T *port, int64_t media_time,
161  MMAL_PORT_CLOCK_REQUEST_CB cb, void *cb_data);
162 
169 MMAL_STATUS_T mmal_port_clock_request_flush(MMAL_PORT_T *port);
170 
172 MMAL_STATUS_T mmal_port_clock_reference_set(MMAL_PORT_T *port, MMAL_BOOL_T reference);
173 MMAL_BOOL_T mmal_port_clock_reference_get(MMAL_PORT_T *port);
174 
176 MMAL_STATUS_T mmal_port_clock_active_set(MMAL_PORT_T *port, MMAL_BOOL_T active);
177 MMAL_BOOL_T mmal_port_clock_active_get(MMAL_PORT_T *port);
178 
180 MMAL_STATUS_T mmal_port_clock_scale_set(MMAL_PORT_T *port, MMAL_RATIONAL_T scale);
181 MMAL_RATIONAL_T mmal_port_clock_scale_get(MMAL_PORT_T *port);
182 
184 MMAL_STATUS_T mmal_port_clock_media_time_set(MMAL_PORT_T *port, int64_t media_time);
185 int64_t mmal_port_clock_media_time_get(MMAL_PORT_T *port);
186 
188 MMAL_STATUS_T mmal_port_clock_update_threshold_set(MMAL_PORT_T *port,
189  const MMAL_CLOCK_UPDATE_THRESHOLD_T *threshold);
190 MMAL_STATUS_T mmal_port_clock_update_threshold_get(MMAL_PORT_T *port,
191  MMAL_CLOCK_UPDATE_THRESHOLD_T *threshold);
192 
194 MMAL_STATUS_T mmal_port_clock_discont_threshold_set(MMAL_PORT_T *port,
195  const MMAL_CLOCK_DISCONT_THRESHOLD_T *threshold);
196 MMAL_STATUS_T mmal_port_clock_discont_threshold_get(MMAL_PORT_T *port,
197  MMAL_CLOCK_DISCONT_THRESHOLD_T *threshold);
198 
200 MMAL_STATUS_T mmal_port_clock_request_threshold_set(MMAL_PORT_T *port,
201  const MMAL_CLOCK_REQUEST_THRESHOLD_T *threshold);
202 MMAL_STATUS_T mmal_port_clock_request_threshold_get(MMAL_PORT_T *port,
203  MMAL_CLOCK_REQUEST_THRESHOLD_T *threshold);
204 
206 void mmal_port_clock_input_buffer_info(MMAL_PORT_T *port, const MMAL_CLOCK_BUFFER_INFO_T *info);
207 void mmal_port_clock_output_buffer_info(MMAL_PORT_T *port, const MMAL_CLOCK_BUFFER_INFO_T *info);
208 
209 #ifdef __cplusplus
210 }
211 #endif
212 
213 #endif /* MMAL_PORT_PRIVATE_H */
Definition: mmal_port_private.h:40
struct MMAL_PORT_MODULE_T * module
Definition: mmal_port_private.h:45
void(* MMAL_PORT_BH_CB_T)(MMAL_PORT_T *port, MMAL_BUFFER_HEADER_T *buffer)
Definition: mmal_port.h:132
Definition: mmal_port.h:79
MMAL_PORT_TYPE_T
Definition: mmal_port.h:45
Definition: mmal_clock.h:113
Definition: mmal_component.h:48
Definition: mmal_types.h:78
Definition: mmal_clock.h:151
Definition: mmal_parameters_common.h:86
Definition: mmal_clock.h:103
Definition: mmal_clock.h:124
Definition: mmal_buffer.h:69
Definition: mmal_clock.h:135
struct MMAL_PORT_PRIVATE_CORE_T * core
Definition: mmal_port_private.h:43
MMAL_STATUS_T
Definition: mmal_types.h:46
struct MMAL_PORT_CLOCK_T * clock
Definition: mmal_port_private.h:47