]> git.sesse.net Git - vlc/blob - modules/codec/omxil/omxil.h
omxil: Factorize event queue handling to a separate struct
[vlc] / modules / codec / omxil / omxil.h
1 /*****************************************************************************
2  * omxil.h: helper functions
3  *****************************************************************************
4  * Copyright (C) 2010 VLC authors and VideoLAN
5  * $Id$
6  *
7  * Authors: Gildas Bazin <gbazin@videolan.org>
8  *
9  * This program is free software; you can redistribute it and/or modify it
10  * under the terms of the GNU Lesser General Public License as published by
11  * the Free Software Foundation; either version 2.1 of the License, or
12  * (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  * GNU Lesser General Public License for more details.
18  *
19  * You should have received a copy of the GNU Lesser General Public License
20  * along with this program; if not, write to the Free Software Foundation,
21  * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
22  *****************************************************************************/
23
24 /*****************************************************************************
25  * Includes
26  *****************************************************************************/
27 #include "OMX_Core.h"
28 #include "OMX_Index.h"
29 #include "OMX_Component.h"
30 #include "OMX_Video.h"
31
32 #include "omxil_utils.h"
33 #include "omxil_core.h"
34
35 /*****************************************************************************
36  * decoder_sys_t : omxil decoder descriptor
37  *****************************************************************************/
38 typedef struct OmxPort
39 {
40     bool b_valid;
41     OMX_U32 i_port_index;
42     OMX_HANDLETYPE omx_handle;
43     OMX_PARAM_PORTDEFINITIONTYPE definition;
44     es_format_t *p_fmt;
45
46     unsigned int i_frame_size;
47     unsigned int i_frame_stride;
48     unsigned int i_frame_stride_chroma_div;
49
50     unsigned int i_buffers;
51     OMX_BUFFERHEADERTYPE **pp_buffers;
52
53     struct fifo_t
54     {
55       vlc_mutex_t         lock;
56       vlc_cond_t          wait;
57
58       OMX_BUFFERHEADERTYPE *p_first;
59       OMX_BUFFERHEADERTYPE **pp_last;
60
61       int offset;
62
63     } fifo;
64
65     OmxFormatParam format_param;
66
67     OMX_BOOL b_reconfigure;
68     OMX_BOOL b_update_def;
69     OMX_BOOL b_direct;
70     OMX_BOOL b_flushed;
71
72 } OmxPort;
73
74 struct decoder_sys_t
75 {
76     OMX_HANDLETYPE omx_handle;
77
78     bool b_enc;
79
80     char psz_component[OMX_MAX_STRINGNAME_SIZE];
81     char ppsz_components[MAX_COMPONENTS_LIST_SIZE][OMX_MAX_STRINGNAME_SIZE];
82     unsigned int components;
83
84     OmxEventQueue event_queue;
85
86     OmxPort *p_ports;
87     unsigned int ports;
88     OmxPort in;
89     OmxPort out;
90
91     bool b_error;
92
93     date_t end_date;
94
95     size_t i_nal_size_length; /* Length of the NAL size field for H264 */
96     int b_use_pts;
97
98 };