mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-26 00:58:12 +00:00
ext/alsa/gstalsasink.c: Get actual segment size and buffer size after opening the device.
Original commit message from CVS: * ext/alsa/gstalsasink.c: (set_hwparams), (gst_alsasink_open): Get actual segment size and buffer size after opening the device.
This commit is contained in:
parent
b6764dcc97
commit
dc919d1291
2 changed files with 14 additions and 8 deletions
|
@ -1,3 +1,9 @@
|
||||||
|
2005-05-31 Wim Taymans <wim@fluendo.com>
|
||||||
|
|
||||||
|
* ext/alsa/gstalsasink.c: (set_hwparams), (gst_alsasink_open):
|
||||||
|
Get actual segment size and buffer size after opening
|
||||||
|
the device.
|
||||||
|
|
||||||
2005-05-30 Wim Taymans <wim@fluendo.com>
|
2005-05-30 Wim Taymans <wim@fluendo.com>
|
||||||
|
|
||||||
* ext/ogg/gstoggdemux.c: (gst_ogg_demux_activate_chain),
|
* ext/ogg/gstoggdemux.c: (gst_ogg_demux_activate_chain),
|
||||||
|
|
|
@ -206,20 +206,21 @@ set_hwparams (GstAlsaSink * alsa)
|
||||||
CHECK (snd_pcm_hw_params_set_buffer_time_near (alsa->handle, params,
|
CHECK (snd_pcm_hw_params_set_buffer_time_near (alsa->handle, params,
|
||||||
&alsa->buffer_time, &dir), buffer_time);
|
&alsa->buffer_time, &dir), buffer_time);
|
||||||
}
|
}
|
||||||
CHECK (snd_pcm_hw_params_get_buffer_size (params, &alsa->buffer_size),
|
|
||||||
buffer_size);
|
|
||||||
|
|
||||||
if (alsa->period_time != -1) {
|
if (alsa->period_time != -1) {
|
||||||
/* set the period time */
|
/* set the period time */
|
||||||
CHECK (snd_pcm_hw_params_set_period_time_near (alsa->handle, params,
|
CHECK (snd_pcm_hw_params_set_period_time_near (alsa->handle, params,
|
||||||
&alsa->period_time, &dir), period_time);
|
&alsa->period_time, &dir), period_time);
|
||||||
}
|
}
|
||||||
CHECK (snd_pcm_hw_params_get_period_size (params, &alsa->period_size, &dir),
|
|
||||||
period_size);
|
|
||||||
|
|
||||||
/* write the parameters to device */
|
/* write the parameters to device */
|
||||||
CHECK (snd_pcm_hw_params (alsa->handle, params), set_hw_params);
|
CHECK (snd_pcm_hw_params (alsa->handle, params), set_hw_params);
|
||||||
|
|
||||||
|
CHECK (snd_pcm_hw_params_get_buffer_size (params, &alsa->buffer_size),
|
||||||
|
buffer_size);
|
||||||
|
|
||||||
|
CHECK (snd_pcm_hw_params_get_period_size (params, &alsa->period_size, &dir),
|
||||||
|
period_size);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
/* ERRORS */
|
/* ERRORS */
|
||||||
|
@ -437,9 +438,8 @@ gst_alsasink_open (GstAudioSink * asink, GstRingBufferSpec * spec)
|
||||||
CHECK (set_hwparams (alsa), hw_params_failed);
|
CHECK (set_hwparams (alsa), hw_params_failed);
|
||||||
CHECK (set_swparams (alsa), sw_params_failed);
|
CHECK (set_swparams (alsa), sw_params_failed);
|
||||||
|
|
||||||
spec->bytes_per_sample = 4;
|
alsa->bytes_per_sample = spec->bytes_per_sample;
|
||||||
alsa->bytes_per_sample = 4;
|
spec->segsize = alsa->period_size * spec->bytes_per_sample;
|
||||||
spec->segsize = alsa->period_size * 4;
|
|
||||||
spec->segtotal = alsa->buffer_size / alsa->period_size;
|
spec->segtotal = alsa->buffer_size / alsa->period_size;
|
||||||
spec->silence_sample[0] = 0;
|
spec->silence_sample[0] = 0;
|
||||||
spec->silence_sample[1] = 0;
|
spec->silence_sample[1] = 0;
|
||||||
|
|
Loading…
Reference in a new issue