]> git.sesse.net Git - vlc/blob - modules/codec/omxil/omxil.h
Use var_Inherit* instead of var_CreateGet*.
[vlc] / modules / codec / omxil / omxil.h
1 /*****************************************************************************
2  * omxil_utils.h: helper functions
3  *****************************************************************************
4  * Copyright (C) 2010 the VideoLAN team
5  * $Id$
6  *
7  * Authors: Gildas Bazin <gbazin@videolan.org>
8  *
9  * This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 2 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 General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program; if not, write to the Free Software
21  * Foundation, 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
34 /*****************************************************************************
35  * defines
36  *****************************************************************************/
37 #define MAX_COMPONENTS_LIST_SIZE 32
38
39 /*****************************************************************************
40  * decoder_sys_t : omxil decoder descriptor
41  *****************************************************************************/
42 typedef struct OmxPort
43 {
44     bool b_valid;
45     OMX_U32 i_port_index;
46     OMX_HANDLETYPE omx_handle;
47     OMX_PARAM_PORTDEFINITIONTYPE definition;
48     es_format_t *p_fmt;
49
50     unsigned int i_frame_size;
51     unsigned int i_frame_stride;
52     unsigned int i_frame_stride_chroma_div;
53
54     unsigned int i_buffers;
55     OMX_BUFFERHEADERTYPE **pp_buffers;
56
57     struct fifo_t
58     {
59       vlc_mutex_t         lock;
60       vlc_cond_t          wait;
61
62       OMX_BUFFERHEADERTYPE *p_first;
63       OMX_BUFFERHEADERTYPE **pp_last;
64
65       int offset;
66
67     } fifo;
68
69     OmxFormatParam format_param;
70
71     OMX_BOOL b_reconfigure;
72     OMX_BOOL b_direct;
73     OMX_BOOL b_flushed;
74
75 } OmxPort;
76
77 struct decoder_sys_t
78 {
79     void *dll_handle;
80     OMX_HANDLETYPE omx_handle;
81
82     OMX_ERRORTYPE (*pf_init) (void);
83     OMX_ERRORTYPE (*pf_deinit) (void);
84     OMX_ERRORTYPE (*pf_get_handle) (OMX_HANDLETYPE *, OMX_STRING,
85                                     OMX_PTR, OMX_CALLBACKTYPE *);
86     OMX_ERRORTYPE (*pf_free_handle) (OMX_HANDLETYPE);
87     OMX_ERRORTYPE (*pf_component_enum)(OMX_STRING, OMX_U32, OMX_U32);
88     OMX_ERRORTYPE (*pf_get_roles_of_component)(OMX_STRING, OMX_U32 *, OMX_U8 **);
89
90     bool b_enc;
91     bool b_init;
92     vlc_mutex_t lock;
93
94     char psz_component[OMX_MAX_STRINGNAME_SIZE];
95     char ppsz_components[MAX_COMPONENTS_LIST_SIZE][OMX_MAX_STRINGNAME_SIZE];
96     unsigned int components;
97
98     struct OmxEvent *p_events;
99     struct OmxEvent **pp_last_event;
100
101     vlc_mutex_t mutex;
102     vlc_cond_t cond;
103
104     OmxPort *p_ports;
105     unsigned int ports;
106     OmxPort in;
107     OmxPort out;
108
109     bool b_error;
110
111     date_t end_date;
112
113     int i_nal_size_length; /* Length of the NAL size field for H264 */
114 };