Commit 8bc6a662 authored by smorlat's avatar smorlat

merge patch fixing a portaudio plugin bug

tcp access to linphonec shell is enabled.



git-svn-id: svn+ssh://svn.savannah.nongnu.org/linphone/trunk@239 3f6dc0c8-ddfe-455d-9043-3cd528dc4637
parent e6df3d79
linphone-3.1.0 -- January 19, 2009
* linphone can now send large video pictures: up to SVGA, configurable via the user interface
* automatic rescaling of the video windows to the video size of incoming stream
* improved webcam support on windows
* plenty of user interface cosmetic improvements
* set a user friendly gtk theme by default on windows
* linphonec can compile and work without libreadline
* enable translations on windows
* bugfixing as usual
linphone-3.0.0 -- October 13, 2008
* new graphical interface based on Glade/Gtk
* systray icon
......
......@@ -11,27 +11,32 @@ INCLUDES = \
bin_PROGRAMS = linphonec sipomatic
bin_PROGRAMS = linphonec sipomatic linphonecsh
linphonec_SOURCES = linphonec.c linphonec.h commands.c
linphonec_LDADD = $(top_builddir)/coreapi/liblinphone.la $(READLINE_LIBS) $(OSIP_LIBS)
linphonec_LDADD = $(top_builddir)/coreapi/liblinphone.la $(READLINE_LIBS) \
$(top_builddir)/mediastreamer2/src/libmediastreamer.la \
$(ORTP_LIBS) \
$(SPEEX_LIBS) \
$(OSIP_LIBS)
sipomatic_SOURCES=\
sipomatic.c sipomatic.h
sipomatic_LDADD= $(INTLLIBS) \
$(top_builddir)/coreapi/liblinphone.la \
$(top_builddir)/coreapi/liblinphone.la \
$(top_builddir)/mediastreamer2/src/libmediastreamer.la \
$(ORTP_LIBS) \
$(SPEEX_LIBS) \
$(OSIP_LIBS)
linphonecsh_SOURCES = shell.c
linphonecsh_LDADD = $(ORTP_LIBS)
endif
AM_CFLAGS=$(STRICT_OPTIONS) -DENABLE_TRACE -D_ORTP_SOURCE $(VIDEO_CFLAGS) $(READLINE_CFLAGS) $(OSIP_CFLAGS)
AM_LDFLAGS= $(top_builddir)/mediastreamer2/src/libmediastreamer.la \
$(ORTP_LIBS) \
$(SPEEX_LIBS) \
$(OSIP_LIBS)
This diff is collapsed.
......@@ -6,21 +6,21 @@
* Copyright (C) 2002 Florian Winterstein <flox@gmx.net>
* Copyright (C) 2000 Simon MORLAT <simon.morlat@free.fr>
*
****************************************************************************
****************************************************************************
*
* 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 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 Library General Public License for more details.
* 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.
* 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.
*
****************************************************************************/
......@@ -32,6 +32,7 @@
#include <signal.h>
#include <limits.h>
#include <ctype.h>
#include <linphonecore.h>
#include "linphonec.h"
......@@ -39,6 +40,16 @@
#include "config.h"
#endif
#ifdef WIN32
#include <ws2tcpip.h>
#include <ctype.h>
#include <conio.h>
#else
#include <sys/socket.h>
#include <netdb.h>
#endif
#ifdef HAVE_GETTEXT
#include <libintl.h>
#ifndef _
......@@ -48,6 +59,8 @@
#define _(something) (something)
#endif
#define DEFAULT_TCP_PORT 32333
/***************************************************************************
*
* Types
......@@ -117,11 +130,13 @@ static bool_t vcap_enabled=FALSE;
static bool_t display_enabled=FALSE;
static bool_t preview_enabled=FALSE;
static bool_t show_general_state=FALSE;
static int tcp_port=0; /* see --tcp: tcp port to listen for commands */
LPC_AUTH_STACK auth_stack;
static int trace_level = 0;
static char *logfile_name = NULL;
static char configfile_name[PATH_MAX];
static char *sipAddr = NULL; /* for autocall */
static ortp_socket_t client_sock=-1;
char prompt[PROMPT_MAX_LEN];
LinphoneCoreVTable linphonec_vtable = {
......@@ -350,6 +365,76 @@ static void start_prompt_reader(void){
ortp_thread_create(&th,NULL,prompt_reader_thread,NULL);
}
static ortp_socket_t create_server_socket(int port){
ortp_socket_t server_sock;
char service[12];
/*setup the server socket */
struct addrinfo *ai=NULL;
struct addrinfo hints;
memset(&hints,0,sizeof(hints));
hints.ai_family=AF_INET;
snprintf(service,sizeof(service),"%i",port);
getaddrinfo("127.0.0.1",service,&hints,&ai);
if (ai==NULL){
fprintf(stderr,"getaddrinfo failed on port %s",service);
exit(-1);
}
server_sock=socket(PF_INET,SOCK_STREAM,IPPROTO_TCP);
if (bind(server_sock,ai->ai_addr,ai->ai_addrlen)!=0){
fprintf(stderr,"Failed to bind command socket.");
exit(-1);
}
listen(server_sock,1);
return server_sock;
}
static void *tcp_thread(void*p){
char tmp[250];
ortp_socket_t server_sock;
struct sockaddr_storage ss;
socklen_t ssize;
bool_t run=TRUE;
server_sock=create_server_socket(tcp_port);
if (server_sock==-1) return NULL;
while(run){
while(client_sock!=-1){ /*sleep until the last command is finished*/
#ifndef WIN32
usleep(20000);
#else
Sleep(20);
#endif
}
ssize=sizeof(ss);
if ((client_sock=accept(server_sock,(struct sockaddr*)&ss,&ssize))!=-1){
int len;
/*now read from the client */
if ((len=recv(client_sock,tmp,sizeof(tmp)-1,0))>0){
ortp_mutex_lock(&prompt_mutex);
tmp[len]='\0';
strcpy(received_prompt,tmp);
if (strcmp(received_prompt,"quit")==0) run=FALSE;
printf("Receiving command '%s'\n",received_prompt);fflush(stdout);
have_prompt=TRUE;
ortp_mutex_unlock(&prompt_mutex);
}else{
printf("read nothing\n");fflush(stdout);
close_socket(client_sock);
client_sock=-1;
}
}
}
return NULL;
}
static void start_tcp_reader(void){
ortp_thread_t th;
ms_mutex_init(&prompt_mutex,NULL);
ortp_thread_create(&th,NULL,tcp_thread,NULL);
}
#endif
char *linphonec_readline(char *prompt){
......@@ -357,10 +442,15 @@ char *linphonec_readline(char *prompt){
return readline(prompt);
#else
static bool_t prompt_reader_started=FALSE;
static bool_t tcp_reader_started=FALSE;
if (!prompt_reader_started){
start_prompt_reader();
prompt_reader_started=TRUE;
}
if (tcp_port>0 && !tcp_reader_started){
start_tcp_reader();
tcp_reader_started=TRUE;
}
fprintf(stdout,"%s",prompt);
fflush(stdout);
while(1){
......@@ -382,6 +472,30 @@ char *linphonec_readline(char *prompt){
#endif
}
void linphonec_out(const char *fmt,...){
char *res;
va_list args;
va_start (args, fmt);
res=ortp_strdup_vprintf(fmt,args);
va_end (args);
printf("%s",res);fflush(stdout);
if (client_sock!=-1){
if (write(client_sock,res,strlen(res))==-1){
fprintf(stderr,"Fail to send output via socket: %s",getSocketError());
}
}
ortp_free(res);
}
void linphonec_command_finished(void){
if (client_sock!=-1){
close_socket(client_sock);
client_sock=-1;
}
}
/***************************************************************************/
/*
* Main
......@@ -785,6 +899,7 @@ linphonec_main_loop (LinphoneCore * opm, char * sipAddr)
#endif
linphonec_parse_command_line(&linphonec, iptr);
linphonec_command_finished();
free(input);
}
......@@ -873,6 +988,14 @@ linphonec_parse_cmdline(int argc, char **argv)
{
show_general_state = TRUE;
}
else if (strncmp ("--tcp", argv[arg_num], 5) == 0)
{
if (arg_num+1 < argc){
tcp_port = atoi(argv[arg_num+1]);
if (tcp_port!=0) arg_num++;
}
if (tcp_port==0) tcp_port=DEFAULT_TCP_PORT;
}
else if (old_arg_num == arg_num)
{
fprintf (stderr, "ERROR: bad arguments\n");
......
......@@ -168,12 +168,23 @@ static void parse_hiddens(const char *hiddens, const char *window_name, GtkWidge
}
static void linphone_gtk_configure_window(GtkWidget *w, const char *window_name){
const char *hiddens;
static const char *icon_path=0;
static const char *hiddens=0;
static bool_t config_loaded=FALSE;
if (linphone_gtk_get_core()==NULL) return;
hiddens=linphone_gtk_get_ui_config("hidden_widgets",NULL);
if (config_loaded==FALSE){
hiddens=linphone_gtk_get_ui_config("hidden_widgets",NULL);
icon_path=linphone_gtk_get_ui_config("icon",NULL);
config_loaded=TRUE;
}
if (hiddens){
parse_hiddens(hiddens,window_name,w);
}
if (icon_path) {
GdkPixbuf *pbuf=create_pixbuf(icon_path);
gtk_window_set_icon(GTK_WINDOW(w),pbuf);
g_object_unref(G_OBJECT(pbuf));
}
}
#ifdef USE_LIBGLADE
......@@ -776,25 +787,18 @@ static void linphone_gtk_configure_main_window(){
static gboolean config_loaded=FALSE;
static const char *title;
static const char *home;
static const char *icon_path;
static const char *start_call_icon;
static const char *stop_call_icon;
GtkWidget *w=linphone_gtk_get_main_window();
if (!config_loaded){
title=linphone_gtk_get_ui_config("title",NULL);
home=linphone_gtk_get_ui_config("home","http://www.linphone.org");
icon_path=linphone_gtk_get_ui_config("icon",NULL);
start_call_icon=linphone_gtk_get_ui_config("start_call_icon",NULL);
stop_call_icon=linphone_gtk_get_ui_config("stop_call_icon",NULL);
config_loaded=TRUE;
}
linphone_gtk_configure_window(w,"main_window");
if (title) gtk_window_set_title(GTK_WINDOW(w),title);
if (icon_path) {
GdkPixbuf *pbuf=create_pixbuf(icon_path);
gtk_window_set_icon(GTK_WINDOW(w),pbuf);
g_object_unref(G_OBJECT(pbuf));
}
if (start_call_icon){
GdkPixbuf *pbuf=create_pixbuf(start_call_icon);
gtk_image_set_from_pixbuf(GTK_IMAGE(linphone_gtk_get_widget(w,"start_call_icon")),pbuf);
......
mediastreamer-2.2.3: 21, January 2009
* rfc3984 support improved
* webcam support on windows largely improved (vfw mode)
* support for configuring video size up to svga
* video output can automatically resize to the size of received video stream
* fix crash when resizing video window
* new MSWebcam object to provide Webcam management and MSFilter instantiation
* alsa bugfixes
mediastreamer-2.2.2: 6, october 2008
* new winsnd3.c file for support of soundcard under windows (seems to work a bit better)
* bugfixes
......
dnl Process this file with autoconf to produce a configure script.
AC_INIT([mediastreamer],[2.2.2])
AC_INIT([mediastreamer],[2.2.3])
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)])
......@@ -314,7 +314,7 @@ PKG_CHECK_MODULES(SPEEX, speex >= 1.1.12,
[ AC_DEFINE(HAVE_SPEEX_NOISE,1,[tells whether the noise arg of speex_echo_cancel can be used]) ],
[try_other_speex=yes]
)
PKG_CHECK_MODULES(SPEEX, speex >= 1.1.6, build_speex=yes)
PKG_CHECK_MODULES(SPEEX, speex >= 1.2beta3, build_speex=yes)
build_resample=false
PKG_CHECK_MODULES(SPEEXDSP, speexdsp >= 1.2beta3,
[SPEEX_LIBS="$SPEEX_LIBS $SPEEXDSP_LIBS"
......
......@@ -58,6 +58,7 @@ int SpeakerCallback( const void *inputBuffer, void *outputBuffer,
PASndData *device = (PASndData*)userData;
uint8_t *wtmpbuff=NULL;
int err;
int ovfl = (device->rate/8000)*320*6;
memset(outputBuffer,0, framesPerBuffer*2);
if (!device->read_started && !device->write_started)
......@@ -73,7 +74,7 @@ int SpeakerCallback( const void *inputBuffer, void *outputBuffer,
/* remove extra buffer when latency is increasing:
this often happen with USB device */
if (device->bufferizer->size>=320*6){
if (device->bufferizer->size>=ovfl){
ms_warning("Extra data for sound card (total:%i %ims)",
device->bufferizer->size, (device->bufferizer->size*20)/320);
err=ms_bufferizer_read(device->bufferizer,wtmpbuff, framesPerBuffer*2);
......
......@@ -228,6 +228,7 @@ int set_non_blocking_socket(ortp_socket_t sock);
char *ortp_strndup(const char *str,int n);
char *ortp_strdup_printf(const char *fmt,...);
char *ortp_strdup_vprintf(const char *fmt, va_list ap);
#ifdef __cplusplus
}
......
......@@ -164,7 +164,7 @@ void ortp_set_log_level_mask(int levelmask){
__ortp_log_mask=levelmask;
}
static char * _strdup_vprintf(const char *fmt, va_list ap)
char * ortp_strdup_vprintf(const char *fmt, va_list ap)
{
/* Guess we need no more than 100 bytes. */
int n, size = 200;
......@@ -210,7 +210,7 @@ char *ortp_strdup_printf(const char *fmt,...){
char *ret;
va_list args;
va_start (args, fmt);
ret=_strdup_vprintf(fmt, args);
ret=ortp_strdup_vprintf(fmt, args);
va_end (args);
return ret;
}
......@@ -255,10 +255,10 @@ static void __ortp_logv_out(OrtpLogLevel lev, const char *fmt, va_list args){
default:
ortp_fatal("Bad level !");
}
msg=_strdup_vprintf(fmt,args);
msg=ortp_strdup_vprintf(fmt,args);
#ifdef _MSC_VER
OutputDebugString(msg);
OutputDebugString("\r\n");
OutputDebugString(msg);
OutputDebugString("\r\n");
#else
fprintf(__log_file,"ortp-%s-%s" ENDLINE,lname,msg);
#endif
......
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