mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-03 14:08:56 +00:00
asio: Drop external SDK header dependency
Build ASIO plugin using our tiny SDK header Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6404>
This commit is contained in:
parent
5280f0b733
commit
f0761a7358
5 changed files with 182 additions and 31 deletions
|
@ -92,7 +92,6 @@ option('amfcodec', type : 'feature', value : 'auto', description : 'AMD AMF code
|
|||
option('androidmedia', type : 'feature', value : 'auto', description : 'Video capture and codec plugins for Android')
|
||||
option('applemedia', type : 'feature', value : 'auto', description : 'Video capture and codec access plugins for macOS and iOS')
|
||||
option('asio', type : 'feature', value : 'auto', description : 'Steinberg Audio Streaming Input Output (ASIO) plugin')
|
||||
option('asio-sdk-path', type : 'string', value : '', description : 'Full path to Steinberg Audio Streaming Input Output (ASIO) SDK')
|
||||
option('assrender', type : 'feature', value : 'auto', description : 'ASS/SSA subtitle renderer plugin')
|
||||
option('bluez', type : 'feature', value : 'auto', description : 'Bluetooth audio A2DP/AVDTP sink, AVDTP source plugin')
|
||||
option('bs2b', type : 'feature', value : 'auto', description : 'Bauer stereophonic-to-binaural audio plugin')
|
||||
|
|
147
subprojects/gst-plugins-bad/sys/asio/asio.h
Normal file
147
subprojects/gst-plugins-bad/sys/asio/asio.h
Normal file
|
@ -0,0 +1,147 @@
|
|||
#pragma once
|
||||
|
||||
#include <gst/gst.h>
|
||||
#include <windows.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#pragma pack(push,4)
|
||||
|
||||
typedef struct
|
||||
{
|
||||
gulong hi;
|
||||
gulong lo;
|
||||
} ASIOSamples;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
gulong hi;
|
||||
gulong lo;
|
||||
} ASIOTimeStamp;
|
||||
|
||||
typedef gdouble ASIOSampleRate;
|
||||
typedef glong ASIOBool;
|
||||
typedef glong ASIOSampleType;
|
||||
|
||||
enum {
|
||||
ASIOSTInt16MSB = 0,
|
||||
ASIOSTInt24MSB = 1,
|
||||
ASIOSTInt32MSB = 2,
|
||||
ASIOSTFloat32MSB = 3,
|
||||
ASIOSTFloat64MSB = 4,
|
||||
|
||||
ASIOSTInt32MSB16 = 8,
|
||||
ASIOSTInt32MSB18 = 9,
|
||||
ASIOSTInt32MSB20 = 10,
|
||||
ASIOSTInt32MSB24 = 11,
|
||||
|
||||
ASIOSTInt16LSB = 16,
|
||||
ASIOSTInt24LSB = 17,
|
||||
ASIOSTInt32LSB = 18,
|
||||
ASIOSTFloat32LSB = 19,
|
||||
ASIOSTFloat64LSB = 20,
|
||||
|
||||
ASIOSTInt32LSB16 = 24,
|
||||
ASIOSTInt32LSB18 = 25,
|
||||
ASIOSTInt32LSB20 = 26,
|
||||
ASIOSTInt32LSB24 = 27,
|
||||
|
||||
ASIOSTDSDInt8LSB1 = 32,
|
||||
ASIOSTDSDInt8MSB1 = 33,
|
||||
ASIOSTDSDInt8NER8 = 40,
|
||||
|
||||
ASIOSTLastEntry
|
||||
};
|
||||
|
||||
typedef glong ASIOError;
|
||||
|
||||
typedef struct ASIOTimeCode
|
||||
{
|
||||
gdouble speed;
|
||||
ASIOSamples timeCodeSamples;
|
||||
gulong flags;
|
||||
gchar future[64];
|
||||
} ASIOTimeCode;
|
||||
|
||||
typedef struct AsioTimeInfo
|
||||
{
|
||||
gdouble speed;
|
||||
ASIOTimeStamp systemTime;
|
||||
ASIOSamples samplePosition;
|
||||
ASIOSampleRate sampleRate;
|
||||
gulong flags;
|
||||
gchar reserved[12];
|
||||
} AsioTimeInfo;
|
||||
|
||||
typedef struct ASIOTime
|
||||
{
|
||||
glong reserved[4];
|
||||
AsioTimeInfo timeInfo;
|
||||
ASIOTimeCode timeCode;
|
||||
} ASIOTime;
|
||||
|
||||
typedef struct ASIOCallbacks
|
||||
{
|
||||
void (*bufferSwitch) (glong doubleBufferIndex,
|
||||
ASIOBool directProcess);
|
||||
void (*sampleRateDidChange) (ASIOSampleRate sRate);
|
||||
glong (*asioMessage) (glong selector,
|
||||
glong value,
|
||||
gpointer message,
|
||||
gdouble * opt);
|
||||
ASIOTime* (*bufferSwitchTimeInfo) (ASIOTime* params,
|
||||
glong doubleBufferIndex,
|
||||
ASIOBool directProcess);
|
||||
} ASIOCallbacks;
|
||||
|
||||
enum
|
||||
{
|
||||
kAsioSelectorSupported = 1,
|
||||
kAsioEngineVersion,
|
||||
kAsioResetRequest,
|
||||
kAsioBufferSizeChange,
|
||||
kAsioResyncRequest,
|
||||
kAsioLatenciesChanged,
|
||||
kAsioSupportsTimeInfo,
|
||||
kAsioSupportsTimeCode,
|
||||
kAsioMMCCommand,
|
||||
kAsioSupportsInputMonitor,
|
||||
kAsioSupportsInputGain,
|
||||
kAsioSupportsInputMeter,
|
||||
kAsioSupportsOutputGain,
|
||||
kAsioSupportsOutputMeter,
|
||||
kAsioOverload,
|
||||
|
||||
kAsioNumMessageSelectors
|
||||
};
|
||||
|
||||
typedef struct ASIOClockSource
|
||||
{
|
||||
glong index;
|
||||
glong associatedChannel;
|
||||
glong associatedGroup;
|
||||
ASIOBool isCurrentSource;
|
||||
gchar name[32];
|
||||
} ASIOClockSource;
|
||||
|
||||
typedef struct ASIOChannelInfo
|
||||
{
|
||||
glong channel;
|
||||
ASIOBool isInput;
|
||||
ASIOBool isActive;
|
||||
glong channelGroup;
|
||||
ASIOSampleType type;
|
||||
gchar name[32];
|
||||
} ASIOChannelInfo;
|
||||
|
||||
typedef struct ASIOBufferInfo
|
||||
{
|
||||
ASIOBool isInput;
|
||||
glong channelNum;
|
||||
gpointer buffers[2];
|
||||
} ASIOBufferInfo;
|
||||
|
||||
#pragma pack(pop)
|
||||
|
||||
G_END_DECLS
|
||||
|
|
@ -28,7 +28,6 @@
|
|||
#include <functional>
|
||||
#include <vector>
|
||||
#include <mutex>
|
||||
#include <iasiodrv.h>
|
||||
|
||||
GST_DEBUG_CATEGORY_STATIC (gst_asio_object_debug);
|
||||
#define GST_CAT_DEFAULT gst_asio_object_debug
|
||||
|
@ -44,6 +43,38 @@ std::mutex global_lock;
|
|||
std::mutex slot_lock;
|
||||
/* *INDENT-ON* */
|
||||
|
||||
/* ASIO COM interface */
|
||||
struct IASIO : public IUnknown
|
||||
{
|
||||
virtual ASIOBool init (gpointer sysHandle) = 0;
|
||||
virtual void getDriverName (gchar *name) = 0;
|
||||
virtual glong getDriverVersion () = 0;
|
||||
virtual void getErrorMessage (gchar * string) = 0;
|
||||
virtual ASIOError start () = 0;
|
||||
virtual ASIOError stop () = 0;
|
||||
virtual ASIOError getChannels (glong * numInputChannels,
|
||||
glong * numOutputChannels) = 0;
|
||||
virtual ASIOError getLatencies (glong * inputLatency,
|
||||
glong * outputLatency) = 0;
|
||||
virtual ASIOError getBufferSize (glong *minSize, glong *maxSize,
|
||||
glong * preferredSize, glong *granularity) = 0;
|
||||
virtual ASIOError canSampleRate (ASIOSampleRate sampleRate) = 0;
|
||||
virtual ASIOError getSampleRate (ASIOSampleRate * sampleRate) = 0;
|
||||
virtual ASIOError setSampleRate (ASIOSampleRate sampleRate) = 0;
|
||||
virtual ASIOError getClockSources (ASIOClockSource *clocks,
|
||||
glong *numSources) = 0;
|
||||
virtual ASIOError setClockSource (glong reference) = 0;
|
||||
virtual ASIOError getSamplePosition (ASIOSamples * sPos,
|
||||
ASIOTimeStamp *tStamp) = 0;
|
||||
virtual ASIOError getChannelInfo (ASIOChannelInfo * info) = 0;
|
||||
virtual ASIOError createBuffers (ASIOBufferInfo * bufferInfos,
|
||||
glong numChannels, glong bufferSize, ASIOCallbacks * callbacks) = 0;
|
||||
virtual ASIOError disposeBuffers () = 0;
|
||||
virtual ASIOError controlPanel () = 0;
|
||||
virtual ASIOError future (glong selector,gpointer opt) = 0;
|
||||
virtual ASIOError outputReady () = 0;
|
||||
};
|
||||
|
||||
static void gst_asio_object_buffer_switch (GstAsioObject * self,
|
||||
glong index, ASIOBool process_now);
|
||||
static void gst_asio_object_sample_rate_changed (GstAsioObject * self,
|
||||
|
|
|
@ -23,8 +23,7 @@
|
|||
#include <gst/gst.h>
|
||||
#include <gst/audio/audio.h>
|
||||
#include <windows.h>
|
||||
#include <asiosys.h>
|
||||
#include <asio.h>
|
||||
#include "asio.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
|
|
|
@ -47,35 +47,10 @@ if not winmm_lib.found()
|
|||
subdir_done ()
|
||||
endif
|
||||
|
||||
# Checking SDK headers. User should install ASIO sdk on system, and
|
||||
# this plugin requires asio.h, asiosys.h and iasiodrv.h headers
|
||||
asio_sdk_root = get_option ('asio-sdk-path')
|
||||
if asio_sdk_root == ''
|
||||
if asio_option.enabled()
|
||||
error('asio sdk path is needed, pass with -Dasio-sdk-path=C:/path/to/sdk')
|
||||
else
|
||||
subdir_done ()
|
||||
endif
|
||||
endif
|
||||
|
||||
asio_inc_dir = include_directories(join_paths(asio_sdk_root, 'common'), is_system : true)
|
||||
has_asio_header = cxx.has_header('asio.h', include_directories: asio_inc_dir)
|
||||
has_asiosys_header = cxx.has_header('asiosys.h', include_directories: asio_inc_dir)
|
||||
has_iasiodrv_header = cxx.has_header('iasiodrv.h', include_directories: asio_inc_dir)
|
||||
if not has_asio_header or not has_asiosys_header or not has_iasiodrv_header
|
||||
if asio_option.enabled()
|
||||
error('Failed to find required SDK header(s)')
|
||||
else
|
||||
subdir_done ()
|
||||
endif
|
||||
endif
|
||||
|
||||
asio_deps = [gstaudio_dep, avrt_lib, winmm_lib]
|
||||
|
||||
gstasio = library('gstasio',
|
||||
asio_sources,
|
||||
include_directories : [configinc, asio_inc_dir],
|
||||
dependencies : asio_deps,
|
||||
include_directories : [configinc],
|
||||
dependencies : [gstaudio_dep, avrt_lib, winmm_lib],
|
||||
c_args : gst_plugins_bad_args,
|
||||
cpp_args : gst_plugins_bad_args,
|
||||
install : true,
|
||||
|
|
Loading…
Reference in a new issue