include/mscvpdb.h: Use flexible array members for the rest of structures.
[wine.git] / dlls / winegstreamer / gst_private.h
blob0f7d945ba37bbed468d33a16c08881e0aa79ef0c
1 /*
2 * GStreamer splitter + decoder, adapted from parser.c
4 * Copyright 2010 Maarten Lankhorst 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 __GST_PRIVATE_INCLUDED__
22 #define __GST_PRIVATE_INCLUDED__
24 #include <assert.h>
25 #include <limits.h>
26 #include <stdarg.h>
27 #include <stdbool.h>
28 #include <stdint.h>
29 #include <stdio.h>
31 #define COBJMACROS
32 #define NONAMELESSSTRUCT
33 #define NONAMELESSUNION
34 #include "dshow.h"
35 #include "mfidl.h"
36 #include "wine/debug.h"
37 #include "wine/strmbase.h"
38 #include "wine/mfinternal.h"
40 #include "unixlib.h"
42 bool array_reserve(void **elements, size_t *capacity, size_t count, size_t size);
44 #define MEDIATIME_FROM_BYTES(x) ((LONGLONG)(x) * 10000000)
46 static inline BOOL is_mf_video_area_empty(const MFVideoArea *area)
48 return !area->OffsetX.value && !area->OffsetY.value && !area->Area.cx && !area->Area.cy;
51 static inline void get_mf_video_content_rect(const MFVideoInfo *info, RECT *rect)
53 if (!is_mf_video_area_empty(&info->MinimumDisplayAperture))
55 rect->left = info->MinimumDisplayAperture.OffsetX.value;
56 rect->top = info->MinimumDisplayAperture.OffsetY.value;
57 rect->right = rect->left + info->MinimumDisplayAperture.Area.cx;
58 rect->bottom = rect->top + info->MinimumDisplayAperture.Area.cy;
60 else
62 rect->left = 0;
63 rect->top = 0;
64 rect->right = info->dwWidth;
65 rect->bottom = info->dwHeight;
69 struct wg_sample_queue;
71 HRESULT wg_sample_queue_create(struct wg_sample_queue **out);
72 void wg_sample_queue_destroy(struct wg_sample_queue *queue);
73 void wg_sample_queue_flush(struct wg_sample_queue *queue, bool all);
75 wg_parser_t wg_parser_create(bool output_compressed);
76 void wg_parser_destroy(wg_parser_t parser);
78 HRESULT wg_parser_connect(wg_parser_t parser, uint64_t file_size, const WCHAR *uri);
79 void wg_parser_disconnect(wg_parser_t parser);
81 bool wg_parser_get_next_read_offset(wg_parser_t parser, uint64_t *offset, uint32_t *size);
82 void wg_parser_push_data(wg_parser_t parser, const void *data, uint32_t size);
84 uint32_t wg_parser_get_stream_count(wg_parser_t parser);
85 wg_parser_stream_t wg_parser_get_stream(wg_parser_t parser, uint32_t index);
87 void wg_parser_stream_get_current_format(wg_parser_stream_t stream, struct wg_format *format);
88 void wg_parser_stream_get_codec_format(wg_parser_stream_t stream, struct wg_format *format);
89 void wg_parser_stream_enable(wg_parser_stream_t stream, const struct wg_format *format);
90 void wg_parser_stream_disable(wg_parser_stream_t stream);
92 bool wg_parser_stream_get_buffer(wg_parser_t parser, wg_parser_stream_t stream,
93 struct wg_parser_buffer *buffer);
94 bool wg_parser_stream_copy_buffer(wg_parser_stream_t stream,
95 void *data, uint32_t offset, uint32_t size);
96 void wg_parser_stream_release_buffer(wg_parser_stream_t stream);
97 void wg_parser_stream_notify_qos(wg_parser_stream_t stream,
98 bool underflow, double proportion, int64_t diff, uint64_t timestamp);
100 /* Returns the duration in 100-nanosecond units. */
101 uint64_t wg_parser_stream_get_duration(wg_parser_stream_t stream);
102 char *wg_parser_stream_get_tag(wg_parser_stream_t stream, enum wg_parser_tag tag);
103 /* start_pos and stop_pos are in 100-nanosecond units. */
104 void wg_parser_stream_seek(wg_parser_stream_t stream, double rate,
105 uint64_t start_pos, uint64_t stop_pos, DWORD start_flags, DWORD stop_flags);
107 HRESULT wg_transform_create_mf(IMFMediaType *input_type, IMFMediaType *output_type,
108 const struct wg_transform_attrs *attrs, wg_transform_t *transform);
109 HRESULT wg_transform_create_quartz(const AM_MEDIA_TYPE *input_format, const AM_MEDIA_TYPE *output_format,
110 const struct wg_transform_attrs *attrs, wg_transform_t *transform);
111 void wg_transform_destroy(wg_transform_t transform);
112 HRESULT wg_transform_get_output_type(wg_transform_t transform, IMFMediaType **media_type);
113 HRESULT wg_transform_set_output_type(wg_transform_t transform, IMFMediaType *media_type);
114 bool wg_transform_get_status(wg_transform_t transform, bool *accepts_input);
115 HRESULT wg_transform_drain(wg_transform_t transform);
116 HRESULT wg_transform_flush(wg_transform_t transform);
117 void wg_transform_notify_qos(wg_transform_t transform,
118 bool underflow, double proportion, int64_t diff, uint64_t timestamp);
120 HRESULT check_audio_transform_support(const WAVEFORMATEX *input, const WAVEFORMATEX *output);
121 HRESULT check_video_transform_support(const MFVIDEOFORMAT *input, const MFVIDEOFORMAT *output);
123 HRESULT wg_muxer_create(const char *format, wg_muxer_t *muxer);
124 void wg_muxer_destroy(wg_muxer_t muxer);
125 HRESULT wg_muxer_add_stream(wg_muxer_t muxer, UINT32 stream_id, const struct wg_format *format);
126 HRESULT wg_muxer_start(wg_muxer_t muxer);
127 HRESULT wg_muxer_push_sample(wg_muxer_t muxer, struct wg_sample *sample, UINT32 stream_id);
128 HRESULT wg_muxer_read_data(wg_muxer_t muxer, void *buffer, UINT32 *size, UINT64 *offset);
129 HRESULT wg_muxer_finalize(wg_muxer_t muxer);
131 unsigned int wg_format_get_bytes_for_uncompressed(wg_video_format format, unsigned int width, unsigned int height);
132 unsigned int wg_format_get_max_size(const struct wg_format *format);
134 HRESULT avi_splitter_create(IUnknown *outer, IUnknown **out);
135 HRESULT decodebin_parser_create(IUnknown *outer, IUnknown **out);
136 HRESULT mpeg_audio_codec_create(IUnknown *outer, IUnknown **out);
137 HRESULT mpeg_video_codec_create(IUnknown *outer, IUnknown **out);
138 HRESULT mpeg_layer3_decoder_create(IUnknown *outer, IUnknown **out);
139 HRESULT mpeg_splitter_create(IUnknown *outer, IUnknown **out);
140 HRESULT wave_parser_create(IUnknown *outer, IUnknown **out);
141 HRESULT wma_decoder_create(IUnknown *outer, IUnknown **out);
142 HRESULT wmv_decoder_create(IUnknown *outer, IUnknown **out);
143 HRESULT resampler_create(IUnknown *outer, IUnknown **out);
144 HRESULT color_convert_create(IUnknown *outer, IUnknown **out);
145 HRESULT mp3_sink_class_factory_create(IUnknown *outer, IUnknown **out);
146 HRESULT mpeg4_sink_class_factory_create(IUnknown *outer, IUnknown **out);
148 bool amt_from_wg_format(AM_MEDIA_TYPE *mt, const struct wg_format *format, bool wm);
149 bool amt_to_wg_format(const AM_MEDIA_TYPE *mt, struct wg_format *format);
151 BOOL init_gstreamer(void);
153 extern HRESULT mfplat_get_class_object(REFCLSID rclsid, REFIID riid, void **obj);
154 extern HRESULT mfplat_DllRegisterServer(void);
156 IMFMediaType *mf_media_type_from_wg_format(const struct wg_format *format);
157 void mf_media_type_to_wg_format(IMFMediaType *type, struct wg_format *format);
159 HRESULT wg_sample_create_mf(IMFSample *sample, struct wg_sample **out);
160 HRESULT wg_sample_create_quartz(IMediaSample *sample, struct wg_sample **out);
161 HRESULT wg_sample_create_dmo(IMediaBuffer *media_buffer, struct wg_sample **out);
162 void wg_sample_release(struct wg_sample *wg_sample);
164 HRESULT wg_transform_push_mf(wg_transform_t transform, IMFSample *sample,
165 struct wg_sample_queue *queue);
166 HRESULT wg_transform_push_quartz(wg_transform_t transform, struct wg_sample *sample,
167 struct wg_sample_queue *queue);
168 HRESULT wg_transform_push_dmo(wg_transform_t transform, IMediaBuffer *media_buffer,
169 DWORD flags, REFERENCE_TIME time_stamp, REFERENCE_TIME time_length, struct wg_sample_queue *queue);
170 HRESULT wg_transform_read_mf(wg_transform_t transform, IMFSample *sample,
171 DWORD sample_size, DWORD *flags);
172 HRESULT wg_transform_read_quartz(wg_transform_t transform, struct wg_sample *sample);
173 HRESULT wg_transform_read_dmo(wg_transform_t transform, DMO_OUTPUT_DATA_BUFFER *buffer);
175 /* These unixlib entry points should not be used directly, they assume samples
176 * to be queued and zero-copy support, use the helpers below instead.
178 HRESULT wg_transform_push_data(wg_transform_t transform, struct wg_sample *sample);
179 HRESULT wg_transform_read_data(wg_transform_t transform, struct wg_sample *sample);
181 HRESULT gstreamer_byte_stream_handler_create(REFIID riid, void **obj);
183 unsigned int wg_format_get_stride(const struct wg_format *format);
185 bool wg_video_format_is_rgb(enum wg_video_format format);
187 HRESULT aac_decoder_create(REFIID riid, void **ret);
188 HRESULT h264_decoder_create(REFIID riid, void **ret);
189 HRESULT video_processor_create(REFIID riid, void **ret);
191 HRESULT h264_encoder_create(REFIID riid, void **ret);
193 extern const GUID MFAudioFormat_RAW_AAC;
195 #endif /* __GST_PRIVATE_INCLUDED__ */