From b691700f5e4f667ba901bfac0c5e13d166656f0d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Mon, 22 Jan 2018 13:44:29 +0200 Subject: [PATCH] directsoundsrc: Don't dynamically load one DirectSound symbol at runtime Just link statically to it, like for all other DirectSound symbols. --- sys/directsound/gstdirectsoundsrc.c | 41 +---------------------------- sys/directsound/gstdirectsoundsrc.h | 1 - 2 files changed, 1 insertion(+), 41 deletions(-) diff --git a/sys/directsound/gstdirectsoundsrc.c b/sys/directsound/gstdirectsoundsrc.c index faaa5a22b7..0df4f4fc56 100644 --- a/sys/directsound/gstdirectsoundsrc.c +++ b/sys/directsound/gstdirectsoundsrc.c @@ -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); diff --git a/sys/directsound/gstdirectsoundsrc.h b/sys/directsound/gstdirectsoundsrc.h index 384c801c74..bffb772567 100644 --- a/sys/directsound/gstdirectsoundsrc.h +++ b/sys/directsound/gstdirectsoundsrc.h @@ -77,7 +77,6 @@ struct _GstDirectSoundSrc GstAudioSrc src; - HINSTANCE DSoundDLL; /* DLL instance */ LPDIRECTSOUNDCAPTURE pDSC; /* DirectSoundCapture*/ LPDIRECTSOUNDCAPTUREBUFFER pDSBSecondary; /*Secondaty capturebuffer*/ DWORD current_circular_offset;