Commit 48590b7e authored by Aymeric Moizard's avatar Aymeric Moizard
Browse files

Merge branch 'master' of git.linphone.org:mediastreamer2

parents 3d5daa76 d45f8e79
INSTALL
install-sh
aclocal.m4
*~
configure
Makefile.in
Makefile
build-aux
m4
autom4te.cache
*.o
*.lo
*.la
config.log
config.guess
config.sub
config.status
.deps
.libs
libtool
ltmain.sh
depcomp
mediastreamer-config.h
mediastreamer-config.h.in
mediastreamer.pc
mediastreamer2.spec
missing
stamp-h1
mediastreamer-2.3.2: ????????
mediastreamer-2.4.0: May 10, 2010
* use libv4l2 when possible to benefit from hardware pixel conversion
* added jpeg over RTP support
* added PulseAudio support
* enhance rendering of local video in MSVideoOut
* enhance performance of SDL video output
* improve MacOS sound support
mediastreamer-2.3.1: October 5, 2009
* preserve ratio in windows video display (not yet implemented for linux/SDL)
......
dnl Process this file with autoconf to produce a configure script.
AC_INIT([mediastreamer],[2.3.1])
AC_INIT([mediastreamer],[2.4.0])
AC_MSG_NOTICE([$PACKAGE_NAME-$PACKAGE_VERSION A mediastreaming library for telephony application.])
AC_MSG_NOTICE([licensed under the terms of the General Public License (GPL)])
......
......@@ -230,7 +230,7 @@ static void player_process(MSFilter *f){
lseek(d->fd,d->hsize,SEEK_SET);
/* special value for playing file only once */
if (d->loop_after==-2)
if (d->loop_after<0)
{
d->state=STOPPED;
ms_filter_unlock(f);
......
......@@ -1668,7 +1668,7 @@ mblk_t *ms_load_jpeg_as_yuv(const char *jpgpath, MSVideoSize *reqsize){
}
err=read(fd,jpgbuf,statbuf.st_size);
if (err!=statbuf.st_size){
ms_error("Could not read as much as wanted !");
ms_error("Could not read as much as wanted: %i<>%i !",err,statbuf.st_size);
}
m=jpeg2yuv(jpgbuf,statbuf.st_size,reqsize);
ms_free(jpgbuf);
......
......@@ -102,7 +102,7 @@ static void state_notify(pa_context *ctx, void *userdata){
static void init_pulse_context(){
if (context==NULL){
pa_loop=pa_threaded_mainloop_new();
context=pa_context_new(pa_threaded_mainloop_get_api(pa_loop),"mediastreamer2");
context=pa_context_new(pa_threaded_mainloop_get_api(pa_loop),NULL);
pa_context_set_state_callback(context,state_notify,NULL);
pa_context_connect(context,NULL,0,NULL);
pa_threaded_mainloop_start(pa_loop);
......@@ -149,21 +149,21 @@ static void pulse_read_preprocess(MSFilter *f){
attr.tlength=-1;
attr.prebuf=-1;
attr.minreq=-1;
attr.fragsize=s->fragsize=latency_req*s->channels*s->rate*2;
attr.fragsize=s->fragsize=latency_req*(float)s->channels*(float)s->rate*2;
s->stream=pa_stream_new(context,"mediastreamer2 read filter",&pss,NULL);
s->stream=pa_stream_new(context,"phone",&pss,NULL);
if (s->stream==NULL){
ms_error("pa_stream_new() failed: %s",pa_strerror(pa_context_errno(context)));
return;
}
pa_threaded_mainloop_lock(pa_loop);
err=pa_stream_connect_record(s->stream,NULL,&attr, PA_STREAM_ADJUST_LATENCY);
pa_threaded_mainloop_unlock(pa_loop);
if (err!=0){
ms_error("pa_stream_connect_record() failed");
}
}
static void stub(void *p){
}
static void pulse_read_process(MSFilter *f){
PulseReadState *s=(PulseReadState *)f->data;
......@@ -171,13 +171,17 @@ static void pulse_read_process(MSFilter *f){
size_t nbytes=0;
if (s->stream!=NULL){
pa_stream_peek(s->stream,&buffer,&nbytes);
if (buffer!=NULL){
pa_stream_drop(s->stream);
mblk_t *om=esballoc((uint8_t*)buffer,nbytes,0,stub);
pa_threaded_mainloop_lock(pa_loop);
while (pa_stream_peek(s->stream,&buffer,&nbytes)==0 && nbytes>0){
mblk_t *om;
om=allocb(nbytes,0);
memcpy(om->b_wptr,buffer,nbytes);
om->b_wptr+=nbytes;
ms_queue_put(f->outputs[0],om);
nbytes=0;
pa_stream_drop(s->stream);
}
pa_threaded_mainloop_unlock(pa_loop);
}
}
......@@ -186,8 +190,10 @@ static void pulse_read_postprocess(MSFilter *f){
PulseReadState *s=(PulseReadState *)f->data;
if (s->stream) {
pa_threaded_mainloop_lock(pa_loop);
pa_stream_disconnect(s->stream);
pa_stream_unref(s->stream);
pa_threaded_mainloop_unlock(pa_loop);
}
}
......@@ -252,19 +258,23 @@ static void pulse_write_preprocess(MSFilter *f){
pss.format=PA_SAMPLE_S16LE;
pss.channels=s->channels;
pss.rate=s->rate;
s->fragsize=latency_req*(float)s->channels*(float)s->rate*2;
attr.maxlength=-1;
attr.tlength=-1;
attr.tlength=s->fragsize;
attr.prebuf=-1;
attr.minreq=-1;
attr.fragsize=s->fragsize=latency_req*s->channels*s->rate*2;
attr.fragsize=-1;
s->stream=pa_stream_new(context,"mediastreamer2",&pss,NULL);
s->stream=pa_stream_new(context,"phone",&pss,NULL);
if (s->stream==NULL){
ms_error("pa_stream_new() failed: %s",pa_strerror(pa_context_errno(context)));
return;
}
pa_threaded_mainloop_lock(pa_loop);
err=pa_stream_connect_playback(s->stream,NULL,&attr, PA_STREAM_ADJUST_LATENCY,NULL,NULL);
pa_threaded_mainloop_unlock(pa_loop);
if (err!=0){
ms_error("pa_stream_connect_playback() failed");
}
......@@ -276,10 +286,12 @@ static void pulse_write_process(MSFilter *f){
while((im=ms_queue_get(f->inputs[0]))!=NULL){
int bsize=msgdsize(im);
if (s->stream){
pa_threaded_mainloop_lock(pa_loop);
if (pa_stream_writable_size(s->stream)>=bsize){
//ms_message("Pushing data to pulseaudio");
pa_stream_write(s->stream,im->b_rptr,bsize,NULL,0,PA_SEEK_RELATIVE);
}
pa_threaded_mainloop_unlock(pa_loop);
}
freemsg(im);
}
......@@ -288,8 +300,10 @@ static void pulse_write_process(MSFilter *f){
static void pulse_write_postprocess(MSFilter *f){
PulseWriteState *s=(PulseWriteState*)f->data;
if (s->stream) {
pa_threaded_mainloop_lock(pa_loop);
pa_stream_disconnect(s->stream);
pa_stream_unref(s->stream);
pa_threaded_mainloop_unlock(pa_loop);
}
}
......
......@@ -1080,7 +1080,7 @@ static void win_display_update(MSDisplay *obj, int new_image, int new_selfview){
ms_filter_call_method(wd->filter, MS_VIDEO_OUT_GET_BACKGROUND_COLOR, &color);
brush = CreateSolidBrush(RGB(color[0],color[1],color[2]));
FillRect(dd_hdc, &rect, brush);
FillRect(dd_hdc, &rect, brush);
DeleteObject(brush);
corner = 0;
......@@ -1130,8 +1130,8 @@ static void win_display_update(MSDisplay *obj, int new_image, int new_selfview){
if (rect.right>100 && rect.bottom>100)
{
int x_sv;
int y_sv;
int x_sv;
int y_sv;
if (new_selfview>0)
yuv420p_to_rgb_selfview(wd, &wd->fb_selfview, wd->rgb_selfview);
......@@ -1140,7 +1140,7 @@ static void win_display_update(MSDisplay *obj, int new_image, int new_selfview){
//SelectObject(dd_hdc, hpenDot);
if (sv_pos[0]!=SELVIEW_POS_INACTIVE)
{
x_sv = (int)((rect.right*sv_pos[0])/100.0-w_selfview/2);
x_sv = (int)((rect.right*sv_pos[0])/100.0-w_selfview/2);
y_sv = (int)((rect.bottom*sv_pos[1])/100.0-h_selfview/2);
}
else if (corner==1 || corner==4+1)
......
......@@ -262,7 +262,8 @@ int video_stream_start (VideoStream *stream, RtpProfile *profile, const char *re
ms_filter_call_method(stream->encoder,MS_FILTER_GET_FPS,&fps);
ms_message("Setting vsize=%ix%i, fps=%f",vsize.width,vsize.height,fps);
/* configure the filters */
ms_filter_call_method(stream->source,MS_FILTER_SET_FPS,&fps);
if (ms_filter_get_id(stream->source)!=MS_STATIC_IMAGE_ID)
ms_filter_call_method(stream->source,MS_FILTER_SET_FPS,&fps);
ms_filter_call_method(stream->source,MS_FILTER_SET_VIDEO_SIZE,&vsize);
/* get the output format for webcam reader */
......@@ -374,7 +375,8 @@ VideoStream * video_preview_start(MSWebCam *device, MSVideoSize disp_size){
/* configure the filters */
ms_filter_call_method(stream->source,MS_FILTER_SET_VIDEO_SIZE,&vsize);
ms_filter_call_method(stream->source,MS_FILTER_SET_FPS,&fps);
if (ms_filter_get_id(stream->source)!=MS_STATIC_IMAGE_ID)
ms_filter_call_method(stream->source,MS_FILTER_SET_FPS,&fps);
ms_filter_call_method(stream->source,MS_FILTER_GET_PIX_FMT,&format);
ms_filter_call_method(stream->source,MS_FILTER_GET_VIDEO_SIZE,&vsize);
if (format==MS_MJPEG){
......
......@@ -42,6 +42,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
static int cond=1;
static const char * capture_card=NULL;
static const char * playback_card=NULL;
static float ng_threshold=-1;
static bool_t use_ng=FALSE;
......@@ -139,7 +140,8 @@ const char *usage="mediastream --local <port> --remote <ip:port> --payload <payl
"[ --agc (enable automatic gain control)]\n"
"[ --ng (enable noise gate)]\n"
"[ --ng-threshold <(float) [0-1]> (noise gate threshold)]\n"
"[ --capture-card <index>] \n";
"[ --capture-card <name>] \n"
"[ --playback-card <name>] \n";
static void run_media_streams(int localport, const char *remote_ip, int remoteport, int payload, const char *fmtp,
int jitter, int bitrate, MSVideoSize vs, bool_t ec, bool_t agc, bool_t eq);
......@@ -211,6 +213,9 @@ int main(int argc, char * argv[])
}else if (strcmp(argv[i],"--capture-card")==0){
i++;
capture_card=argv[i];
}else if (strcmp(argv[i],"--playback-card")==0){
i++;
playback_card=argv[i];
}else if (strcmp(argv[i],"--ec")==0){
ec=TRUE;
}else if (strcmp(argv[i],"--agc")==0){
......@@ -255,13 +260,15 @@ static void run_media_streams(int localport, const char *remote_ip, int remotepo
MSSndCardManager *manager=ms_snd_card_manager_get();
MSSndCard *capt= capture_card==NULL ? ms_snd_card_manager_get_default_capture_card(manager) :
ms_snd_card_manager_get_card(manager,capture_card);
MSSndCard *play= playback_card==NULL ? ms_snd_card_manager_get_default_playback_card(manager) :
ms_snd_card_manager_get_card(manager,playback_card);
audio=audio_stream_new(localport,ms_is_ipv6(remote_ip));
audio_stream_enable_automatic_gain_control(audio,agc);
audio_stream_enable_noise_gate(audio,use_ng);
audio_stream_set_echo_canceller_params(audio,ec_len_ms,ec_delay_ms,ec_framesize);
printf("Starting audio stream.\n");
audio_stream_set_echo_canceller_params(audio,ec_len_ms,ec_delay_ms,ec_framesize);
printf("Starting audio stream.\n");
audio_stream_start_now(audio,profile,remote_ip,remoteport,remoteport+1,payload,jitter,
ms_snd_card_manager_get_default_playback_card(manager),
play,
capt,
ec);
if (audio) {
......
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