directsoundsrc: port to 1.0

https://bugzilla.gnome.org/show_bug.cgi?id=673414
This commit is contained in:
Raimo Järvi 2012-04-03 12:09:19 +03:00 committed by Tim-Philipp Müller
parent 5e6783f5af
commit a7258842ab
2 changed files with 79 additions and 128 deletions

View File

@ -324,7 +324,7 @@ GST_PLUGINS_NONPORTED=" androidmedia aiff \
apexsink cdaudio cog dc1394 dirac directfb \ apexsink cdaudio cog dc1394 dirac directfb \
gsettings jasper ladspa \ gsettings jasper ladspa \
musepack musicbrainz nas neon ofa openal rsvg sdl sndfile timidity \ musepack musicbrainz nas neon ofa openal rsvg sdl sndfile timidity \
directsound directdraw direct3d9 acm wininet \ directdraw direct3d9 acm wininet \
wildmidi xvid lv2 teletextdec sndio uvch264" wildmidi xvid lv2 teletextdec sndio uvch264"
AC_SUBST(GST_PLUGINS_NONPORTED) AC_SUBST(GST_PLUGINS_NONPORTED)

View File

@ -48,12 +48,25 @@
TODO: add device selection and check rate etc. TODO: add device selection and check rate etc.
*/ */
/**
* SECTION:element-directsoundsrc
*
* Reads audio data using the DirectSound API.
*
* <refsect2>
* <title>Example pipelines</title>
* |[
* gst-launch -v directsoundsrc ! audioconvert ! vorbisenc ! oggmux ! filesink location=dsound.ogg
* ]| Record from DirectSound and encode to Ogg/Vorbis.
* </refsect2>
*/
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
# include "config.h" # include "config.h"
#endif #endif
#include <gst/gst.h> #include <gst/gst.h>
#include <gst/audio/gstbaseaudiosrc.h> #include <gst/audio/gstaudiobasesrc.h>
#include "gstdirectsoundsrc.h" #include "gstdirectsoundsrc.h"
@ -73,7 +86,6 @@ enum
PROP_DEVICE PROP_DEVICE
}; };
static HRESULT (WINAPI * pDSoundCaptureCreate) (LPGUID, static HRESULT (WINAPI * pDSoundCaptureCreate) (LPGUID,
LPDIRECTSOUNDCAPTURE *, LPUNKNOWN); LPDIRECTSOUNDCAPTURE *, LPUNKNOWN);
@ -88,47 +100,30 @@ static void gst_directsound_src_get_property (GObject * object,
static gboolean gst_directsound_src_open (GstAudioSrc * asrc); static gboolean gst_directsound_src_open (GstAudioSrc * asrc);
static gboolean gst_directsound_src_close (GstAudioSrc * asrc); static gboolean gst_directsound_src_close (GstAudioSrc * asrc);
static gboolean gst_directsound_src_prepare (GstAudioSrc * asrc, static gboolean gst_directsound_src_prepare (GstAudioSrc * asrc,
GstRingBufferSpec * spec); GstAudioRingBufferSpec * spec);
static gboolean gst_directsound_src_unprepare (GstAudioSrc * asrc); static gboolean gst_directsound_src_unprepare (GstAudioSrc * asrc);
static void gst_directsound_src_reset (GstAudioSrc * asrc); static void gst_directsound_src_reset (GstAudioSrc * asrc);
static GstCaps *gst_directsound_src_getcaps (GstBaseSrc * bsrc); static GstCaps *gst_directsound_src_getcaps (GstBaseSrc * bsrc,
GstCaps * filter);
static guint gst_directsound_src_read (GstAudioSrc * asrc, static guint gst_directsound_src_read (GstAudioSrc * asrc,
gpointer data, guint length); gpointer data, guint length);
static void gst_directsound_src_dispose (GObject * object); static void gst_directsound_src_dispose (GObject * object);
static void gst_directsound_src_do_init (GType type);
static guint gst_directsound_src_delay (GstAudioSrc * asrc); static guint gst_directsound_src_delay (GstAudioSrc * asrc);
static GstStaticPadTemplate directsound_src_src_factory = static GstStaticPadTemplate directsound_src_src_factory =
GST_STATIC_PAD_TEMPLATE ("src", GST_STATIC_PAD_TEMPLATE ("src",
GST_PAD_SRC, GST_PAD_SRC,
GST_PAD_ALWAYS, GST_PAD_ALWAYS,
GST_STATIC_CAPS ("audio/x-raw-int, " GST_STATIC_CAPS ("audio/x-raw, "
"endianness = (int) { LITTLE_ENDIAN, BIG_ENDIAN }, " "format = (string) { S16LE, S8 }, "
"signed = (boolean) { TRUE, FALSE }, " "layout = (string) interleaved, "
"width = (int) 16, "
"depth = (int) 16, "
"rate = (int) [ 1, MAX ], " "channels = (int) [ 1, 2 ]; "
"audio/x-raw-int, "
"signed = (boolean) { TRUE, FALSE }, "
"width = (int) 8, "
"depth = (int) 8, "
"rate = (int) [ 1, MAX ], " "channels = (int) [ 1, 2 ]")); "rate = (int) [ 1, MAX ], " "channels = (int) [ 1, 2 ]"));
static void #define gst_directsound_src_parent_class parent_class
gst_directsound_src_do_init (GType type) G_DEFINE_TYPE (GstDirectSoundSrc, gst_directsound_src, GST_TYPE_AUDIO_SRC);
{
GST_DEBUG_CATEGORY_INIT (directsoundsrc_debug, "directsoundsrc", 0,
"DirectSound Src");
}
GST_BOILERPLATE_FULL (GstDirectSoundSrc, gst_directsound_src, GstAudioSrc,
GST_TYPE_AUDIO_SRC, gst_directsound_src_do_init);
static void static void
gst_directsound_src_dispose (GObject * object) gst_directsound_src_dispose (GObject * object)
@ -146,40 +141,20 @@ gst_directsound_src_finalize (GObject * object)
G_OBJECT_CLASS (parent_class)->finalize (object); G_OBJECT_CLASS (parent_class)->finalize (object);
} }
static void
gst_directsound_src_base_init (gpointer g_class)
{
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
GST_DEBUG ("initializing directsoundsrc base\n");
gst_element_class_set_metadata (element_class, "Direct Sound Audio Src",
"Source/Audio",
"Capture from a soundcard via DIRECTSOUND",
"Joni Valtanen <joni.valtanen@movial.fi>");
gst_element_class_add_pad_template (element_class,
gst_static_pad_template_get (&directsound_src_src_factory));
}
/* initialize the plugin's class */
static void static void
gst_directsound_src_class_init (GstDirectSoundSrcClass * klass) gst_directsound_src_class_init (GstDirectSoundSrcClass * klass)
{ {
GObjectClass *gobject_class; GObjectClass *gobject_class;
GstElementClass *gstelement_class; GstElementClass *gstelement_class;
GstBaseSrcClass *gstbasesrc_class; GstBaseSrcClass *gstbasesrc_class;
GstBaseAudioSrcClass *gstbaseaudiosrc_class;
GstAudioSrcClass *gstaudiosrc_class; GstAudioSrcClass *gstaudiosrc_class;
gobject_class = (GObjectClass *) klass; gobject_class = (GObjectClass *) klass;
gstelement_class = (GstElementClass *) klass; gstelement_class = (GstElementClass *) klass;
gstbasesrc_class = (GstBaseSrcClass *) klass; gstbasesrc_class = (GstBaseSrcClass *) klass;
gstbaseaudiosrc_class = (GstBaseAudioSrcClass *) klass;
gstaudiosrc_class = (GstAudioSrcClass *) klass; gstaudiosrc_class = (GstAudioSrcClass *) klass;
GST_DEBUG ("initializing directsoundsrc class\n"); GST_DEBUG ("initializing directsoundsrc class");
gobject_class->finalize = GST_DEBUG_FUNCPTR (gst_directsound_src_finalize); gobject_class->finalize = GST_DEBUG_FUNCPTR (gst_directsound_src_finalize);
gobject_class->dispose = GST_DEBUG_FUNCPTR (gst_directsound_src_dispose); gobject_class->dispose = GST_DEBUG_FUNCPTR (gst_directsound_src_dispose);
@ -199,23 +174,30 @@ gst_directsound_src_class_init (GstDirectSoundSrcClass * klass)
gstaudiosrc_class->delay = GST_DEBUG_FUNCPTR (gst_directsound_src_delay); gstaudiosrc_class->delay = GST_DEBUG_FUNCPTR (gst_directsound_src_delay);
gstaudiosrc_class->reset = GST_DEBUG_FUNCPTR (gst_directsound_src_reset); gstaudiosrc_class->reset = GST_DEBUG_FUNCPTR (gst_directsound_src_reset);
GST_DEBUG_CATEGORY_INIT (directsoundsrc_debug, "directsoundsrc", 0,
"DirectSound Src");
gst_element_class_set_static_metadata (gstelement_class,
"DirectSound audio source", "Source/Audio",
"Capture from a soundcard via DirectSound",
"Joni Valtanen <joni.valtanen@movial.fi>");
gst_element_class_add_pad_template (gstelement_class,
gst_static_pad_template_get (&directsound_src_src_factory));
} }
static GstCaps * static GstCaps *
gst_directsound_src_getcaps (GstBaseSrc * bsrc) gst_directsound_src_getcaps (GstBaseSrc * bsrc, GstCaps * filter)
{ {
GstDirectSoundSrc *dsoundsrc; GstDirectSoundSrc *dsoundsrc;
GstCaps *caps = NULL; GstCaps *caps = NULL;
GST_DEBUG ("get caps\n"); GST_DEBUG_OBJECT (bsrc, "get caps");
dsoundsrc = GST_DIRECTSOUND_SRC (bsrc); dsoundsrc = GST_DIRECTSOUND_SRC (bsrc);
caps = gst_caps_copy (gst_pad_get_pad_template_caps (GST_BASE_SRC_PAD caps = gst_caps_copy (gst_pad_get_pad_template_caps (GST_BASE_SRC_PAD
(bsrc))); (bsrc)));
return caps; return caps;
} }
static void static void
@ -223,7 +205,7 @@ gst_directsound_src_set_property (GObject * object, guint prop_id,
const GValue * value, GParamSpec * pspec) const GValue * value, GParamSpec * pspec)
{ {
// GstDirectSoundSrc *src = GST_DIRECTSOUND_SRC (object); // GstDirectSoundSrc *src = GST_DIRECTSOUND_SRC (object);
GST_DEBUG ("set property\n"); GST_DEBUG ("set property");
switch (prop_id) { switch (prop_id) {
#if 0 #if 0
@ -246,7 +228,7 @@ gst_directsound_src_get_property (GObject * object, guint prop_id,
GstDirectSoundSrc *src = GST_DIRECTSOUND_SRC (object); GstDirectSoundSrc *src = GST_DIRECTSOUND_SRC (object);
#endif #endif
GST_DEBUG ("get property\n"); GST_DEBUG ("get property");
switch (prop_id) { switch (prop_id) {
#if 0 #if 0
@ -268,22 +250,19 @@ gst_directsound_src_get_property (GObject * object, guint prop_id,
* initialize structure * initialize structure
*/ */
static void static void
gst_directsound_src_init (GstDirectSoundSrc * src, gst_directsound_src_init (GstDirectSoundSrc * src)
GstDirectSoundSrcClass * gclass)
{ {
GST_DEBUG ("initializing directsoundsrc\n"); GST_DEBUG_OBJECT (src, "initializing directsoundsrc");
src->dsound_lock = g_mutex_new (); src->dsound_lock = g_mutex_new ();
} }
static gboolean static gboolean
gst_directsound_src_open (GstAudioSrc * asrc) gst_directsound_src_open (GstAudioSrc * asrc)
{ {
GstDirectSoundSrc *dsoundsrc; GstDirectSoundSrc *dsoundsrc;
HRESULT hRes; /* Result for windows functions */ HRESULT hRes; /* Result for windows functions */
GST_DEBUG ("initializing directsoundsrc\n"); GST_DEBUG_OBJECT (asrc, "opening directsoundsrc");
dsoundsrc = GST_DIRECTSOUND_SRC (asrc); dsoundsrc = GST_DIRECTSOUND_SRC (asrc);
@ -342,7 +321,7 @@ gst_directsound_src_close (GstAudioSrc * asrc)
GstDirectSoundSrc *dsoundsrc; GstDirectSoundSrc *dsoundsrc;
HRESULT hRes; /* Result for windows functions */ HRESULT hRes; /* Result for windows functions */
GST_DEBUG ("initializing directsoundsrc\n"); GST_DEBUG_OBJECT (asrc, "closing directsoundsrc");
dsoundsrc = GST_DIRECTSOUND_SRC (asrc); dsoundsrc = GST_DIRECTSOUND_SRC (asrc);
@ -356,49 +335,37 @@ gst_directsound_src_close (GstAudioSrc * asrc)
} }
static gboolean static gboolean
gst_directsound_src_prepare (GstAudioSrc * asrc, GstRingBufferSpec * spec) gst_directsound_src_prepare (GstAudioSrc * asrc, GstAudioRingBufferSpec * spec)
{ {
GstDirectSoundSrc *dsoundsrc; GstDirectSoundSrc *dsoundsrc;
WAVEFORMATEX wfx; /* Wave format structure */ WAVEFORMATEX wfx; /* Wave format structure */
HRESULT hRes; /* Result for windows functions */ HRESULT hRes; /* Result for windows functions */
DSCBUFFERDESC descSecondary; /* Capturebuffer decsiption */ DSCBUFFERDESC descSecondary; /* Capturebuffer description */
dsoundsrc = GST_DIRECTSOUND_SRC (asrc); dsoundsrc = GST_DIRECTSOUND_SRC (asrc);
GST_DEBUG ("initializing directsoundsrc\n"); GST_DEBUG_OBJECT (asrc, "preparing directsoundsrc");
/* Define buffer */ /* Define buffer */
memset (&wfx, 0, sizeof (WAVEFORMATEX)); memset (&wfx, 0, sizeof (WAVEFORMATEX));
wfx.wFormatTag = WAVE_FORMAT_PCM; /* should be WAVE_FORMAT_PCM */ wfx.wFormatTag = WAVE_FORMAT_PCM;
wfx.nChannels = spec->channels; wfx.nChannels = GST_AUDIO_INFO_CHANNELS (&spec->info);
wfx.nSamplesPerSec = spec->rate; /* 8000|11025|22050|44100 */ wfx.nSamplesPerSec = GST_AUDIO_INFO_RATE (&spec->info);
wfx.wBitsPerSample = spec->width; // 8|16; wfx.wBitsPerSample = GST_AUDIO_INFO_BPF (&spec->info) * 8 / wfx.nChannels;
wfx.nBlockAlign = GST_AUDIO_INFO_BPF (&spec->info);
wfx.nBlockAlign = wfx.nChannels * (wfx.wBitsPerSample / 8);
wfx.nAvgBytesPerSec = wfx.nSamplesPerSec * wfx.nBlockAlign; wfx.nAvgBytesPerSec = wfx.nSamplesPerSec * wfx.nBlockAlign;
wfx.cbSize = 0; /* This size is allways for PCM-format */ /* Ignored for WAVE_FORMAT_PCM. */
wfx.cbSize = 0;
/* 1 or 2 Channels etc... if (wfx.wBitsPerSample != 16 && wfx.wBitsPerSample != 8)
FIXME: Never really tested. Is this ok? goto dodgy_width;
*/
if (spec->width == 16 && spec->channels == 1) {
spec->format = GST_S16_LE;
} else if (spec->width == 16 && spec->channels == 2) {
spec->format = GST_U16_LE;
} else if (spec->width == 8 && spec->channels == 1) {
spec->format = GST_S8;
} else if (spec->width == 8 && spec->channels == 2) {
spec->format = GST_U8;
}
/* Set the buffer size to two seconds. /* Set the buffer size to two seconds.
This should never reached. This should never reached.
*/ */
dsoundsrc->buffer_size = wfx.nAvgBytesPerSec * 2; dsoundsrc->buffer_size = wfx.nAvgBytesPerSec * 2;
//notifysize * 16; //spec->width; /*original 16*/ GST_DEBUG_OBJECT (asrc, "Buffer size: %d", dsoundsrc->buffer_size);
GST_DEBUG ("Buffer size: %d", dsoundsrc->buffer_size);
/* Init secondary buffer desciption */ /* Init secondary buffer desciption */
memset (&descSecondary, 0, sizeof (DSCBUFFERDESC)); memset (&descSecondary, 0, sizeof (DSCBUFFERDESC));
@ -413,19 +380,15 @@ gst_directsound_src_prepare (GstAudioSrc * asrc, GstRingBufferSpec * spec)
/* Create buffer */ /* Create buffer */
hRes = IDirectSoundCapture_CreateCaptureBuffer (dsoundsrc->pDSC, hRes = IDirectSoundCapture_CreateCaptureBuffer (dsoundsrc->pDSC,
&descSecondary, &dsoundsrc->pDSBSecondary, NULL); &descSecondary, &dsoundsrc->pDSBSecondary, NULL);
if (hRes != DS_OK) { if (hRes != DS_OK)
goto capture_buffer; goto capture_buffer;
}
spec->channels = wfx.nChannels; dsoundsrc->bytes_per_sample = GST_AUDIO_INFO_BPF (&spec->info);
spec->rate = wfx.nSamplesPerSec;
spec->bytes_per_sample = (spec->width / 8) * spec->channels;
dsoundsrc->bytes_per_sample = spec->bytes_per_sample;
GST_DEBUG ("latency time: %" G_GUINT64_FORMAT " - buffer time: %" GST_DEBUG ("latency time: %" G_GUINT64_FORMAT " - buffer time: %"
G_GUINT64_FORMAT, spec->latency_time, spec->buffer_time); G_GUINT64_FORMAT, spec->latency_time, spec->buffer_time);
/* Buffer-time should be allways more than 2*latency */ /* Buffer-time should be always more than 2*latency */
if (spec->buffer_time < spec->latency_time * 2) { if (spec->buffer_time < spec->latency_time * 2) {
spec->buffer_time = spec->latency_time * 2; spec->buffer_time = spec->latency_time * 2;
GST_WARNING ("buffer-time was less than latency"); GST_WARNING ("buffer-time was less than latency");
@ -438,7 +401,6 @@ gst_directsound_src_prepare (GstAudioSrc * asrc, GstRingBufferSpec * spec)
dsoundsrc->latency_size = (gint) wfx.nAvgBytesPerSec * dsoundsrc->latency_size = (gint) wfx.nAvgBytesPerSec *
dsoundsrc->latency_time / 1000000.0; dsoundsrc->latency_time / 1000000.0;
spec->segsize = (guint) (((double) spec->buffer_time / 1000000.0) * spec->segsize = (guint) (((double) spec->buffer_time / 1000000.0) *
wfx.nAvgBytesPerSec); wfx.nAvgBytesPerSec);
@ -446,27 +408,23 @@ gst_directsound_src_prepare (GstAudioSrc * asrc, GstRingBufferSpec * spec)
if (spec->segsize < 1) if (spec->segsize < 1)
spec->segsize = 1; spec->segsize = 1;
spec->segtotal = spec->width * (wfx.nAvgBytesPerSec / spec->segsize); spec->segtotal = GST_AUDIO_INFO_BPF (&spec->info) * 8 *
(wfx.nAvgBytesPerSec / spec->segsize);
GST_DEBUG ("bytes/sec: %lu, buffer size: %d, segsize: %d, segtotal: %d", GST_DEBUG_OBJECT (asrc,
wfx.nAvgBytesPerSec, "bytes/sec: %lu, buffer size: %d, segsize: %d, segtotal: %d",
dsoundsrc->buffer_size, spec->segsize, spec->segtotal); wfx.nAvgBytesPerSec, dsoundsrc->buffer_size, spec->segsize,
spec->segtotal);
spec->silence_sample[0] = 0; /* Not read anything yet */
spec->silence_sample[1] = 0;
spec->silence_sample[2] = 0;
spec->silence_sample[3] = 0;
if (spec->width != 16 && spec->width != 8)
goto dodgy_width;
/* Not readed anything yet */
dsoundsrc->current_circular_offset = 0; dsoundsrc->current_circular_offset = 0;
GST_DEBUG ("GstRingBufferSpec->channels: %d, GstRingBufferSpec->rate: %d, \ GST_DEBUG_OBJECT (asrc, "channels: %d, rate: %d, bytes_per_sample: %d"
GstRingBufferSpec->bytes_per_sample: %d\n\ " WAVEFORMATEX.nSamplesPerSec: %ld, WAVEFORMATEX.wBitsPerSample: %d,"
WAVEFORMATEX.nSamplesPerSec: %ld, WAVEFORMATEX.wBitsPerSample: %d, \ " WAVEFORMATEX.nBlockAlign: %d, WAVEFORMATEX.nAvgBytesPerSec: %ld",
WAVEFORMATEX.nBlockAlign: %d, WAVEFORMATEX.nAvgBytesPerSec: %ld\n", spec->channels, spec->rate, spec->bytes_per_sample, wfx.nSamplesPerSec, wfx.wBitsPerSample, wfx.nBlockAlign, wfx.nAvgBytesPerSec); GST_AUDIO_INFO_CHANNELS (&spec->info), GST_AUDIO_INFO_RATE (&spec->info),
GST_AUDIO_INFO_BPF (&spec->info), wfx.nSamplesPerSec, wfx.wBitsPerSample,
wfx.nBlockAlign, wfx.nAvgBytesPerSec);
return TRUE; return TRUE;
@ -479,21 +437,18 @@ capture_buffer:
dodgy_width: dodgy_width:
{ {
GST_ELEMENT_ERROR (dsoundsrc, RESOURCE, OPEN_READ, GST_ELEMENT_ERROR (dsoundsrc, RESOURCE, OPEN_READ,
("Unexpected width %d", spec->width), (NULL)); ("Unexpected width %d", wfx.wBitsPerSample), (NULL));
return FALSE; return FALSE;
} }
} }
static gboolean static gboolean
gst_directsound_src_unprepare (GstAudioSrc * asrc) gst_directsound_src_unprepare (GstAudioSrc * asrc)
{ {
GstDirectSoundSrc *dsoundsrc; GstDirectSoundSrc *dsoundsrc;
HRESULT hRes;
HRESULT hRes; /* Result for windows functions */ GST_DEBUG_OBJECT (asrc, "unpreparing directsoundsrc");
/* Resets */
GST_DEBUG ("unpreparing directsoundsrc");
dsoundsrc = GST_DIRECTSOUND_SRC (asrc); dsoundsrc = GST_DIRECTSOUND_SRC (asrc);
@ -504,7 +459,6 @@ gst_directsound_src_unprepare (GstAudioSrc * asrc)
hRes = IDirectSoundCaptureBuffer_Release (dsoundsrc->pDSBSecondary); hRes = IDirectSoundCaptureBuffer_Release (dsoundsrc->pDSBSecondary);
return TRUE; return TRUE;
} }
/* /*
@ -525,7 +479,7 @@ gst_directsound_src_read (GstAudioSrc * asrc, gpointer data, guint length)
DWORD dwStatus = 0; DWORD dwStatus = 0;
GST_DEBUG ("reading directsoundsrc\n"); GST_DEBUG_OBJECT (asrc, "reading directsoundsrc");
dsoundsrc = GST_DIRECTSOUND_SRC (asrc); dsoundsrc = GST_DIRECTSOUND_SRC (asrc);
@ -535,12 +489,12 @@ gst_directsound_src_read (GstAudioSrc * asrc, gpointer data, guint length)
hRes = IDirectSoundCaptureBuffer_GetStatus (dsoundsrc->pDSBSecondary, hRes = IDirectSoundCaptureBuffer_GetStatus (dsoundsrc->pDSBSecondary,
&dwStatus); &dwStatus);
/* Starting capturing if not allready */ /* Starting capturing if not already */
if (!(dwStatus & DSCBSTATUS_CAPTURING)) { if (!(dwStatus & DSCBSTATUS_CAPTURING)) {
hRes = IDirectSoundCaptureBuffer_Start (dsoundsrc->pDSBSecondary, hRes = IDirectSoundCaptureBuffer_Start (dsoundsrc->pDSBSecondary,
DSCBSTART_LOOPING); DSCBSTART_LOOPING);
// Sleep (dsoundsrc->latency_time/1000); // Sleep (dsoundsrc->latency_time/1000);
GST_DEBUG ("capture started"); GST_DEBUG_OBJECT (asrc, "capture started");
} }
// calculate_buffersize: // calculate_buffersize:
while (length > dwBufferSize) { while (length > dwBufferSize) {
@ -558,8 +512,6 @@ gst_directsound_src_read (GstAudioSrc * asrc, gpointer data, guint length)
dwBufferSize = dwBufferSize =
dwCurrentCaptureCursor - dsoundsrc->current_circular_offset; dwCurrentCaptureCursor - dsoundsrc->current_circular_offset;
} }
} // while (... } // while (...
/* Lock the buffer */ /* Lock the buffer */
@ -588,7 +540,6 @@ gst_directsound_src_read (GstAudioSrc * asrc, gpointer data, guint length)
/* return length (readed data size in bytes) */ /* return length (readed data size in bytes) */
return length; return length;
} }
static guint static guint
@ -600,7 +551,7 @@ gst_directsound_src_delay (GstAudioSrc * asrc)
DWORD dwBytesInQueue = 0; DWORD dwBytesInQueue = 0;
gint nNbSamplesInQueue = 0; gint nNbSamplesInQueue = 0;
GST_DEBUG ("Delay\n"); GST_DEBUG_OBJECT (asrc, "Delay");
dsoundsrc = GST_DIRECTSOUND_SRC (asrc); dsoundsrc = GST_DIRECTSOUND_SRC (asrc);
@ -632,7 +583,7 @@ gst_directsound_src_reset (GstAudioSrc * asrc)
LPVOID pLockedBuffer = NULL; LPVOID pLockedBuffer = NULL;
DWORD dwSizeBuffer = 0; DWORD dwSizeBuffer = 0;
GST_DEBUG ("reset directsoundsrc\n"); GST_DEBUG_OBJECT (asrc, "reset directsoundsrc");
dsoundsrc = GST_DIRECTSOUND_SRC (asrc); dsoundsrc = GST_DIRECTSOUND_SRC (asrc);