winegstreamer: Avoid leaking attributes on video processor creation failure.
[wine.git] / dlls / winegstreamer / unixlib.h
blobe2eef2a4932158c5d56bc4338703745cbc0c06b4
1 /*
2 * winegstreamer Unix library interface
4 * Copyright 2020-2021 Zebediah Figura for CodeWeavers
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21 #ifndef __WINE_WINEGSTREAMER_UNIXLIB_H
22 #define __WINE_WINEGSTREAMER_UNIXLIB_H
24 #include <stdbool.h>
25 #include <stdint.h>
26 #include "windef.h"
27 #include "winternl.h"
28 #include "wtypes.h"
29 #include "mmreg.h"
31 #include "wine/unixlib.h"
33 struct wg_format
35 enum wg_major_type
37 WG_MAJOR_TYPE_UNKNOWN,
38 WG_MAJOR_TYPE_VIDEO,
39 WG_MAJOR_TYPE_AUDIO,
40 WG_MAJOR_TYPE_MPEG1_AUDIO,
41 WG_MAJOR_TYPE_WMA,
42 WG_MAJOR_TYPE_H264,
43 } major_type;
45 union
47 struct
49 enum wg_video_format
51 WG_VIDEO_FORMAT_UNKNOWN,
53 WG_VIDEO_FORMAT_BGRA,
54 WG_VIDEO_FORMAT_BGRx,
55 WG_VIDEO_FORMAT_BGR,
56 WG_VIDEO_FORMAT_RGB15,
57 WG_VIDEO_FORMAT_RGB16,
59 WG_VIDEO_FORMAT_AYUV,
60 WG_VIDEO_FORMAT_I420,
61 WG_VIDEO_FORMAT_NV12,
62 WG_VIDEO_FORMAT_UYVY,
63 WG_VIDEO_FORMAT_YUY2,
64 WG_VIDEO_FORMAT_YV12,
65 WG_VIDEO_FORMAT_YVYU,
67 WG_VIDEO_FORMAT_CINEPAK,
68 } format;
69 int32_t width, height;
70 uint32_t fps_n, fps_d;
71 RECT padding;
72 } video;
73 struct
75 enum wg_audio_format
77 WG_AUDIO_FORMAT_UNKNOWN,
79 WG_AUDIO_FORMAT_U8,
80 WG_AUDIO_FORMAT_S16LE,
81 WG_AUDIO_FORMAT_S24LE,
82 WG_AUDIO_FORMAT_S32LE,
83 WG_AUDIO_FORMAT_F32LE,
84 WG_AUDIO_FORMAT_F64LE,
85 } format;
87 uint32_t channels;
88 uint32_t channel_mask; /* In WinMM format. */
89 uint32_t rate;
90 } audio;
91 struct
93 uint32_t layer;
94 uint32_t rate;
95 uint32_t channels;
96 } mpeg1_audio;
97 struct
99 uint32_t version;
100 uint32_t bitrate;
101 uint32_t rate;
102 uint32_t depth;
103 uint32_t channels;
104 uint32_t block_align;
105 uint32_t codec_data_len;
106 unsigned char codec_data[64];
107 } wma;
108 struct
110 int32_t width, height;
111 uint32_t fps_n, fps_d;
112 uint32_t profile;
113 uint32_t level;
114 } h264;
115 } u;
118 enum wg_sample_flag
120 WG_SAMPLE_FLAG_INCOMPLETE = 1,
121 WG_SAMPLE_FLAG_HAS_PTS = 2,
122 WG_SAMPLE_FLAG_HAS_DURATION = 4,
123 WG_SAMPLE_FLAG_SYNC_POINT = 8,
126 struct wg_sample
128 /* timestamp and duration are in 100-nanosecond units. */
129 UINT64 pts;
130 UINT64 duration;
131 LONG refcount; /* unix refcount */
132 UINT32 flags;
133 UINT32 max_size;
134 UINT32 size;
135 BYTE *data;
138 struct wg_parser_buffer
140 /* pts and duration are in 100-nanosecond units. */
141 UINT64 pts, duration;
142 UINT32 size;
143 bool discontinuity, preroll, delta, has_pts, has_duration;
145 C_ASSERT(sizeof(struct wg_parser_buffer) == 32);
147 enum wg_parser_type
149 WG_PARSER_DECODEBIN,
150 WG_PARSER_AVIDEMUX,
151 WG_PARSER_MPEGAUDIOPARSE,
152 WG_PARSER_WAVPARSE,
155 struct wg_parser_create_params
157 struct wg_parser *parser;
158 enum wg_parser_type type;
159 bool unlimited_buffering;
162 struct wg_parser_connect_params
164 struct wg_parser *parser;
165 UINT64 file_size;
168 struct wg_parser_get_next_read_offset_params
170 struct wg_parser *parser;
171 UINT32 size;
172 UINT64 offset;
175 struct wg_parser_push_data_params
177 struct wg_parser *parser;
178 const void *data;
179 UINT32 size;
182 struct wg_parser_get_stream_count_params
184 struct wg_parser *parser;
185 UINT32 count;
188 struct wg_parser_get_stream_params
190 struct wg_parser *parser;
191 UINT32 index;
192 struct wg_parser_stream *stream;
195 struct wg_parser_stream_get_preferred_format_params
197 struct wg_parser_stream *stream;
198 struct wg_format *format;
201 struct wg_parser_stream_enable_params
203 struct wg_parser_stream *stream;
204 const struct wg_format *format;
207 struct wg_parser_stream_get_buffer_params
209 struct wg_parser_stream *stream;
210 struct wg_parser_buffer *buffer;
213 struct wg_parser_stream_copy_buffer_params
215 struct wg_parser_stream *stream;
216 void *data;
217 UINT32 offset;
218 UINT32 size;
221 struct wg_parser_stream_notify_qos_params
223 struct wg_parser_stream *stream;
224 bool underflow;
225 DOUBLE proportion;
226 INT64 diff;
227 UINT64 timestamp;
230 struct wg_parser_stream_get_duration_params
232 struct wg_parser_stream *stream;
233 UINT64 duration;
236 struct wg_parser_stream_seek_params
238 struct wg_parser_stream *stream;
239 DOUBLE rate;
240 UINT64 start_pos, stop_pos;
241 DWORD start_flags, stop_flags;
244 struct wg_transform_create_params
246 struct wg_transform *transform;
247 const struct wg_format *input_format;
248 const struct wg_format *output_format;
251 struct wg_transform_push_data_params
253 struct wg_transform *transform;
254 struct wg_sample *sample;
255 HRESULT result;
258 struct wg_transform_read_data_params
260 struct wg_transform *transform;
261 struct wg_sample *sample;
262 struct wg_format *format;
263 HRESULT result;
266 struct wg_transform_set_output_format_params
268 struct wg_transform *transform;
269 const struct wg_format *format;
272 enum unix_funcs
274 unix_wg_parser_create,
275 unix_wg_parser_destroy,
277 unix_wg_parser_connect,
278 unix_wg_parser_disconnect,
280 unix_wg_parser_get_next_read_offset,
281 unix_wg_parser_push_data,
283 unix_wg_parser_get_stream_count,
284 unix_wg_parser_get_stream,
286 unix_wg_parser_stream_get_preferred_format,
287 unix_wg_parser_stream_enable,
288 unix_wg_parser_stream_disable,
290 unix_wg_parser_stream_get_buffer,
291 unix_wg_parser_stream_copy_buffer,
292 unix_wg_parser_stream_release_buffer,
293 unix_wg_parser_stream_notify_qos,
295 unix_wg_parser_stream_get_duration,
296 unix_wg_parser_stream_seek,
298 unix_wg_transform_create,
299 unix_wg_transform_destroy,
300 unix_wg_transform_set_output_format,
302 unix_wg_transform_push_data,
303 unix_wg_transform_read_data,
306 #endif /* __WINE_WINEGSTREAMER_UNIXLIB_H */