From 2060f5090f7b51b46d791b6f7997857ea7dd2797 Mon Sep 17 00:00:00 2001 From: Alistair Leslie-Hughes Date: Wed, 6 Oct 2021 08:38:12 +1100 Subject: [PATCH 08/17] Revert "winegstreamer: Move Unix library definitions into a separate header." This reverts commit 84b870bb1fcac27288ed70d28de6a1c2649e9fe6. --- dlls/winegstreamer/gst_private.h | 137 ++++++++++++++++++++++++- dlls/winegstreamer/unixlib.h | 165 ------------------------------- dlls/winegstreamer/wg_parser.c | 17 +--- 3 files changed, 140 insertions(+), 179 deletions(-) delete mode 100644 dlls/winegstreamer/unixlib.h diff --git a/dlls/winegstreamer/gst_private.h b/dlls/winegstreamer/gst_private.h index 91c646571cf..3470f7870fa 100644 --- a/dlls/winegstreamer/gst_private.h +++ b/dlls/winegstreamer/gst_private.h @@ -36,8 +36,6 @@ #include "wine/debug.h" #include "wine/strmbase.h" -#include "unixlib.h" - static inline const char *debugstr_time(REFERENCE_TIME time) { ULONGLONG abstime = time >= 0 ? time : -time; @@ -61,6 +59,141 @@ static inline const char *debugstr_time(REFERENCE_TIME time) #define MEDIATIME_FROM_BYTES(x) ((LONGLONG)(x) * 10000000) +struct wg_format +{ + enum wg_major_type + { + WG_MAJOR_TYPE_UNKNOWN, + WG_MAJOR_TYPE_VIDEO, + WG_MAJOR_TYPE_AUDIO, + } major_type; + + union + { + struct + { + enum wg_video_format + { + WG_VIDEO_FORMAT_UNKNOWN, + + WG_VIDEO_FORMAT_BGRA, + WG_VIDEO_FORMAT_BGRx, + WG_VIDEO_FORMAT_BGR, + WG_VIDEO_FORMAT_RGB15, + WG_VIDEO_FORMAT_RGB16, + + WG_VIDEO_FORMAT_AYUV, + WG_VIDEO_FORMAT_I420, + WG_VIDEO_FORMAT_NV12, + WG_VIDEO_FORMAT_UYVY, + WG_VIDEO_FORMAT_YUY2, + WG_VIDEO_FORMAT_YV12, + WG_VIDEO_FORMAT_YVYU, + + WG_VIDEO_FORMAT_CINEPAK, + } format; + uint32_t width, height; + uint32_t fps_n, fps_d; + } video; + struct + { + enum wg_audio_format + { + WG_AUDIO_FORMAT_UNKNOWN, + + WG_AUDIO_FORMAT_U8, + WG_AUDIO_FORMAT_S16LE, + WG_AUDIO_FORMAT_S24LE, + WG_AUDIO_FORMAT_S32LE, + WG_AUDIO_FORMAT_F32LE, + WG_AUDIO_FORMAT_F64LE, + + WG_AUDIO_FORMAT_MPEG1_LAYER1, + WG_AUDIO_FORMAT_MPEG1_LAYER2, + WG_AUDIO_FORMAT_MPEG1_LAYER3, + } format; + + uint32_t channels; + uint32_t channel_mask; /* In WinMM format. */ + uint32_t rate; + } audio; + } u; +}; + +enum wg_parser_event_type +{ + WG_PARSER_EVENT_NONE = 0, + WG_PARSER_EVENT_BUFFER, + WG_PARSER_EVENT_EOS, + WG_PARSER_EVENT_SEGMENT, +}; + +struct wg_parser_event +{ + enum wg_parser_event_type type; + union + { + struct + { + /* pts and duration are in 100-nanosecond units. */ + ULONGLONG pts, duration; + uint32_t size; + bool discontinuity, preroll, delta, has_pts, has_duration; + } buffer; + struct + { + ULONGLONG position, stop; + DOUBLE rate; + } segment; + } u; +}; +C_ASSERT(sizeof(struct wg_parser_event) == 40); + +enum wg_parser_type +{ + WG_PARSER_DECODEBIN, + WG_PARSER_AVIDEMUX, + WG_PARSER_MPEGAUDIOPARSE, + WG_PARSER_WAVPARSE, +}; + +struct unix_funcs +{ + struct wg_parser *(CDECL *wg_parser_create)(enum wg_parser_type type, bool unlimited_buffering); + void (CDECL *wg_parser_destroy)(struct wg_parser *parser); + + HRESULT (CDECL *wg_parser_connect)(struct wg_parser *parser, uint64_t file_size); + void (CDECL *wg_parser_disconnect)(struct wg_parser *parser); + + void (CDECL *wg_parser_begin_flush)(struct wg_parser *parser); + void (CDECL *wg_parser_end_flush)(struct wg_parser *parser); + + bool (CDECL *wg_parser_get_next_read_offset)(struct wg_parser *parser, + uint64_t *offset, uint32_t *size); + void (CDECL *wg_parser_push_data)(struct wg_parser *parser, + const void *data, uint32_t size); + + uint32_t (CDECL *wg_parser_get_stream_count)(struct wg_parser *parser); + struct wg_parser_stream *(CDECL *wg_parser_get_stream)(struct wg_parser *parser, uint32_t index); + + void (CDECL *wg_parser_stream_get_preferred_format)(struct wg_parser_stream *stream, struct wg_format *format); + void (CDECL *wg_parser_stream_enable)(struct wg_parser_stream *stream, const struct wg_format *format); + void (CDECL *wg_parser_stream_disable)(struct wg_parser_stream *stream); + + bool (CDECL *wg_parser_stream_get_event)(struct wg_parser_stream *stream, struct wg_parser_event *event); + bool (CDECL *wg_parser_stream_copy_buffer)(struct wg_parser_stream *stream, + void *data, uint32_t offset, uint32_t size); + void (CDECL *wg_parser_stream_release_buffer)(struct wg_parser_stream *stream); + void (CDECL *wg_parser_stream_notify_qos)(struct wg_parser_stream *stream, + bool underflow, double proportion, int64_t diff, uint64_t timestamp); + + /* Returns the duration in 100-nanosecond units. */ + uint64_t (CDECL *wg_parser_stream_get_duration)(struct wg_parser_stream *stream); + /* start_pos and stop_pos are in 100-nanosecond units. */ + bool (CDECL *wg_parser_stream_seek)(struct wg_parser_stream *stream, double rate, + uint64_t start_pos, uint64_t stop_pos, DWORD start_flags, DWORD stop_flags); +}; + extern const struct unix_funcs *unix_funcs; HRESULT avi_splitter_create(IUnknown *outer, IUnknown **out) DECLSPEC_HIDDEN; diff --git a/dlls/winegstreamer/unixlib.h b/dlls/winegstreamer/unixlib.h deleted file mode 100644 index e917f7b5557..00000000000 --- a/dlls/winegstreamer/unixlib.h +++ /dev/null @@ -1,165 +0,0 @@ -/* - * winegstreamer Unix library interface - * - * Copyright 2020-2021 Zebediah Figura for CodeWeavers - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA - */ - -#ifndef __WINE_WINEGSTREAMER_UNIXLIB_H -#define __WINE_WINEGSTREAMER_UNIXLIB_H - -#include -#include -#include "windef.h" -#include "wtypes.h" -#include "mmreg.h" - -struct wg_format -{ - enum wg_major_type - { - WG_MAJOR_TYPE_UNKNOWN, - WG_MAJOR_TYPE_VIDEO, - WG_MAJOR_TYPE_AUDIO, - } major_type; - - union - { - struct - { - enum wg_video_format - { - WG_VIDEO_FORMAT_UNKNOWN, - - WG_VIDEO_FORMAT_BGRA, - WG_VIDEO_FORMAT_BGRx, - WG_VIDEO_FORMAT_BGR, - WG_VIDEO_FORMAT_RGB15, - WG_VIDEO_FORMAT_RGB16, - - WG_VIDEO_FORMAT_AYUV, - WG_VIDEO_FORMAT_I420, - WG_VIDEO_FORMAT_NV12, - WG_VIDEO_FORMAT_UYVY, - WG_VIDEO_FORMAT_YUY2, - WG_VIDEO_FORMAT_YV12, - WG_VIDEO_FORMAT_YVYU, - - WG_VIDEO_FORMAT_CINEPAK, - } format; - uint32_t width, height; - uint32_t fps_n, fps_d; - } video; - struct - { - enum wg_audio_format - { - WG_AUDIO_FORMAT_UNKNOWN, - - WG_AUDIO_FORMAT_U8, - WG_AUDIO_FORMAT_S16LE, - WG_AUDIO_FORMAT_S24LE, - WG_AUDIO_FORMAT_S32LE, - WG_AUDIO_FORMAT_F32LE, - WG_AUDIO_FORMAT_F64LE, - - WG_AUDIO_FORMAT_MPEG1_LAYER1, - WG_AUDIO_FORMAT_MPEG1_LAYER2, - WG_AUDIO_FORMAT_MPEG1_LAYER3, - } format; - - uint32_t channels; - uint32_t channel_mask; /* In WinMM format. */ - uint32_t rate; - } audio; - } u; -}; - -enum wg_parser_event_type -{ - WG_PARSER_EVENT_NONE = 0, - WG_PARSER_EVENT_BUFFER, - WG_PARSER_EVENT_EOS, - WG_PARSER_EVENT_SEGMENT, -}; - -struct wg_parser_event -{ - enum wg_parser_event_type type; - union - { - struct - { - /* pts and duration are in 100-nanosecond units. */ - ULONGLONG pts, duration; - uint32_t size; - bool discontinuity, preroll, delta, has_pts, has_duration; - } buffer; - struct - { - ULONGLONG position, stop; - DOUBLE rate; - } segment; - } u; -}; -C_ASSERT(sizeof(struct wg_parser_event) == 40); - -enum wg_parser_type -{ - WG_PARSER_DECODEBIN, - WG_PARSER_AVIDEMUX, - WG_PARSER_MPEGAUDIOPARSE, - WG_PARSER_WAVPARSE, -}; - -struct unix_funcs -{ - struct wg_parser *(CDECL *wg_parser_create)(enum wg_parser_type type, bool unlimited_buffering); - void (CDECL *wg_parser_destroy)(struct wg_parser *parser); - - HRESULT (CDECL *wg_parser_connect)(struct wg_parser *parser, uint64_t file_size); - void (CDECL *wg_parser_disconnect)(struct wg_parser *parser); - - void (CDECL *wg_parser_begin_flush)(struct wg_parser *parser); - void (CDECL *wg_parser_end_flush)(struct wg_parser *parser); - - bool (CDECL *wg_parser_get_next_read_offset)(struct wg_parser *parser, - uint64_t *offset, uint32_t *size); - void (CDECL *wg_parser_push_data)(struct wg_parser *parser, - const void *data, uint32_t size); - - uint32_t (CDECL *wg_parser_get_stream_count)(struct wg_parser *parser); - struct wg_parser_stream *(CDECL *wg_parser_get_stream)(struct wg_parser *parser, uint32_t index); - - void (CDECL *wg_parser_stream_get_preferred_format)(struct wg_parser_stream *stream, struct wg_format *format); - void (CDECL *wg_parser_stream_enable)(struct wg_parser_stream *stream, const struct wg_format *format); - void (CDECL *wg_parser_stream_disable)(struct wg_parser_stream *stream); - - bool (CDECL *wg_parser_stream_get_event)(struct wg_parser_stream *stream, struct wg_parser_event *event); - bool (CDECL *wg_parser_stream_copy_buffer)(struct wg_parser_stream *stream, - void *data, uint32_t offset, uint32_t size); - void (CDECL *wg_parser_stream_release_buffer)(struct wg_parser_stream *stream); - void (CDECL *wg_parser_stream_notify_qos)(struct wg_parser_stream *stream, - bool underflow, double proportion, int64_t diff, uint64_t timestamp); - - /* Returns the duration in 100-nanosecond units. */ - uint64_t (CDECL *wg_parser_stream_get_duration)(struct wg_parser_stream *stream); - /* start_pos and stop_pos are in 100-nanosecond units. */ - bool (CDECL *wg_parser_stream_seek)(struct wg_parser_stream *stream, double rate, - uint64_t start_pos, uint64_t stop_pos, DWORD start_flags, DWORD stop_flags); -}; - -#endif /* __WINE_WINEGSTREAMER_UNIXLIB_H */ diff --git a/dlls/winegstreamer/wg_parser.c b/dlls/winegstreamer/wg_parser.c index b89a50b5d8f..21278682318 100644 --- a/dlls/winegstreamer/wg_parser.c +++ b/dlls/winegstreamer/wg_parser.c @@ -25,21 +25,14 @@ #endif #include "config.h" - -#include -#include -#include - -#include -#include -#include - #include "ntstatus.h" #define WIN32_NO_STATUS +#include "gst_private.h" #include "winternl.h" -#include "dshow.h" -#include "unixlib.h" +#include +#include +#include typedef enum { @@ -1866,7 +1859,7 @@ static void init_gstreamer_once(void) if (!gst_init_check(&argc, &argv, &err)) { - fprintf(stderr, "winegstreamer: failed to initialize GStreamer: %s\n", err->message); + fprintf(stderr, "winegstreamer: failed to initialize GStreamer: %s\n", debugstr_a(err->message)); g_error_free(err); return; } -- 2.33.0