From dc2ce73a3e9b05fdf659937a4451134974053621 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=A0=D1=83=D1=81=D0=BB=D0=B0=D0=BD=20=D0=98=D0=B6=D0=B1?= =?UTF-8?q?=D1=83=D0=BB=D0=B0=D1=82=D0=BE=D0=B2?= Date: Wed, 4 Jul 2012 19:41:52 +0400 Subject: [PATCH] directsoundsink: Fix spec stuff in directsoundsink --- sys/directsound/gstdirectsoundsink.c | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/sys/directsound/gstdirectsoundsink.c b/sys/directsound/gstdirectsoundsink.c index 7fb26cbc0a..b2dae0a9f0 100644 --- a/sys/directsound/gstdirectsoundsink.c +++ b/sys/directsound/gstdirectsoundsink.c @@ -102,8 +102,8 @@ static void gst_directsound_sink_set_mute (GstDirectSoundSink * sink, gboolean mute); static gboolean gst_directsound_sink_get_mute (GstDirectSoundSink * sink); -static gboolean gst_directsound_sink_is_spdif_format (GstDirectSoundSink * - dsoundsink); +static gboolean gst_directsound_sink_is_spdif_format (GstAudioRingBufferSpec * + spec); static GstStaticPadTemplate directsoundsink_sink_factory = GST_STATIC_PAD_TEMPLATE ("sink", @@ -293,13 +293,11 @@ static gboolean gst_directsound_sink_acceptcaps (GstBaseSink * sink, GstQuery * query) { GstDirectSoundSink *dsink = GST_DIRECTSOUND_SINK (sink); - GstAudioRingBuffer *rbuf = GST_AUDIO_BASE_SINK (dsink)->ringbuffer; GstPad *pad; GstCaps *caps; GstCaps *pad_caps; GstStructure *st; gboolean ret = FALSE; - GstAudioRingBufferSpec spec = { 0 }; if (G_UNLIKELY (dsink == NULL)) @@ -323,7 +321,8 @@ gst_directsound_sink_acceptcaps (GstBaseSink * sink, GstQuery * query) if (!gst_caps_is_fixed (caps)) goto done; - if (!gst_audio_ring_buffer_parse_caps (&rbuf->spec, caps)) + spec.latency_time = GST_SECOND; + if (!gst_audio_ring_buffer_parse_caps (&spec, caps)) goto done; /* Make sure input is framed (one frame per buffer) and can be payloaded */ @@ -395,12 +394,10 @@ gst_directsound_sink_open (GstAudioSink * asink) } static gboolean -gst_directsound_sink_is_spdif_format (GstDirectSoundSink * dsoundsink) +gst_directsound_sink_is_spdif_format (GstAudioRingBufferSpec * spec) { - GstAudioRingBufferFormatType type; - type = GST_AUDIO_BASE_SINK (dsoundsink)->ringbuffer->spec.type; - return type == GST_AUDIO_RING_BUFFER_FORMAT_TYPE_AC3 || - type == GST_AUDIO_RING_BUFFER_FORMAT_TYPE_DTS; + return spec->type == GST_AUDIO_RING_BUFFER_FORMAT_TYPE_AC3 || + spec->type == GST_AUDIO_RING_BUFFER_FORMAT_TYPE_DTS; } static gboolean @@ -420,7 +417,7 @@ gst_directsound_sink_prepare (GstAudioSink * asink, /* fill the WAVEFORMATEX structure with spec params */ memset (&wfx, 0, sizeof (wfx)); - if (gst_directsound_sink_is_spdif_format (dsoundsink)) { + if (!gst_directsound_sink_is_spdif_format (spec)) { wfx.cbSize = sizeof (wfx); wfx.wFormatTag = WAVE_FORMAT_PCM; wfx.nChannels = spec->info.channels; @@ -473,7 +470,7 @@ gst_directsound_sink_prepare (GstAudioSink * asink, memset (&descSecondary, 0, sizeof (DSBUFFERDESC)); descSecondary.dwSize = sizeof (DSBUFFERDESC); descSecondary.dwFlags = DSBCAPS_GETCURRENTPOSITION2 | DSBCAPS_GLOBALFOCUS; - if (!gst_directsound_sink_is_spdif_format (dsoundsink)) + if (!gst_directsound_sink_is_spdif_format (spec)) descSecondary.dwFlags |= DSBCAPS_CTRLVOLUME; descSecondary.dwBufferBytes = dsoundsink->buffer_size; @@ -751,7 +748,6 @@ gst_directsound_probe_supported_formats (GstDirectSoundSink * dsoundsink, } else { GST_INFO_OBJECT (dsoundsink, "AC3 passthrough supported"); hRes = IDirectSoundBuffer_Release (dsoundsink->pDSBSecondary); - dsoundsink->pDSBSecondary = NULL; if (FAILED (hRes)) { GST_DEBUG_OBJECT (dsoundsink, "(IDirectSoundBuffer_Release returned: %s)\n", @@ -777,7 +773,7 @@ gst_directsound_probe_supported_formats (GstDirectSoundSink * dsoundsink, static GstBuffer * gst_directsound_sink_payload (GstAudioBaseSink * sink, GstBuffer * buf) { - if (gst_directsound_sink_is_spdif_format ((GstDirectSoundSink *) sink)) + if (gst_directsound_sink_is_spdif_format (&sink->ringbuffer->spec)) { gint framesize = gst_audio_iec61937_frame_size (&sink->ringbuffer->spec); GstBuffer *out;