Update of /cvsroot/alsa/alsa-lib/src/pcm
In directory usw-pr-cvs1:/tmp/cvs-serv26778
Modified Files:
interval.h interval_inline.h pcm.c pcm_local.h
Log Message:
Added snd_pcm_hw_params_current() function and clear() functions for structures
Index: interval.h
===================================================================
RCS file: /cvsroot/alsa/alsa-lib/src/pcm/interval.h,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- interval.h 30 Dec 2001 09:22:55 -0000 1.9
+++ interval.h 12 Oct 2002 10:39:50 -0000 1.10
@@ -30,6 +30,7 @@
int snd_interval_empty(const snd_interval_t *i);
int snd_interval_single(const snd_interval_t *i);
int snd_interval_value(const snd_interval_t *i);
+void snd_interval_set_value(snd_interval_t *i, unsigned int val);
int snd_interval_min(const snd_interval_t *i);
int snd_interval_max(const snd_interval_t *i);
int snd_interval_test(const snd_interval_t *i, unsigned int val);
Index: interval_inline.h
===================================================================
RCS file: /cvsroot/alsa/alsa-lib/src/pcm/interval_inline.h,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- interval_inline.h 30 Dec 2001 09:22:55 -0000 1.10
+++ interval_inline.h 12 Oct 2002 10:39:50 -0000 1.11
@@ -60,6 +60,14 @@
return i->min;
}
+INTERVAL_INLINE void snd_interval_set_value(snd_interval_t *i, unsigned int val)
+{
+ i->openmax = i->openmin = 0;
+ i->min = i->max = val;
+ i->integer = 0;
+ i->empty = 0;
+}
+
INTERVAL_INLINE int snd_interval_min(const snd_interval_t *i)
{
assert(!snd_interval_empty(i));
Index: pcm.c
===================================================================
RCS file: /cvsroot/alsa/alsa-lib/src/pcm/pcm.c,v
retrieving revision 1.225
retrieving revision 1.226
diff -u -r1.225 -r1.226
--- pcm.c 11 Oct 2002 18:39:24 -0000 1.225
+++ pcm.c 12 Oct 2002 10:39:50 -0000 1.226
@@ -734,6 +734,41 @@
return pcm->ops->info(pcm->op_arg, info);
}
+/** \brief Retreive current PCM hardware configuration chosen with #snd_pcm_hw_params
+ * \param pcm PCM handle
+ * \param params Configuration space definition container
+ * \return 0 on success otherwise a negative error code
+ */
+int snd_pcm_hw_params_current(snd_pcm_t *pcm, snd_pcm_hw_params_t *params)
+{
+ unsigned int frame_bits;
+
+ assert(pcm && params);
+ if (!pcm->setup)
+ return -EBADFD;
+ snd_pcm_hw_params_clear(params);
+ snd_mask_copy(¶ms->masks[SND_PCM_HW_PARAM_ACCESS], (snd_mask_t
+*)&pcm->access);
+ snd_mask_copy(¶ms->masks[SND_PCM_HW_PARAM_FORMAT], (snd_mask_t
+*)&pcm->format);
+ snd_mask_copy(¶ms->masks[SND_PCM_HW_PARAM_SUBFORMAT], (snd_mask_t
+*)&pcm->subformat);
+ frame_bits = snd_pcm_format_physical_width(pcm->format) * pcm->channels;
+ snd_interval_set_value(¶ms->intervals[SND_PCM_HW_PARAM_FRAME_BITS],
+frame_bits);
+ snd_interval_set_value(¶ms->intervals[SND_PCM_HW_PARAM_CHANNELS],
+pcm->channels);
+ snd_interval_set_value(¶ms->intervals[SND_PCM_HW_PARAM_RATE], pcm->rate);
+ snd_interval_set_value(¶ms->intervals[SND_PCM_HW_PARAM_PERIOD_TIME],
+pcm->period_time);
+ snd_interval_set_value(¶ms->intervals[SND_PCM_HW_PARAM_PERIOD_SIZE],
+pcm->period_size);
+ snd_interval_copy(¶ms->intervals[SND_PCM_HW_PARAM_PERIODS], &pcm->periods);
+ snd_interval_copy(¶ms->intervals[SND_PCM_HW_PARAM_BUFFER_TIME],
+&pcm->buffer_time);
+ snd_interval_set_value(¶ms->intervals[SND_PCM_HW_PARAM_BUFFER_SIZE],
+pcm->buffer_size);
+ snd_interval_set_value(¶ms->intervals[SND_PCM_HW_PARAM_BUFFER_BYTES],
+(pcm->buffer_size * frame_bits) / 8);
+ snd_interval_set_value(¶ms->intervals[SND_PCM_HW_PARAM_TICK_TIME],
+pcm->tick_time);
+ params->info = pcm->info;
+ params->msbits = pcm->msbits;
+ params->rate_num = pcm->rate_num;
+ params->rate_den = pcm->rate_den;
+ params->fifo_size = pcm->fifo_size;
+ return 0;
+}
+
/** \brief Install one PCM hardware configuration chosen from a configuration space
and #snd_pcm_prepare it
* \param pcm PCM handle
* \param params Configuration space definition container
Index: pcm_local.h
===================================================================
RCS file: /cvsroot/alsa/alsa-lib/src/pcm/pcm_local.h,v
retrieving revision 1.116
retrieving revision 1.117
diff -u -r1.116 -r1.117
--- pcm_local.h 11 Oct 2002 18:39:25 -0000 1.116
+++ pcm_local.h 12 Oct 2002 10:39:50 -0000 1.117
@@ -170,6 +170,7 @@
unsigned int rate; /* rate in Hz */
snd_pcm_uframes_t period_size;
unsigned int period_time; /* period duration */
+ snd_interval_t periods;
unsigned int tick_time;
snd_pcm_tstamp_t tstamp_mode; /* timestamp mode */
unsigned int period_step;
@@ -188,6 +189,7 @@
unsigned int rate_den; /* rate denominator */
snd_pcm_uframes_t fifo_size; /* chip FIFO size in frames */
snd_pcm_uframes_t buffer_size;
+ snd_interval_t buffer_time;
unsigned int sample_bits;
unsigned int frame_bits;
snd_pcm_rbptr_t appl;
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Alsa-cvslog mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/alsa-cvslog