directsoundsrc: Don't dynamically load one DirectSound symbol at runtime

Just link statically to it, like for all other DirectSound symbols.
This commit is contained in:
Sebastian Dröge 2018-01-22 13:44:29 +02:00
parent 1450851095
commit b691700f5e
2 changed files with 1 additions and 41 deletions

View file

@ -93,9 +93,6 @@ enum
PROP_MUTE
};
static HRESULT (WINAPI * pDSoundCaptureCreate) (LPGUID,
LPDIRECTSOUNDCAPTURE *, LPUNKNOWN);
static void gst_directsound_src_finalize (GObject * object);
static void gst_directsound_src_set_property (GObject * object,
@ -410,22 +407,6 @@ gst_directsound_src_open (GstAudioSrc * asrc)
dsoundsrc = GST_DIRECTSOUND_SRC (asrc);
/* Open dsound.dll */
dsoundsrc->DSoundDLL = LoadLibrary ("dsound.dll");
if (!dsoundsrc->DSoundDLL) {
goto dsound_open;
}
/* Building the DLL Calls */
pDSoundCaptureCreate =
(void *) GetProcAddress (dsoundsrc->DSoundDLL,
TEXT ("DirectSoundCaptureCreate"));
/* If everything is not ok */
if (!pDSoundCaptureCreate) {
goto capture_function;
}
if (dsoundsrc->device_id) {
GST_DEBUG_OBJECT (asrc, "device id set to: %s ", dsoundsrc->device_id);
dsoundsrc->device_guid = string_to_guid (dsoundsrc->device_id);
@ -446,7 +427,7 @@ gst_directsound_src_open (GstAudioSrc * asrc)
}
}
/* Create capture object */
hRes = pDSoundCaptureCreate (dsoundsrc->device_guid, &dsoundsrc->pDSC, NULL);
hRes = DirectSoundCaptureCreate (dsoundsrc->device_guid, &dsoundsrc->pDSC, NULL);
if (FAILED (hRes)) {
@ -459,35 +440,18 @@ gst_directsound_src_open (GstAudioSrc * asrc)
return TRUE;
capture_function:
{
FreeLibrary (dsoundsrc->DSoundDLL);
GST_ELEMENT_ERROR (dsoundsrc, RESOURCE, OPEN_READ,
("Unable to get capturecreate function"), (NULL));
return FALSE;
}
capture_enumerate:
{
FreeLibrary (dsoundsrc->DSoundDLL);
GST_ELEMENT_ERROR (dsoundsrc, RESOURCE, OPEN_READ,
("Unable to enumerate audio capture devices"), (NULL));
return FALSE;
}
capture_object:
{
FreeLibrary (dsoundsrc->DSoundDLL);
GST_ELEMENT_ERROR (dsoundsrc, RESOURCE, OPEN_READ,
("Unable to create capture object"), (NULL));
return FALSE;
}
dsound_open:
{
DWORD err = GetLastError ();
GST_ELEMENT_ERROR (dsoundsrc, RESOURCE, OPEN_READ,
("Unable to open dsound.dll"), (NULL));
g_print ("0x%lx\n", HRESULT_FROM_WIN32 (err));
return FALSE;
}
}
static gboolean
@ -502,9 +466,6 @@ gst_directsound_src_close (GstAudioSrc * asrc)
/* Release capture handler */
IDirectSoundCapture_Release (dsoundsrc->pDSC);
/* Close library */
FreeLibrary (dsoundsrc->DSoundDLL);
if (dsoundsrc->mixer)
mixerClose (dsoundsrc->mixer);

View file

@ -77,7 +77,6 @@ struct _GstDirectSoundSrc
GstAudioSrc src;
HINSTANCE DSoundDLL; /* DLL instance */
LPDIRECTSOUNDCAPTURE pDSC; /* DirectSoundCapture*/
LPDIRECTSOUNDCAPTUREBUFFER pDSBSecondary; /*Secondaty capturebuffer*/
DWORD current_circular_offset;