Commit 6fd5baee authored by jehan's avatar jehan

fast iounit first version

parent 8246ab7a
...@@ -131,6 +131,7 @@ struct _MSSndCard{ ...@@ -131,6 +131,7 @@ struct _MSSndCard{
char *id; char *id;
unsigned int capabilities; unsigned int capabilities;
void *data; void *data;
int preferred_sample_rate;
}; };
/** /**
...@@ -425,6 +426,26 @@ MS2_PUBLIC int ms_snd_card_set_control(MSSndCard *obj, MSSndCardControlElem e, i ...@@ -425,6 +426,26 @@ MS2_PUBLIC int ms_snd_card_set_control(MSSndCard *obj, MSSndCardControlElem e, i
*/ */
MS2_PUBLIC int ms_snd_card_get_control(MSSndCard *obj, MSSndCardControlElem e); MS2_PUBLIC int ms_snd_card_get_control(MSSndCard *obj, MSSndCardControlElem e);
/**
* Get preferred sample rate
*
* @param obj A sound card object.
*
* Returns: return sample rate in khz
*/
MS2_PUBLIC int ms_snd_card_get_preferred_sample_rate(const MSSndCard *obj);
/**
* set preferred sample rate. The underlying card will try to avoid any resampling for this samplerate.
*
* @param obj A sound card object.
* @param rate sampling rate.
*
* Returns: 0 if successfull, <0 otherwise.
*/
MS2_PUBLIC int ms_snd_card_set_preferred_sample_rate(MSSndCard *obj,int rate);
/** /**
* Create a alsa card with user supplied pcm name and mixer name. * Create a alsa card with user supplied pcm name and mixer name.
* @param pcmdev The pcm device name following alsa conventions (ex: plughw:0) * @param pcmdev The pcm device name following alsa conventions (ex: plughw:0)
......
...@@ -114,7 +114,7 @@ libmediastreamer_la_SOURCES+=macsnd.c ...@@ -114,7 +114,7 @@ libmediastreamer_la_SOURCES+=macsnd.c
endif endif
if BUILD_IOSIOUNIT if BUILD_IOSIOUNIT
libmediastreamer_la_SOURCES+=msiounit.c libmediastreamer_la_SOURCES+=msiounit.m
endif endif
if BUILD_MACAQSND if BUILD_MACAQSND
......
...@@ -910,7 +910,7 @@ static void aq_put(MSFilter * f, mblk_t * m) ...@@ -910,7 +910,7 @@ static void aq_put(MSFilter * f, mblk_t * m)
(d->writeBufferByteSize * d->writeAudioFormat.mSampleRate / 1) / (d->writeBufferByteSize * d->writeAudioFormat.mSampleRate / 1) /
d->devicewriteFormat.mSampleRate / d->devicewriteFormat.mSampleRate /
d->devicewriteFormat.mChannelsPerFrame; d->devicewriteFormat.mChannelsPerFrame;
if (d->write_started == FALSE && d->bufferizer->size >= len) { if (d->write_started == FALSE && d->bufferizer->size >= len && d->curWriteBuffer<4) {
AudioQueueBufferRef curbuf = d->writeBuffers[d->curWriteBuffer]; AudioQueueBufferRef curbuf = d->writeBuffers[d->curWriteBuffer];
#if 0 #if 0
OSStatus err; OSStatus err;
......
This diff is collapsed.
...@@ -226,6 +226,15 @@ void ms_snd_card_destroy(MSSndCard *obj){ ...@@ -226,6 +226,15 @@ void ms_snd_card_destroy(MSSndCard *obj){
ms_free(obj); ms_free(obj);
} }
int ms_snd_card_get_preferred_sample_rate(const MSSndCard *obj) {
return obj->preferred_sample_rate;
}
int ms_snd_card_set_preferred_sample_rate(MSSndCard *obj,int rate) {
obj->preferred_sample_rate=rate;
return 0;
}
#ifdef __linux #ifdef __linux
#ifndef __ALSA_ENABLED__ #ifndef __ALSA_ENABLED__
MSSndCard * ms_alsa_card_new_custom(const char *pcmdev, const char *mixdev){ MSSndCard * ms_alsa_card_new_custom(const char *pcmdev, const char *mixdev){
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment