Commit 5d1efd57 authored by Ghislain MARY's avatar Ghislain MARY

Deprecate MSList and use bctbx_list_t instead.

parent e73957fb
This diff is collapsed.
......@@ -166,7 +166,7 @@ SoundDeviceDescription genericSoundDeviceDescriptor={"Generic", "Generic", "Gene
#endif
static MSList *sound_device_descriptions;
static bctbx_list_t *sound_device_descriptions;
static bool_t sound_device_match(SoundDeviceDescription *d, const char *manufacturer, const char* model, const char *platform){
if (strcasecmp(d->manufacturer, manufacturer) == 0
......@@ -181,7 +181,7 @@ static bool_t sound_device_match(SoundDeviceDescription *d, const char *manufact
}
static SoundDeviceDescription *lookup_sound_device(const char *manufacturer, const char* model, const char *platform) {
MSList *list = sound_device_descriptions;
bctbx_list_t *list = sound_device_descriptions;
SoundDeviceDescription *d;
for(; list != NULL; list = list->next) {
d = (SoundDeviceDescription*) list->data;
......@@ -213,7 +213,7 @@ void ms_sound_device_description_add(const char *manufacturer, const char *model
new_sound_device_description->delay = delay;
new_sound_device_description->recommended_rate = recommended_rate;
sound_device_descriptions = ms_list_append(sound_device_descriptions, new_sound_device_description);
sound_device_descriptions = bctbx_list_append(sound_device_descriptions, new_sound_device_description);
}
#ifndef PROP_VALUE_MAX
......@@ -307,7 +307,7 @@ MSDevicesInfo *ms_devices_info_new(void) {
}
void ms_devices_info_free(MSDevicesInfo *devices_info) {
ms_list_free(devices_info->sound_devices_descriptions);
bctbx_list_free(devices_info->sound_devices_descriptions);
ms_free(devices_info);
}
......@@ -320,11 +320,11 @@ void ms_devices_info_add(MSDevicesInfo *devices_info, const char *manufacturer,
new_sound_device_description->delay = delay;
new_sound_device_description->recommended_rate = recommended_rate;
devices_info->sound_devices_descriptions = ms_list_append(devices_info->sound_devices_descriptions, new_sound_device_description);
devices_info->sound_devices_descriptions = bctbx_list_append(devices_info->sound_devices_descriptions, new_sound_device_description);
}
SoundDeviceDescription* ms_devices_info_lookup_device(MSDevicesInfo *devices_info, const char *manufacturer, const char* model, const char *platform) {
MSList *list = devices_info->sound_devices_descriptions;
bctbx_list_t *list = devices_info->sound_devices_descriptions;
SoundDeviceDescription *d = NULL;
while(list) {
......@@ -332,7 +332,7 @@ SoundDeviceDescription* ms_devices_info_lookup_device(MSDevicesInfo *devices_inf
if (sound_device_match(d, manufacturer, model, platform)) {
return d;
}
list = ms_list_next(list);
list = bctbx_list_next(list);
}
if (platform) {
......
......@@ -382,15 +382,15 @@ MSFilterDesc ms_equalizer_desc={
#endif
MSList *ms_parse_equalizer_string(const char *str) {
MSList *eq_list = NULL;
bctbx_list_t *ms_parse_equalizer_string(const char *str) {
bctbx_list_t *eq_list = NULL;
do {
int bytes;
MSEqualizerGain g;
if (sscanf(str, "%f:%f:%f %n", &g.frequency, &g.gain, &g.width, &bytes) == 3) {
MSEqualizerGain *gain = ms_new(MSEqualizerGain, 1);
*gain = g;
eq_list = ms_list_append(eq_list, gain);
eq_list = bctbx_list_append(eq_list, gain);
str += bytes;
} else break;
} while (1);
......
......@@ -142,7 +142,7 @@ MSSndCardDesc pulse_card_desc={
};
void pa_sinklist_cb(pa_context *c, const pa_sink_info *l, int eol, void *userdata) {
MSList **pa_devicelist = userdata;
bctbx_list_t **pa_devicelist = userdata;
pa_device_t *pa_device;
/* when eol is set to a positive number : end of the list */
......@@ -154,13 +154,13 @@ void pa_sinklist_cb(pa_context *c, const pa_sink_info *l, int eol, void *userdat
strncpy(pa_device->name, l->name, PA_STRING_SIZE-1);
strncpy(pa_device->description, l->description, PA_STRING_SIZE-1);
*pa_devicelist = ms_list_append(*pa_devicelist, pa_device);
*pa_devicelist = bctbx_list_append(*pa_devicelist, pa_device);
end:
pa_threaded_mainloop_signal(the_pa_loop, FALSE);
}
void pa_sourcelist_cb(pa_context *c, const pa_source_info *l, int eol, void *userdata) {
MSList **pa_devicelist = userdata;
bctbx_list_t **pa_devicelist = userdata;
pa_device_t *pa_device;
if (eol > 0) {
......@@ -175,7 +175,7 @@ void pa_sourcelist_cb(pa_context *c, const pa_source_info *l, int eol, void *use
strncpy(pa_device->name, l->name, PA_STRING_SIZE -1);
strncpy(pa_device->description, l->description, PA_STRING_SIZE -1);
*pa_devicelist = ms_list_append(*pa_devicelist, pa_device);
*pa_devicelist = bctbx_list_append(*pa_devicelist, pa_device);
end:
pa_threaded_mainloop_signal(the_pa_loop, FALSE);
}
......@@ -227,13 +227,13 @@ int pulse_card_compare(pa_device_t *sink, pa_device_t *source) {
return strncmp(sink->description, source->description, 512);
}
static void pulse_card_merge_lists(pa_device_t *pa_device, MSList **pa_source_list) {
MSList *sourceCard = ms_list_find_custom(*pa_source_list, (MSCompareFunc)pulse_card_compare, pa_device);
static void pulse_card_merge_lists(pa_device_t *pa_device, bctbx_list_t **pa_source_list) {
bctbx_list_t *sourceCard = bctbx_list_find_custom(*pa_source_list, (bctbx_compare_func)pulse_card_compare, pa_device);
if (sourceCard!= NULL) {
pa_device_t *sourceCard_data = (pa_device_t *)sourceCard->data;
pa_device->bidirectionnal = 1;
strncpy(pa_device->source_name,sourceCard_data->name, PA_STRING_SIZE -1);
*pa_source_list = ms_list_remove(*pa_source_list, sourceCard->data);
*pa_source_list = bctbx_list_remove(*pa_source_list, sourceCard->data);
ms_free(sourceCard_data);
}
}
......@@ -246,8 +246,8 @@ static void pulse_card_merge_lists(pa_device_t *pa_device, MSList **pa_source_li
**/
static void pulse_card_detect(MSSndCardManager *m){
pa_operation *pa_op;
MSList *pa_sink_list=NULL;
MSList *pa_source_list=NULL;
bctbx_list_t *pa_sink_list=NULL;
bctbx_list_t *pa_source_list=NULL;
/* connect to pulse server */
init_pulse_context();
......@@ -279,14 +279,14 @@ static void pulse_card_detect(MSSndCardManager *m){
pa_threaded_mainloop_unlock(the_pa_loop);
/* merge source list into sink list for dual capabilities cards */
ms_list_for_each2(pa_sink_list, (MSIterate2Func)pulse_card_merge_lists, &pa_source_list);
bctbx_list_for_each2(pa_sink_list, (MSIterate2Func)pulse_card_merge_lists, &pa_source_list);
/* create sink and souce cards */
ms_list_for_each2(pa_sink_list, (MSIterate2Func)pulse_card_sink_create, m);
ms_list_for_each2(pa_source_list, (MSIterate2Func)pulse_card_source_create, m);
bctbx_list_for_each2(pa_sink_list, (MSIterate2Func)pulse_card_sink_create, m);
bctbx_list_for_each2(pa_source_list, (MSIterate2Func)pulse_card_source_create, m);
ms_list_free_with_data(pa_sink_list, ms_free);
ms_list_free_with_data(pa_source_list, ms_free);
bctbx_list_free_with_data(pa_sink_list, ms_free);
bctbx_list_free_with_data(pa_source_list, ms_free);
}
typedef enum _StreamType {
......
......@@ -939,7 +939,7 @@ static MSSndCard *winsnddscard_new(const char *name, LPGUID lpguid, int in_dev,
static void add_or_update_card(MSSndCardManager *m, const char *name, LPGUID lpguid, int indev, int outdev, unsigned int capability){
MSSndCard *card;
const MSList *elem=ms_snd_card_manager_get_list(m);
const bctbx_list_t *elem=ms_snd_card_manager_get_list(m);
for(;elem!=NULL;elem=elem->next){
card=(MSSndCard*)elem->data;
if (strcmp(card->desc->driver_type, winsndds_card_desc.driver_type)==0
......@@ -1092,7 +1092,7 @@ static void _winsnddscard_detect(MSSndCardManager *m){
static void deactivate_removed_cards(MSSndCardManager *m){
MSSndCard *card;
const MSList *elem=ms_snd_card_manager_get_list(m);
const bctbx_list_t *elem=ms_snd_card_manager_get_list(m);
for(;elem!=NULL;elem=elem->next){
card=(MSSndCard*)elem->data;
if (strcmp(card->desc->driver_type, winsndds_card_desc.driver_type)==0){
......@@ -1105,7 +1105,7 @@ static void deactivate_removed_cards(MSSndCardManager *m){
static void mark_as_removed(MSSndCardManager *m){
MSSndCard *card;
const MSList *elem=ms_snd_card_manager_get_list(m);
const bctbx_list_t *elem=ms_snd_card_manager_get_list(m);
for(;elem!=NULL;elem=elem->next){
card=(MSSndCard*)elem->data;
if (strcmp(card->desc->driver_type, winsndds_card_desc.driver_type)==0){
......@@ -1424,14 +1424,14 @@ static void winsndds_write_preprocess(MSFilter *f){
unsigned char* pDSBuffData;
DWORD outputBufferWriteOffsetBytes;
MSList *filters=NULL;
bctbx_list_t *filters=NULL;
MSFilter *f_capture_filter=NULL;
WinSndDs *d_capture_filter=NULL;
filters=ms_filter_find_neighbours(f);
if (filters!=NULL)
{
MSList *it;
bctbx_list_t *it;
/* search for another winsndds filter */
for(it=filters;it!=NULL;it=it->next)
{
......@@ -1444,7 +1444,7 @@ static void winsndds_write_preprocess(MSFilter *f){
}
f_capture_filter=NULL;
}
ms_list_free(filters);
bctbx_list_free(filters);
}
d->stat_input=0;
......
......@@ -229,12 +229,12 @@ static void ms_notify_context_destroy(MSNotifyContext *obj){
}
void ms_filter_add_notify_callback(MSFilter *f, MSFilterNotifyFunc fn, void *ud, bool_t synchronous){
f->notify_callbacks=ms_list_append(f->notify_callbacks,ms_notify_context_new(fn,ud,synchronous));
f->notify_callbacks=bctbx_list_append(f->notify_callbacks,ms_notify_context_new(fn,ud,synchronous));
}
void ms_filter_remove_notify_callback(MSFilter *f, MSFilterNotifyFunc fn, void *ud){
MSList *elem;
MSList *found=NULL;
bctbx_list_t *elem;
bctbx_list_t *found=NULL;
for(elem=f->notify_callbacks;elem!=NULL;elem=elem->next){
MSNotifyContext *ctx=(MSNotifyContext*)elem->data;
if (ctx->fn==fn && ctx->ud==ud){
......@@ -244,16 +244,16 @@ void ms_filter_remove_notify_callback(MSFilter *f, MSFilterNotifyFunc fn, void *
}
if (found){
ms_notify_context_destroy((MSNotifyContext*)found->data);
f->notify_callbacks=ms_list_remove_link(f->notify_callbacks,found);
f->notify_callbacks=bctbx_list_remove_link(f->notify_callbacks,found);
}else ms_warning("ms_filter_remove_notify_callback(filter=%p): no registered callback with fn=%p and ud=%p",f,fn,ud);
}
void ms_filter_clear_notify_callback(MSFilter *f){
f->notify_callbacks=ms_list_free_with_data(f->notify_callbacks,(void (*)(void*))ms_notify_context_destroy);
f->notify_callbacks=bctbx_list_free_with_data(f->notify_callbacks,(void (*)(void*))ms_notify_context_destroy);
}
static void ms_filter_invoke_callbacks(MSFilter **f, unsigned int id, void *arg, InvocationMode synchronous_mode){
MSList *elem;
bctbx_list_t *elem;
for (elem=(*f)->notify_callbacks;elem!=NULL;elem=elem->next){
MSNotifyContext *ctx=(MSNotifyContext*)elem->data;
if (synchronous_mode==Both || (synchronous_mode==OnlyAsynchronous && !ctx->synchronous)
......
......@@ -58,103 +58,51 @@ void ms_set_cpu_count(unsigned int c) {
}
MSList *ms_list_new(void *data){
MSList *new_elem=(MSList *)ms_new0(MSList,1);
new_elem->data=data;
return new_elem;
return bctbx_list_new(data);
}
MSList *ms_list_append_link(MSList *elem, MSList *new_elem){
MSList *it=elem;
if (elem==NULL) return new_elem;
while (it->next!=NULL) it=ms_list_next(it);
it->next=new_elem;
new_elem->prev=it;
return elem;
return bctbx_list_append_link(elem, new_elem);
}
MSList * ms_list_append(MSList *elem, void * data){
MSList *new_elem=ms_list_new(data);
return ms_list_append_link(elem,new_elem);
return bctbx_list_append(elem, data);
}
MSList * ms_list_prepend(MSList *elem, void *data){
MSList *new_elem=ms_list_new(data);
if (elem!=NULL) {
new_elem->next=elem;
elem->prev=new_elem;
}
return new_elem;
return bctbx_list_prepend(elem, data);
}
MSList * ms_list_concat(MSList *first, MSList *second){
MSList *it=first;
if (it==NULL) return second;
while(it->next!=NULL) it=ms_list_next(it);
it->next=second;
second->prev=it;
return first;
return bctbx_list_concat(first, second);
}
MSList * ms_list_free_with_data(MSList *list, void (*freefunc)(void*)){
MSList *elem;
MSList *tmp;
for (elem=list;elem!=NULL;){
tmp=elem->next;
if (freefunc) freefunc(elem->data);
ms_free(elem);
elem=tmp;
}
return NULL;
return bctbx_list_free_with_data(list, freefunc);
}
MSList * ms_list_free(MSList *elem){
return ms_list_free_with_data(elem,NULL);
return bctbx_list_free(elem);
}
MSList * ms_list_remove(MSList *first, void *data){
MSList *it;
it=ms_list_find(first,data);
if (it) return ms_list_remove_link(first,it);
else {
ms_warning("ms_list_remove: no element with %p data was in the list", data);
return first;
}
return bctbx_list_remove(first, data);
}
MSList * ms_list_remove_custom(MSList *first, MSCompareFunc compare_func, const void *user_data) {
MSList *cur;
MSList *elem = first;
while (elem != NULL) {
cur = elem;
elem = elem->next;
if (compare_func(cur->data, user_data) == 0) {
first = ms_list_remove(first, cur->data);
}
}
return first;
return bctbx_list_remove_custom(first, compare_func, user_data);
}
size_t ms_list_size(const MSList *first){
size_t n=0;
while(first!=NULL){
++n;
first=first->next;
}
return n;
int ms_list_size(const MSList *first){
return (int)bctbx_list_size(first);
}
void ms_list_for_each(const MSList *list, void (*func)(void *)){
for(;list!=NULL;list=list->next){
func(list->data);
}
bctbx_list_for_each(list, func);
}
void ms_list_for_each2(const MSList *list, void (*func)(void *, void *y), void *user_data){
for(;list!=NULL;list=list->next){
func(list->data,user_data);
}
bctbx_list_for_each2(list, func, user_data);
}
void ms_list_for_each3(const MSList *list, void (*func)(void *, void *, void*), void *user_data, void* factory){
......@@ -164,131 +112,52 @@ void ms_list_for_each3(const MSList *list, void (*func)(void *, void *, void*),
}
MSList *ms_list_remove_link(MSList *list, MSList *elem){
MSList *ret;
if (elem==list){
ret=elem->next;
elem->prev=NULL;
elem->next=NULL;
if (ret!=NULL) ret->prev=NULL;
ms_free(elem);
return ret;
}
elem->prev->next=elem->next;
if (elem->next!=NULL) elem->next->prev=elem->prev;
elem->next=NULL;
elem->prev=NULL;
ms_free(elem);
return list;
return bctbx_list_remove_link(list, elem);
}
MSList *ms_list_find(MSList *list, void *data){
for(;list!=NULL;list=list->next){
if (list->data==data) return list;
}
return NULL;
return bctbx_list_find(list, data);
}
MSList *ms_list_find_custom(MSList *list, int (*compare_func)(const void *, const void*), const void *user_data){
for(;list!=NULL;list=list->next){
if (compare_func(list->data,user_data)==0) return list;
}
return NULL;
return bctbx_list_find_custom(list, compare_func, user_data);
}
void * ms_list_nth_data(const MSList *list, int index){
int i;
for(i=0;list!=NULL;list=list->next,++i){
if (i==index) return list->data;
}
ms_error("ms_list_nth_data: no such index in list.");
return NULL;
return bctbx_list_nth_data(list, index);
}
int ms_list_position(const MSList *list, MSList *elem){
int i;
for(i=0;list!=NULL;list=list->next,++i){
if (elem==list) return i;
}
ms_error("ms_list_position: no such element in list.");
return -1;
return bctbx_list_position(list, elem);
}
int ms_list_index(const MSList *list, void *data){
int i;
for(i=0;list!=NULL;list=list->next,++i){
if (data==list->data) return i;
}
ms_error("ms_list_index: no such element in list.");
return -1;
return bctbx_list_index(list, data);
}
MSList *ms_list_insert_sorted(MSList *list, void *data, int (*compare_func)(const void *, const void*)){
MSList *it,*previt=NULL;
MSList *nelem;
MSList *ret=list;
if (list==NULL) return ms_list_append(list,data);
else{
nelem=ms_list_new(data);
for(it=list;it!=NULL;it=it->next){
previt=it;
if (compare_func(data,it->data)<=0){
nelem->prev=it->prev;
nelem->next=it;
if (it->prev!=NULL)
it->prev->next=nelem;
else{
ret=nelem;
}
it->prev=nelem;
return ret;
}
}
previt->next=nelem;
nelem->prev=previt;
}
return ret;
return bctbx_list_insert_sorted(list, data, compare_func);
}
MSList *ms_list_insert(MSList *list, MSList *before, void *data){
MSList *elem;
if (list==NULL || before==NULL) return ms_list_append(list,data);
for(elem=list;elem!=NULL;elem=ms_list_next(elem)){
if (elem==before){
if (elem->prev==NULL)
return ms_list_prepend(list,data);
else{
MSList *nelem=ms_list_new(data);
nelem->prev=elem->prev;
nelem->next=elem;
elem->prev->next=nelem;
elem->prev=nelem;
}
}
}
return list;
return bctbx_list_insert(list, before, data);
}
MSList *ms_list_copy(const MSList *list){
MSList *copy=NULL;
const MSList *iter;
for(iter=list;iter!=NULL;iter=ms_list_next(iter)){
copy=ms_list_append(copy,iter->data);
}
return copy;
return bctbx_list_copy(list);
}
MSList *ms_list_copy_with_data(const MSList *list, void *(*copyfunc)(void *)){
MSList *copy=NULL;
const MSList *iter;
for(iter=list;iter!=NULL;iter=ms_list_next(iter)){
copy=ms_list_append(copy,copyfunc(iter->data));
}
return copy;
return bctbx_list_copy_with_data(list, copyfunc);
}
MSList* ms_list_next(const MSList *list) {
return bctbx_list_next(list);
}
char * ms_tags_list_as_string(const MSList *list) {
char * ms_tags_list_as_string(const bctbx_list_t *list) {
char *tags_str = NULL;
const MSList *elem = list;
const bctbx_list_t *elem = list;
while (elem != NULL) {
char *elem_str = (char *)elem->data;
if (tags_str == NULL) {
......@@ -303,8 +172,8 @@ char * ms_tags_list_as_string(const MSList *list) {
return tags_str;
}
bool_t ms_tags_list_contains_tag(const MSList *list, const char *tag) {
const MSList *elem = list;
bool_t ms_tags_list_contains_tag(const bctbx_list_t *list, const char *tag) {
const bctbx_list_t *elem = list;
while (elem != NULL) {
char *tag_from_list = (char *)elem->data;
if (strcasecmp(tag, tag_from_list) == 0)
......
This diff is collapsed.
......@@ -96,7 +96,7 @@ bool_t ms_filter_implements_interface(MSFilter *f, MSFilterInterfaceId id){
return ms_filter_desc_implements_interface(f->desc,id);
}
MSList *ms_filter_lookup_by_interface(MSFilterInterfaceId id){
bctbx_list_t *ms_filter_lookup_by_interface(MSFilterInterfaceId id){
return ms_factory_lookup_filter_by_interface(ms_factory_get_fallback(),id);
}
......@@ -262,11 +262,11 @@ void ms_filter_postpone_task(MSFilter *f, MSFilterFunc taskfunc){
task=ms_new0(MSFilterTask,1);
task->f=f;
task->taskfunc=taskfunc;
ticker->task_list=ms_list_prepend(ticker->task_list,task);
ticker->task_list=bctbx_list_prepend(ticker->task_list,task);
f->postponed_task++;
}
static void find_filters(MSList **filters, MSFilter *f ){
static void find_filters(bctbx_list_t **filters, MSFilter *f ){
int i,found;
MSQueue *link;
if (f==NULL) ms_fatal("Bad graph.");
......@@ -275,7 +275,7 @@ static void find_filters(MSList **filters, MSFilter *f ){
return;
}
f->seen=TRUE;
*filters=ms_list_append(*filters,f);
*filters=bctbx_list_append(*filters,f);
/* go upstream */
for(i=0;i<f->desc->ninputs;i++){
link=f->inputs[i];
......@@ -294,9 +294,9 @@ static void find_filters(MSList **filters, MSFilter *f ){
}
}
MSList * ms_filter_find_neighbours(MSFilter *me){
MSList *l=NULL;
MSList *it;
bctbx_list_t * ms_filter_find_neighbours(MSFilter *me){
bctbx_list_t *l=NULL;
bctbx_list_t *it;
find_filters(&l,me);
/*reset seen boolean for further lookups to succeed !*/
for(it=l;it!=NULL;it=it->next){
......@@ -345,7 +345,7 @@ void ms_filter_enable_statistics(bool_t enabled){
ms_factory_enable_statistics(ms_factory_get_fallback(),enabled);
}
const MSList * ms_filter_get_statistics(void){
const bctbx_list_t * ms_filter_get_statistics(void){
return ms_factory_get_statistics(ms_factory_get_fallback());
}
......
......@@ -34,15 +34,15 @@ MSSndCardManager * ms_snd_card_manager_new(void){
void ms_snd_card_manager_destroy(MSSndCardManager* scm){
if (scm!=NULL){
MSList *elem;
bctbx_list_t *elem;
for(elem=scm->descs;elem!=NULL;elem=elem->next){
MSSndCardDesc *desc = (MSSndCardDesc*)elem->data;
if (desc->unload!=NULL)
desc->unload(scm);
}
ms_list_for_each(scm->cards,(void (*)(void*))ms_snd_card_destroy);
ms_list_free(scm->cards);
ms_list_free(scm->descs);
bctbx_list_for_each(scm->cards,(void (*)(void*))ms_snd_card_destroy);
bctbx_list_free(scm->cards);
bctbx_list_free(scm->descs);
}
ms_free(scm);
scm=NULL;
......@@ -53,7 +53,7 @@ MSFactory * ms_snd_card_get_factory(MSSndCard * c){
}
MSSndCard * ms_snd_card_manager_get_card(MSSndCardManager *m, const char *id){
MSList *elem;
bctbx_list_t *elem;
for (elem=m->cards;elem!=NULL;elem=elem->next){
MSSndCard *card=(MSSndCard*)elem->data;
if (id==NULL) return card;
......@@ -64,7 +64,7 @@ MSSndCard * ms_snd_card_manager_get_card(MSSndCardManager *m, const char *id){
}
static MSSndCard *get_card_with_cap(MSSndCardManager *m, const char *id, unsigned int caps){
MSList *elem;
bctbx_list_t *elem;
for (elem=m->cards;elem!=NULL;elem=elem->next){
MSSndCard *card=(MSSndCard*)elem->data;
if ((id== NULL || strcmp(ms_snd_card_get_string_id(card),id)==0) && (card->capabilities & caps) == caps) return card;
......@@ -101,7 +101,7 @@ MSSndCard * ms_snd_card_manager_get_default_playback_card(MSSndCardManager *m){
return get_card_with_cap(m, NULL, MS_SND_CARD_CAP_PLAYBACK);
}
const MSList * ms_snd_card_manager_get_list(MSSndCardManager *m){
const bctbx_list_t * ms_snd_card_manager_get_list(MSSndCardManager *m){
return m->cards;
}
......@@ -119,13 +119,13 @@ static const char *cap_to_string(unsigned int cap){
void ms_snd_card_manager_add_card(MSSndCardManager *m, MSSndCard *c){
ms_snd_card_set_manager(m,c);
ms_message("Card '%s' added with capabilities [%s]",ms_snd_card_get_string_id(c), cap_to_string(c->capabilities));
m->cards=ms_list_append(m->cards,c);
m->cards=bctbx_list_append(m->cards,c);
}
void ms_snd_card_manager_prepend_cards(MSSndCardManager *m, MSList *l) {
MSList *elem;
MSList *lcopy = ms_list_copy(l);
if (m->cards != NULL) m->cards = ms_list_concat(lcopy, m->cards);
void ms_snd_card_manager_prepend_cards(MSSndCardManager *m, bctbx_list_t *l) {
bctbx_list_t *elem;
bctbx_list_t *lcopy = bctbx_list_copy(l);
if (m->cards != NULL) m->cards = bctbx_list_concat(lcopy, m->cards);
else m->cards = lcopy;
for (elem = l; elem != NULL; elem = elem->next) {
MSSndCard *card = (MSSndCard *)elem->data;
......@@ -140,16 +140,16 @@ static void card_detect(MSSndCardManager *m, MSSndCardDesc *desc){
}
void ms_snd_card_manager_register_desc(MSSndCardManager *m, MSSndCardDesc *desc){
if (ms_list_find(m->descs, desc) == NULL){
m->descs=ms_list_append(m->descs,desc);
if (bctbx_list_find(m->descs, desc) == NULL){
m->descs=bctbx_list_append(m->descs,desc);
card_detect(m,desc);
}
}
void ms_snd_card_manager_reload(MSSndCardManager *m){
MSList *elem;
ms_list_for_each(m->cards,(void (*)(void*))ms_snd_card_destroy);
ms_list_free(m->cards);
bctbx_list_t *elem;
bctbx_list_for_each(m->cards,(void (*)(void*))ms_snd_card_destroy);
bctbx_list_free(m->cards);
m->cards=NULL;
for(elem=m->descs;elem!=NULL;elem=elem->next)
card_detect(m,(MSSndCardDesc*)elem->data);
......
......@@ -118,13 +118,13 @@ void ms_ticker_destroy(MSTicker *ticker){
}
static MSList *get_sources(MSList *filters){
MSList *sources=NULL;
static bctbx_list_t *get_sources(bctbx_list_t *filters){
bctbx_list_t *sources=NULL;
MSFilter *f;
for(;filters!=NULL;filters=filters->next){
f=(MSFilter*)filters->data;
if (f->desc->ninputs==0){
sources=ms_list_append(sources,f);
sources=bctbx_list_append(sources,f);
}
}
return sources;
......@@ -136,10 +136,10 @@ int ms_ticker_attach(MSTicker *ticker, MSFilter *f){
int ms_ticker_attach_multiple(MSTicker *ticker,MSFilter *f,...)
{
MSList *sources=NULL;
MSList *filters=NULL;
MSList *it;
MSList *total_sources=NULL;
bctbx_list_t *sources=NULL;
bctbx_list_t *filters=NULL;
bctbx_list_t *it;
bctbx_list_t *total_sources=NULL;
va_list l;
va_start(l,f);
......@@ -150,20 +150,20 @@ int ms_ticker_attach_multiple(MSTicker *ticker,MSFilter *f,...)
sources=get_sources(filters);
if (sources==NULL){
ms_fatal("No sources found around filter %s",f->desc->name);
ms_list_free(filters);
bctbx_list_free(filters);
break;
}
/*run preprocess on each filter: */
for(it=filters;it!=NULL;it=it->next)
ms_filter_preprocess((MSFilter*)it->data,ticker);
ms_list_free(filters);
total_sources=ms_list_concat(total_sources,sources);
bctbx_list_free(filters);
total_sources=bctbx_list_concat(total_sources,sources);