2021-10-05 00:20:49 +00:00
|
|
|
/*
|
|
|
|
* 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 <stdint.h>
|
|
|
|
#include "windef.h"
|
2021-10-05 00:20:51 +00:00
|
|
|
#include "winternl.h"
|
2021-10-05 00:20:49 +00:00
|
|
|
#include "wtypes.h"
|
|
|
|
#include "mmreg.h"
|
|
|
|
|
2021-10-05 00:20:51 +00:00
|
|
|
#include "wine/unixlib.h"
|
|
|
|
|
2023-07-08 03:41:36 +00:00
|
|
|
typedef UINT32 wg_major_type;
|
|
|
|
enum wg_major_type
|
|
|
|
{
|
|
|
|
WG_MAJOR_TYPE_UNKNOWN = 0,
|
|
|
|
WG_MAJOR_TYPE_AUDIO,
|
|
|
|
WG_MAJOR_TYPE_AUDIO_MPEG1,
|
|
|
|
WG_MAJOR_TYPE_AUDIO_MPEG4,
|
|
|
|
WG_MAJOR_TYPE_AUDIO_WMA,
|
|
|
|
WG_MAJOR_TYPE_VIDEO,
|
|
|
|
WG_MAJOR_TYPE_VIDEO_CINEPAK,
|
|
|
|
WG_MAJOR_TYPE_VIDEO_H264,
|
|
|
|
WG_MAJOR_TYPE_VIDEO_WMV,
|
|
|
|
WG_MAJOR_TYPE_VIDEO_INDEO,
|
|
|
|
};
|
|
|
|
|
|
|
|
typedef UINT32 wg_audio_format;
|
|
|
|
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,
|
|
|
|
};
|
|
|
|
|
|
|
|
typedef UINT32 wg_video_format;
|
|
|
|
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,
|
|
|
|
};
|
|
|
|
|
|
|
|
typedef UINT32 wg_wmv_video_format;
|
|
|
|
enum wg_wmv_video_format
|
|
|
|
{
|
|
|
|
WG_WMV_VIDEO_FORMAT_UNKNOWN,
|
|
|
|
WG_WMV_VIDEO_FORMAT_WMV1,
|
|
|
|
WG_WMV_VIDEO_FORMAT_WMV2,
|
|
|
|
WG_WMV_VIDEO_FORMAT_WMV3,
|
|
|
|
WG_WMV_VIDEO_FORMAT_WMVA,
|
|
|
|
WG_WMV_VIDEO_FORMAT_WVC1,
|
|
|
|
};
|
|
|
|
|
2021-10-05 00:20:49 +00:00
|
|
|
struct wg_format
|
|
|
|
{
|
2023-07-08 03:41:36 +00:00
|
|
|
wg_major_type major_type;
|
2021-10-05 00:20:49 +00:00
|
|
|
|
|
|
|
union
|
|
|
|
{
|
|
|
|
struct
|
|
|
|
{
|
2023-07-08 03:41:36 +00:00
|
|
|
wg_audio_format format;
|
2021-10-05 00:20:49 +00:00
|
|
|
|
|
|
|
uint32_t channels;
|
|
|
|
uint32_t channel_mask; /* In WinMM format. */
|
|
|
|
uint32_t rate;
|
|
|
|
} audio;
|
2022-02-16 11:19:07 +00:00
|
|
|
struct
|
2022-05-05 22:24:30 +00:00
|
|
|
{
|
|
|
|
uint32_t layer;
|
|
|
|
uint32_t rate;
|
|
|
|
uint32_t channels;
|
2022-09-26 10:36:49 +00:00
|
|
|
} audio_mpeg1;
|
2022-05-05 22:24:30 +00:00
|
|
|
struct
|
2022-09-26 10:45:14 +00:00
|
|
|
{
|
|
|
|
uint32_t payload_type;
|
|
|
|
uint32_t codec_data_len;
|
|
|
|
unsigned char codec_data[64];
|
|
|
|
} audio_mpeg4;
|
|
|
|
struct
|
2022-02-16 11:19:07 +00:00
|
|
|
{
|
|
|
|
uint32_t version;
|
|
|
|
uint32_t bitrate;
|
|
|
|
uint32_t rate;
|
|
|
|
uint32_t depth;
|
|
|
|
uint32_t channels;
|
|
|
|
uint32_t block_align;
|
|
|
|
uint32_t codec_data_len;
|
|
|
|
unsigned char codec_data[64];
|
2022-09-26 10:40:23 +00:00
|
|
|
} audio_wma;
|
2022-09-26 10:44:08 +00:00
|
|
|
|
|
|
|
struct
|
|
|
|
{
|
2023-07-08 03:41:36 +00:00
|
|
|
wg_video_format format;
|
2023-01-24 22:03:37 +00:00
|
|
|
/* Positive height indicates top-down video; negative height
|
|
|
|
* indicates bottom-up video. */
|
2022-09-26 10:44:08 +00:00
|
|
|
int32_t width, height;
|
|
|
|
uint32_t fps_n, fps_d;
|
|
|
|
RECT padding;
|
|
|
|
} video;
|
2022-03-28 15:35:45 +00:00
|
|
|
struct
|
2022-09-26 10:19:55 +00:00
|
|
|
{
|
|
|
|
uint32_t width;
|
|
|
|
uint32_t height;
|
|
|
|
uint32_t fps_n;
|
|
|
|
uint32_t fps_d;
|
|
|
|
} video_cinepak;
|
|
|
|
struct
|
2022-03-28 15:35:45 +00:00
|
|
|
{
|
|
|
|
int32_t width, height;
|
|
|
|
uint32_t fps_n, fps_d;
|
|
|
|
uint32_t profile;
|
|
|
|
uint32_t level;
|
2022-09-26 10:41:18 +00:00
|
|
|
} video_h264;
|
2022-11-25 04:33:28 +00:00
|
|
|
struct
|
|
|
|
{
|
2023-07-08 03:41:36 +00:00
|
|
|
wg_wmv_video_format format;
|
2022-11-25 04:33:28 +00:00
|
|
|
int32_t width, height;
|
|
|
|
uint32_t fps_n, fps_d;
|
|
|
|
} video_wmv;
|
2023-01-13 21:33:29 +00:00
|
|
|
struct
|
|
|
|
{
|
|
|
|
int32_t width, height;
|
|
|
|
uint32_t fps_n, fps_d;
|
|
|
|
uint32_t version;
|
|
|
|
} video_indeo;
|
2021-10-05 00:20:49 +00:00
|
|
|
} u;
|
|
|
|
};
|
|
|
|
|
2022-03-14 13:43:22 +00:00
|
|
|
enum wg_sample_flag
|
|
|
|
{
|
|
|
|
WG_SAMPLE_FLAG_INCOMPLETE = 1,
|
2022-04-24 22:36:32 +00:00
|
|
|
WG_SAMPLE_FLAG_HAS_PTS = 2,
|
|
|
|
WG_SAMPLE_FLAG_HAS_DURATION = 4,
|
2022-04-03 17:13:22 +00:00
|
|
|
WG_SAMPLE_FLAG_SYNC_POINT = 8,
|
2022-10-11 07:06:52 +00:00
|
|
|
WG_SAMPLE_FLAG_DISCONTINUITY = 0x10,
|
2022-03-14 13:43:22 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct wg_sample
|
|
|
|
{
|
2022-04-24 22:36:32 +00:00
|
|
|
/* timestamp and duration are in 100-nanosecond units. */
|
|
|
|
UINT64 pts;
|
|
|
|
UINT64 duration;
|
2022-06-06 15:09:18 +00:00
|
|
|
LONG refcount; /* unix refcount */
|
2022-03-14 13:43:22 +00:00
|
|
|
UINT32 flags;
|
|
|
|
UINT32 max_size;
|
|
|
|
UINT32 size;
|
2023-07-24 12:39:14 +00:00
|
|
|
UINT64 data; /* pointer to user memory */
|
2022-03-14 13:43:22 +00:00
|
|
|
};
|
|
|
|
|
2022-02-23 21:46:50 +00:00
|
|
|
struct wg_parser_buffer
|
2021-10-05 00:20:49 +00:00
|
|
|
{
|
2022-02-23 21:46:50 +00:00
|
|
|
/* pts and duration are in 100-nanosecond units. */
|
|
|
|
UINT64 pts, duration;
|
|
|
|
UINT32 size;
|
2022-09-23 10:31:54 +00:00
|
|
|
UINT32 stream;
|
2023-07-08 03:41:36 +00:00
|
|
|
UINT8 discontinuity, preroll, delta, has_pts, has_duration;
|
2021-10-05 00:20:49 +00:00
|
|
|
};
|
2022-02-23 21:46:50 +00:00
|
|
|
C_ASSERT(sizeof(struct wg_parser_buffer) == 32);
|
2021-10-05 00:20:49 +00:00
|
|
|
|
2023-07-08 03:41:36 +00:00
|
|
|
typedef UINT32 wg_parser_type;
|
2021-10-05 00:20:49 +00:00
|
|
|
enum wg_parser_type
|
|
|
|
{
|
|
|
|
WG_PARSER_DECODEBIN,
|
|
|
|
WG_PARSER_AVIDEMUX,
|
|
|
|
WG_PARSER_MPEGAUDIOPARSE,
|
|
|
|
WG_PARSER_WAVPARSE,
|
|
|
|
};
|
|
|
|
|
2023-07-08 03:32:21 +00:00
|
|
|
typedef UINT64 wg_parser_t;
|
|
|
|
typedef UINT64 wg_parser_stream_t;
|
|
|
|
typedef UINT64 wg_transform_t;
|
|
|
|
|
2021-10-05 00:20:51 +00:00
|
|
|
struct wg_parser_create_params
|
|
|
|
{
|
2023-07-08 03:32:21 +00:00
|
|
|
wg_parser_t parser;
|
2023-07-08 03:41:36 +00:00
|
|
|
wg_parser_type type;
|
|
|
|
UINT8 err_on;
|
|
|
|
UINT8 warn_on;
|
2021-10-05 00:20:51 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct wg_parser_connect_params
|
|
|
|
{
|
2023-07-08 03:32:21 +00:00
|
|
|
wg_parser_t parser;
|
2021-10-05 00:20:51 +00:00
|
|
|
UINT64 file_size;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct wg_parser_get_next_read_offset_params
|
|
|
|
{
|
2023-07-08 03:32:21 +00:00
|
|
|
wg_parser_t parser;
|
2021-10-05 00:20:51 +00:00
|
|
|
UINT32 size;
|
|
|
|
UINT64 offset;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct wg_parser_push_data_params
|
|
|
|
{
|
2023-07-08 03:32:21 +00:00
|
|
|
wg_parser_t parser;
|
2021-10-05 00:20:51 +00:00
|
|
|
const void *data;
|
|
|
|
UINT32 size;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct wg_parser_get_stream_count_params
|
|
|
|
{
|
2023-07-08 03:32:21 +00:00
|
|
|
wg_parser_t parser;
|
2021-10-05 00:20:51 +00:00
|
|
|
UINT32 count;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct wg_parser_get_stream_params
|
|
|
|
{
|
2023-07-08 03:32:21 +00:00
|
|
|
wg_parser_t parser;
|
2021-10-05 00:20:51 +00:00
|
|
|
UINT32 index;
|
2023-07-08 03:32:21 +00:00
|
|
|
wg_parser_stream_t stream;
|
2021-10-05 00:20:51 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct wg_parser_stream_get_preferred_format_params
|
|
|
|
{
|
2023-07-08 03:32:21 +00:00
|
|
|
wg_parser_stream_t stream;
|
2021-10-05 00:20:51 +00:00
|
|
|
struct wg_format *format;
|
|
|
|
};
|
|
|
|
|
2023-03-13 04:13:52 +00:00
|
|
|
struct wg_parser_stream_get_codec_format_params
|
|
|
|
{
|
2023-07-08 03:32:21 +00:00
|
|
|
wg_parser_stream_t stream;
|
2023-03-13 04:13:52 +00:00
|
|
|
struct wg_format *format;
|
|
|
|
};
|
|
|
|
|
2021-10-05 00:20:51 +00:00
|
|
|
struct wg_parser_stream_enable_params
|
|
|
|
{
|
2023-07-08 03:32:21 +00:00
|
|
|
wg_parser_stream_t stream;
|
2021-10-05 00:20:51 +00:00
|
|
|
const struct wg_format *format;
|
|
|
|
};
|
|
|
|
|
2022-02-23 21:46:50 +00:00
|
|
|
struct wg_parser_stream_get_buffer_params
|
2021-10-05 00:20:51 +00:00
|
|
|
{
|
2023-07-08 03:32:21 +00:00
|
|
|
wg_parser_t parser;
|
|
|
|
wg_parser_stream_t stream;
|
2022-02-23 21:46:50 +00:00
|
|
|
struct wg_parser_buffer *buffer;
|
2021-10-05 00:20:51 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct wg_parser_stream_copy_buffer_params
|
|
|
|
{
|
2023-07-08 03:32:21 +00:00
|
|
|
wg_parser_stream_t stream;
|
2021-10-05 00:20:51 +00:00
|
|
|
void *data;
|
|
|
|
UINT32 offset;
|
|
|
|
UINT32 size;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct wg_parser_stream_notify_qos_params
|
|
|
|
{
|
2023-07-08 03:32:21 +00:00
|
|
|
wg_parser_stream_t stream;
|
2023-07-08 03:41:36 +00:00
|
|
|
UINT8 underflow;
|
2021-10-05 00:20:51 +00:00
|
|
|
DOUBLE proportion;
|
|
|
|
INT64 diff;
|
|
|
|
UINT64 timestamp;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct wg_parser_stream_get_duration_params
|
|
|
|
{
|
2023-07-08 03:32:21 +00:00
|
|
|
wg_parser_stream_t stream;
|
2021-10-05 00:20:51 +00:00
|
|
|
UINT64 duration;
|
|
|
|
};
|
|
|
|
|
2023-07-08 03:41:36 +00:00
|
|
|
typedef UINT64 wg_parser_tag;
|
2022-11-24 22:28:12 +00:00
|
|
|
enum wg_parser_tag
|
|
|
|
{
|
|
|
|
WG_PARSER_TAG_LANGUAGE,
|
2022-11-25 00:38:35 +00:00
|
|
|
WG_PARSER_TAG_NAME,
|
2022-11-24 22:28:12 +00:00
|
|
|
WG_PARSER_TAG_COUNT
|
|
|
|
};
|
|
|
|
|
|
|
|
struct wg_parser_stream_get_tag_params
|
|
|
|
{
|
2023-07-08 03:32:21 +00:00
|
|
|
wg_parser_stream_t stream;
|
2023-07-08 03:41:36 +00:00
|
|
|
wg_parser_tag tag;
|
2022-11-24 22:28:12 +00:00
|
|
|
char *buffer;
|
|
|
|
UINT32 *size;
|
|
|
|
};
|
|
|
|
|
2021-10-05 00:20:51 +00:00
|
|
|
struct wg_parser_stream_seek_params
|
|
|
|
{
|
2023-07-08 03:32:21 +00:00
|
|
|
wg_parser_stream_t stream;
|
2021-10-05 00:20:51 +00:00
|
|
|
DOUBLE rate;
|
|
|
|
UINT64 start_pos, stop_pos;
|
|
|
|
DWORD start_flags, stop_flags;
|
|
|
|
};
|
|
|
|
|
2023-05-17 12:23:15 +00:00
|
|
|
struct wg_transform_attrs
|
|
|
|
{
|
|
|
|
UINT32 output_plane_align;
|
2023-05-24 08:07:56 +00:00
|
|
|
UINT32 input_queue_length;
|
2023-05-25 12:15:43 +00:00
|
|
|
BOOL low_latency;
|
2023-05-17 12:23:15 +00:00
|
|
|
};
|
|
|
|
|
2022-02-16 11:19:08 +00:00
|
|
|
struct wg_transform_create_params
|
|
|
|
{
|
2023-07-08 03:32:21 +00:00
|
|
|
wg_transform_t transform;
|
2022-02-16 11:19:09 +00:00
|
|
|
const struct wg_format *input_format;
|
|
|
|
const struct wg_format *output_format;
|
2023-05-17 12:23:15 +00:00
|
|
|
const struct wg_transform_attrs *attrs;
|
2022-02-16 11:19:08 +00:00
|
|
|
};
|
|
|
|
|
2022-03-14 13:43:22 +00:00
|
|
|
struct wg_transform_push_data_params
|
|
|
|
{
|
2023-07-08 03:32:21 +00:00
|
|
|
wg_transform_t transform;
|
2022-03-14 13:43:22 +00:00
|
|
|
struct wg_sample *sample;
|
|
|
|
HRESULT result;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct wg_transform_read_data_params
|
|
|
|
{
|
2023-07-08 03:32:21 +00:00
|
|
|
wg_transform_t transform;
|
2022-03-14 13:43:22 +00:00
|
|
|
struct wg_sample *sample;
|
2022-05-12 22:17:28 +00:00
|
|
|
struct wg_format *format;
|
2022-03-14 13:43:22 +00:00
|
|
|
HRESULT result;
|
|
|
|
};
|
|
|
|
|
2022-05-13 00:50:37 +00:00
|
|
|
struct wg_transform_set_output_format_params
|
|
|
|
{
|
2023-07-08 03:32:21 +00:00
|
|
|
wg_transform_t transform;
|
2022-05-13 00:50:37 +00:00
|
|
|
const struct wg_format *format;
|
|
|
|
};
|
|
|
|
|
2023-02-01 01:50:27 +00:00
|
|
|
struct wg_transform_get_status_params
|
|
|
|
{
|
2023-07-08 03:32:21 +00:00
|
|
|
wg_transform_t transform;
|
2023-02-01 01:50:27 +00:00
|
|
|
UINT32 accepts_input;
|
|
|
|
};
|
|
|
|
|
2021-10-05 00:20:51 +00:00
|
|
|
enum unix_funcs
|
2021-10-05 00:20:49 +00:00
|
|
|
{
|
2023-03-15 09:11:13 +00:00
|
|
|
unix_wg_init_gstreamer,
|
|
|
|
|
2021-10-05 00:20:51 +00:00
|
|
|
unix_wg_parser_create,
|
|
|
|
unix_wg_parser_destroy,
|
2021-10-05 00:20:49 +00:00
|
|
|
|
2021-10-05 00:20:51 +00:00
|
|
|
unix_wg_parser_connect,
|
|
|
|
unix_wg_parser_disconnect,
|
2021-10-05 00:20:49 +00:00
|
|
|
|
2021-10-05 00:20:51 +00:00
|
|
|
unix_wg_parser_get_next_read_offset,
|
|
|
|
unix_wg_parser_push_data,
|
2021-10-05 00:20:49 +00:00
|
|
|
|
2021-10-05 00:20:51 +00:00
|
|
|
unix_wg_parser_get_stream_count,
|
|
|
|
unix_wg_parser_get_stream,
|
2021-10-05 00:20:49 +00:00
|
|
|
|
2021-10-05 00:20:51 +00:00
|
|
|
unix_wg_parser_stream_get_preferred_format,
|
2023-03-13 04:13:52 +00:00
|
|
|
unix_wg_parser_stream_get_codec_format,
|
2021-10-05 00:20:51 +00:00
|
|
|
unix_wg_parser_stream_enable,
|
|
|
|
unix_wg_parser_stream_disable,
|
2021-10-05 00:20:49 +00:00
|
|
|
|
2022-02-23 21:46:50 +00:00
|
|
|
unix_wg_parser_stream_get_buffer,
|
2021-10-05 00:20:51 +00:00
|
|
|
unix_wg_parser_stream_copy_buffer,
|
|
|
|
unix_wg_parser_stream_release_buffer,
|
|
|
|
unix_wg_parser_stream_notify_qos,
|
2021-10-05 00:20:49 +00:00
|
|
|
|
2021-10-05 00:20:51 +00:00
|
|
|
unix_wg_parser_stream_get_duration,
|
2022-11-24 22:28:12 +00:00
|
|
|
unix_wg_parser_stream_get_tag,
|
2021-10-05 00:20:51 +00:00
|
|
|
unix_wg_parser_stream_seek,
|
2022-02-16 11:19:08 +00:00
|
|
|
|
|
|
|
unix_wg_transform_create,
|
|
|
|
unix_wg_transform_destroy,
|
2022-05-13 00:50:37 +00:00
|
|
|
unix_wg_transform_set_output_format,
|
2022-03-14 13:43:22 +00:00
|
|
|
|
|
|
|
unix_wg_transform_push_data,
|
|
|
|
unix_wg_transform_read_data,
|
2023-02-01 01:50:27 +00:00
|
|
|
unix_wg_transform_get_status,
|
2023-05-25 12:37:04 +00:00
|
|
|
unix_wg_transform_drain,
|
2023-05-25 13:07:20 +00:00
|
|
|
unix_wg_transform_flush,
|
2021-10-05 00:20:49 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* __WINE_WINEGSTREAMER_UNIXLIB_H */
|