[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Linphone-developers] MSConf.c without using pin 0
From: |
Raust Tamatea |
Subject: |
Re: [Linphone-developers] MSConf.c without using pin 0 |
Date: |
Mon, 05 Jul 2010 16:22:54 +0200 |
User-agent: |
Thunderbird 2.0.0.22 (Windows/20090605) |
damico a écrit :
Il 05/07/2010 14:18, Raust Tamatea ha scritto:
Hello,
I'm using msconf for my application. After reading the code and
trying many things, I've found 2 limitations : MSConf need to have a
filter on PIN 0 and there must be data on PIN 0.
I would like to know if someone have modified the msconf.c file to
create a "true" conferecing file ? I mean, a conf that just take
input from each PIN, mix it and dispatch to other output PIN. Even if
there is no data on PIN. How can I do this ?
Regards.
_______________________________________________
Linphone-developers mailing list
address@hidden
http://lists.nongnu.org/mailman/listinfo/linphone-developers
If I understand correctly what you mean, you can do it just by writing
a simple "Blank source" that pumping 0-data to MSConf at the pin 0
(try with the attached code).
In order to work correctly, MSConf need a stable data source on the
first pin: that constraint is a short path to implement a conference
module in a rtp-scenario where some packets could be lost or come with
lag.
Regards
--Michele
------------------------------------------------------------------------
_______________________________________________
Linphone-developers mailing list
address@hidden
http://lists.nongnu.org/mailman/listinfo/linphone-developers
Again, you saved me ^^
That what I was needing after small modifications in your file. Before I
was playing an empty file but not really a good solution. Your solution
is better.
Thanks a lot for your help :)
Regards.
PS : I link the .c & .h. Maybe someone will need them.
/*
mediastreamer2 library - modular sound and video processing and streaming
Copyright (C) 2006 Simon MORLAT (address@hidden)
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef msblankplayer_h
#define msblankplayer_h
#include "msfilter.h"
#define MS_BLANK_PLAYER_START
MS_FILTER_METHOD(MS_BLANK_PLAYER_ID,0,const char)
#define MS_BLANK_PLAYER_PAUSE
MS_FILTER_METHOD_NO_ARG(MS_BLANK_PLAYER_ID,1)
#define MS_BLANK_GET_SAMPLE_RATE
MS_FILTER_METHOD_NO_ARG(MS_BLANK_PLAYER_ID,2)
#define MS_BLANK_GET_NCHANNELS
MS_FILTER_METHOD_NO_ARG(MS_BLANK_PLAYER_ID,3)
extern MSFilterDesc ms_blank_player_desc;
#endif
/*
mediastreamer2 library - modular sound and video processing and streaming
Copyright (C) 2006 Simon MORLAT (address@hidden)
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "mediastreamer2/msblankplayer.h"
#include "mediastreamer2/msticker.h"
#ifdef DMALLOC
#include "dmalloc.h"
#endif
typedef enum {
INIT,
STARTED,
PAUSE
} PlayerState;
struct _PlayerData{
PlayerState state;
int rate;
int nchannels;
};
typedef struct _PlayerData PlayerData;
static void player_init(MSFilter *f){
PlayerData *d=(PlayerData *)ms_new(PlayerData,1);
d->state=INIT;
d->rate=8000;
d->nchannels=1;
f->data=d;
}
static int player_start(MSFilter *f, void *arg){
PlayerData *d=(PlayerData*)f->data;
ms_filter_lock(f);
d->state=STARTED;
ms_filter_unlock(f);
return 0;
}
static int player_pause(MSFilter *f, void *arg){
PlayerData *d=(PlayerData*)f->data;
ms_filter_lock(f);
d->state=PAUSE;
ms_filter_unlock(f);
return 0;
}
static void player_uninit(MSFilter *f){
PlayerData *d=(PlayerData*)f->data;
ms_free(d);
}
#undef _RAMP__
//#define _RAMP__ 20
#ifdef _RAMP__
static short ramp = 0x0;
#endif
static void player_process(MSFilter *f){
PlayerData *d=(PlayerData*)f->data;
int bytes=2*(f->ticker->interval*d->rate*d->nchannels)/1000;
ms_filter_lock(f);
if (d->state==STARTED){
mblk_t *om=allocb(bytes,0);
if (om){
#ifdef _RAMP__
int i;
for (i=0;i<bytes/2;++i){
((short *)om->b_wptr)[i] = ramp;
ramp += _RAMP__;
}
#else
memset(om->b_wptr,0,bytes);
#endif
om->b_wptr+=bytes;
ms_queue_put(f->outputs[0],om);
}else{
ms_warning("Fail to allocate %i bytes",bytes);
}
}
ms_filter_unlock(f);
}
static int player_get_sr(MSFilter *f, void*arg){
PlayerData *d=(PlayerData*)f->data;
*((int*)arg)=d->rate;
return 0;
}
static int player_get_nch(MSFilter *f, void *arg){
PlayerData *d=(PlayerData*)f->data;
*((int*)arg)=d->nchannels;
return 0;
}
static MSFilterMethod player_methods[]={
{ MS_BLANK_PLAYER_START, player_start },
{ MS_BLANK_PLAYER_PAUSE, player_pause },
{ MS_BLANK_GET_SAMPLE_RATE, player_get_sr},
{ MS_BLANK_GET_NCHANNELS, player_get_nch },
{ 0, NULL }
};
#ifdef WIN32
MSFilterDesc ms_blank_player_desc={
MS_BLANK_PLAYER_ID,
"MSBlankPlayer",
"Blank stream producer",
MS_FILTER_OTHER,
NULL,
0,
1,
player_init,
NULL,
player_process,
NULL,
player_uninit,
player_methods
};
#else
MSFilterDesc ms_blank_player_desc={
.id=MS_BLANK_PLAYER_ID,
.name="MSBlankPlayer",
.text="Blank stream producer",
.category=MS_FILTER_OTHER,
.ninputs=0,
.noutputs=1,
.init=player_init,
.process=player_process,
.uninit=player_uninit,
.methods=player_methods
};
#endif
MS_FILTER_DESC_EXPORT(ms_blank_player_desc)