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__
31 #define NONAMELESSSTRUCT
32 #define NONAMELESSUNION
35 #include "wine/debug.h"
36 #include "wine/strmbase.h"
40 GST_AUTOPLUG_SELECT_TRY
,
41 GST_AUTOPLUG_SELECT_EXPOSE
,
42 GST_AUTOPLUG_SELECT_SKIP
,
43 } GstAutoplugSelectResult
;
45 static inline const char *debugstr_time(REFERENCE_TIME time
)
47 ULONGLONG abstime
= time
>= 0 ? time
: -time
;
48 unsigned int i
= 0, j
= 0;
49 char buffer
[23], rev
[23];
51 while (abstime
|| i
<= 8)
53 buffer
[i
++] = '0' + (abstime
% 10);
55 if (i
== 7) buffer
[i
++] = '.';
57 if (time
< 0) buffer
[i
++] = '-';
59 while (i
--) rev
[j
++] = buffer
[i
];
60 while (rev
[j
-1] == '0' && rev
[j
-2] != '.') --j
;
63 return wine_dbg_sprintf("%s", rev
);
66 #define MEDIATIME_FROM_BYTES(x) ((LONGLONG)(x) * 10000000)
72 WG_MAJOR_TYPE_UNKNOWN
,
83 WG_VIDEO_FORMAT_UNKNOWN
,
88 WG_VIDEO_FORMAT_RGB15
,
89 WG_VIDEO_FORMAT_RGB16
,
99 WG_VIDEO_FORMAT_CINEPAK
,
101 uint32_t width
, height
;
102 uint32_t fps_n
, fps_d
;
108 WG_AUDIO_FORMAT_UNKNOWN
,
111 WG_AUDIO_FORMAT_S16LE
,
112 WG_AUDIO_FORMAT_S24LE
,
113 WG_AUDIO_FORMAT_S32LE
,
114 WG_AUDIO_FORMAT_F32LE
,
115 WG_AUDIO_FORMAT_F64LE
,
117 WG_AUDIO_FORMAT_MPEG1_LAYER1
,
118 WG_AUDIO_FORMAT_MPEG1_LAYER2
,
119 WG_AUDIO_FORMAT_MPEG1_LAYER3
,
123 uint32_t channel_mask
; /* In WinMM format. */
129 enum wg_parser_event_type
131 WG_PARSER_EVENT_NONE
= 0,
132 WG_PARSER_EVENT_BUFFER
,
134 WG_PARSER_EVENT_SEGMENT
,
137 struct wg_parser_event
139 enum wg_parser_event_type type
;
144 /* pts and duration are in 100-nanosecond units. */
145 ULONGLONG pts
, duration
;
147 bool discontinuity
, preroll
, delta
, has_pts
, has_duration
;
151 ULONGLONG position
, stop
;
156 C_ASSERT(sizeof(struct wg_parser_event
) == 40);
160 struct wg_parser
*(CDECL
*wg_decodebin_parser_create
)(void);
161 struct wg_parser
*(CDECL
*wg_avi_parser_create
)(void);
162 struct wg_parser
*(CDECL
*wg_mpeg_audio_parser_create
)(void);
163 struct wg_parser
*(CDECL
*wg_wave_parser_create
)(void);
164 void (CDECL
*wg_parser_destroy
)(struct wg_parser
*parser
);
166 HRESULT (CDECL
*wg_parser_connect
)(struct wg_parser
*parser
, uint64_t file_size
);
167 void (CDECL
*wg_parser_disconnect
)(struct wg_parser
*parser
);
169 void (CDECL
*wg_parser_begin_flush
)(struct wg_parser
*parser
);
170 void (CDECL
*wg_parser_end_flush
)(struct wg_parser
*parser
);
172 bool (CDECL
*wg_parser_get_read_request
)(struct wg_parser
*parser
,
173 void **data
, uint64_t *offset
, uint32_t *size
);
174 void (CDECL
*wg_parser_complete_read_request
)(struct wg_parser
*parser
, bool ret
);
176 void (CDECL
*wg_parser_set_unlimited_buffering
)(struct wg_parser
*parser
);
178 uint32_t (CDECL
*wg_parser_get_stream_count
)(struct wg_parser
*parser
);
179 struct wg_parser_stream
*(CDECL
*wg_parser_get_stream
)(struct wg_parser
*parser
, uint32_t index
);
181 void (CDECL
*wg_parser_stream_get_preferred_format
)(struct wg_parser_stream
*stream
, struct wg_format
*format
);
182 void (CDECL
*wg_parser_stream_enable
)(struct wg_parser_stream
*stream
, const struct wg_format
*format
);
183 void (CDECL
*wg_parser_stream_disable
)(struct wg_parser_stream
*stream
);
185 bool (CDECL
*wg_parser_stream_get_event
)(struct wg_parser_stream
*stream
, struct wg_parser_event
*event
);
186 bool (CDECL
*wg_parser_stream_copy_buffer
)(struct wg_parser_stream
*stream
,
187 void *data
, uint32_t offset
, uint32_t size
);
188 void (CDECL
*wg_parser_stream_release_buffer
)(struct wg_parser_stream
*stream
);
189 void (CDECL
*wg_parser_stream_notify_qos
)(struct wg_parser_stream
*stream
,
190 bool underflow
, double proportion
, int64_t diff
, uint64_t timestamp
);
192 /* Returns the duration in 100-nanosecond units. */
193 uint64_t (CDECL
*wg_parser_stream_get_duration
)(struct wg_parser_stream
*stream
);
194 /* start_pos and stop_pos are in 100-nanosecond units. */
195 bool (CDECL
*wg_parser_stream_seek
)(struct wg_parser_stream
*stream
, double rate
,
196 uint64_t start_pos
, uint64_t stop_pos
, DWORD start_flags
, DWORD stop_flags
);
199 extern const struct unix_funcs
*unix_funcs
;
201 extern LONG object_locks
;
203 HRESULT
avi_splitter_create(IUnknown
*outer
, IUnknown
**out
) DECLSPEC_HIDDEN
;
204 HRESULT
decodebin_parser_create(IUnknown
*outer
, IUnknown
**out
) DECLSPEC_HIDDEN
;
205 HRESULT
mpeg_splitter_create(IUnknown
*outer
, IUnknown
**out
) DECLSPEC_HIDDEN
;
206 HRESULT
wave_parser_create(IUnknown
*outer
, IUnknown
**out
) DECLSPEC_HIDDEN
;
208 BOOL
init_gstreamer(void) DECLSPEC_HIDDEN
;
210 void start_dispatch_thread(void) DECLSPEC_HIDDEN
;
212 extern HRESULT
mfplat_get_class_object(REFCLSID rclsid
, REFIID riid
, void **obj
) DECLSPEC_HIDDEN
;
213 extern HRESULT
mfplat_DllRegisterServer(void) DECLSPEC_HIDDEN
;
215 IMFMediaType
*mf_media_type_from_wg_format(const struct wg_format
*format
) DECLSPEC_HIDDEN
;
216 void mf_media_type_to_wg_format(IMFMediaType
*type
, struct wg_format
*format
) DECLSPEC_HIDDEN
;
218 HRESULT
winegstreamer_stream_handler_create(REFIID riid
, void **obj
) DECLSPEC_HIDDEN
;
220 HRESULT
audio_converter_create(REFIID riid
, void **ret
) DECLSPEC_HIDDEN
;
222 #endif /* __GST_PRIVATE_INCLUDED__ */