Commit eba29f5f authored by llea's avatar llea

New orgnisation of SFLphone

parent bddd5f68
......@@ -4,7 +4,7 @@
# Author: Laurielle Lea (laurielle.lea@savoirfairelinux.com)
#
all:
cd gsm ; make
cd src/audio/gsm ; make
cd src; make
install:
......@@ -15,5 +15,5 @@ uninstall:
clean:
cd src; make clean
cd gsm ; make clean
cd src/audio/gsm ; make clean
......@@ -17,59 +17,73 @@ SKINS = skins
RINGS = rings
METAL_SKINS = metal
ifdef ALSA
endif
INCPATH = -I. -I$(QTDIR)/include -I$(CCPPDIR)/include/cc++2 -I$(CCRTPDIR)/include -I$(OSIPDIR)/include -I$(EXOPSIP)/include -I/usr/include -I../gsm
INCPATH = -I. -I$(QTDIR)/include -I$(CCPPDIR)/include/cc++2 -I$(CCRTPDIR)/include -I$(OSIPDIR)/include -I$(EXOPSIP)/include -I/usr/include -Iaudio/gsm
CXXFLAGS = -pipe -Wall -W -g -pipe -march=i386 -mcpu=i686 -DQT_NO_DEBUG -DQT_SHARED -DQT_THREAD_SUPPORT -fpermissive -Wno-deprecated $(INCPATH)
LIBS=-L$(QTDIR)/lib -L/usr/X11R6/lib -lqt-mt -lXext -lX11 -lm -L/opt/lib -losip2 -leXosip -lccrtp1 -lasound `$(CCPPDIR)/bin/ccgnu2-config --flags --stdlibs`
EXTRALIBS=../gsm/libgsm.a
EXTRALIBS=audio/gsm/libgsm.a
CONFIGURE_CONF=$(shell ls ../configure.conf)
OBJS = \
audiobuffer.o \
audiocodec.o \
audiodrivers.o \
audiodriversoss.o \
audiodriversalsa.o \
audiortp.o \
configuration.o \
audio/audiobuffer.o \
audio/audiocodec.o \
audio/codecDescriptor.o \
audio/audiodrivers.o \
audio/audiodriversalsa.o \
audio/audiodriversoss.o \
audio/audiortp.o \
audio/dtmf.o \
audio/dtmfgenerator.o \
audio/tonegenerator.o \
audio/g711.o \
audio/gsmcodec.o \
audio/alaw.o \
audio/ulaw.o \
call.o \
configitem.o \
configuration.o \
configurationtree.o \
dtmf.o \
dtmfgenerator.o \
error.o \
g711.o \
eventthread.o \
gui/guiframework.o \
gui/qt/mydisplay.o \
gui/qt/numerickeypadtools.o \
gui/qt/phoneline.o \
gui/qt/point.o \
gui/qt/transqwidget.o \
gui/qt/trayicon.o \
gui/qt/trayicon.moc.o \
gui/qt/trayicon_x11.o \
gui/qt/vector.o \
gui/qt/volumecontrol.o \
gui/qt/volumecontrol.moc.o \
gui/qt/jpushbutton.o \
gui/qt/jpushbutton.moc.o \
gui/qt/numerickeypad.o \
gui/qt/numerickeypad.moc.o \
gui/qt/qjlistboxpixmap.o \
gui/qt/qtGUImainwindow.o \
gui/qt/qtGUImainwindow.moc.o \
gui/qt/configurationpanelui.o \
gui/qt/configurationpanelui.moc.o \
gui/qt/url_inputui.o \
gui/qt/url_inputui.moc.o \
main.o \
manager.o \
mydisplay.o \
numerickeypadtools.o \
phoneline.o \
point.o \
qjlistboxpixmap.o \
sip.o \
sipcall.o \
sipvoiplink.o \
skin.o \
url_inputui.o url_inputui.moc.o \
phonebookui.o phonebookui.moc.o \
configurationpanelui.o configurationpanelui.moc.o \
tonegenerator.o \
transqwidget.o \
trayicon.o trayicon.moc.o trayicon_x11.o \
jpushbutton.o jpushbutton.moc.o \
numerickeypad.o numerickeypad.moc.o \
qtGUImainwindow.o qtGUImainwindow.moc.o \
vector.o \
volumecontrol.o volumecontrol.moc.o \
stun.o udp.o
voIPLink.o \
stun.o \
udp.o
start: check prereq all
#start: check all
#start:check all
check:
ifeq ($(CONFIGURE_CONF),../configure.conf)
......@@ -81,14 +95,14 @@ endif
.cpp.o:
$(CXX) $(DEFVARS) $(CXXFLAGS) -c -o $@ $<
prereq: phonebook.ui url_input.ui configurationpanel.ui
prereq: gui/qt/phonebook.ui gui/qt/url_input.ui gui/qt/configurationpanel.ui
@echo "Making User Interface files..."
$(UIC) -o phonebookui.h phonebook.ui
$(UIC) -o phonebookui.cpp -impl phonebookui.h phonebook.ui
$(UIC) -o url_inputui.h url_input.ui
$(UIC) -o url_inputui.cpp -impl url_inputui.h url_input.ui
$(UIC) -o configurationpanelui.h configurationpanel.ui
$(UIC) -o configurationpanelui.cpp -impl configurationpanelui.h configurationpanel.ui
$(UIC) -o gui/qt/phonebookui.h gui/qt/phonebook.ui
$(UIC) -o gui/qt/phonebookui.cpp -impl gui/qt/phonebookui.h gui/qt/phonebook.ui
$(UIC) -o gui/qt/url_inputui.h gui/qt/url_input.ui
$(UIC) -o gui/qt/url_inputui.cpp -impl gui/qt/url_inputui.h gui/qt/url_input.ui
$(UIC) -o gui/qt/configurationpanelui.h gui/qt/configurationpanel.ui
$(UIC) -o gui/qt/configurationpanelui.cpp -impl gui/qt/configurationpanelui.h gui/qt/configurationpanel.ui
%.moc.cpp: %.h
$(MOC) -o $@ $<
......@@ -106,21 +120,21 @@ all: $(PROGNAME)
$(PROGNAME): $(OBJS) $(EXTRALIBS)
$(CXX) -o $@ $(OBJS) $(LIBS) $(EXTRALIBS)
install: all
mkdir -p $(BIN_DIR)
mkdir -p $(SHARE_DIR)/$(PROGNAME)
install --mode=0755 $(PROGNAME) $(BIN_DIR)
cd ..; cp -R $(PIXMAPS) $(SHARE_DIR)/$(PROGNAME)/ ; \
chmod -R a+rX $(SHARE_DIR)/$(PROGNAME)/$(PIXMAPS)
cd ..; cp -R $(SKINS) $(SHARE_DIR)/$(PROGNAME)/ ; \
chmod -R a+rX $(SHARE_DIR)/$(PROGNAME)/$(SKINS)
cd ..; cp -R $(RINGS) $(SHARE_DIR)/$(PROGNAME)/ ; \
chmod -R a+rX $(SHARE_DIR)/$(PROGNAME)/$(RINGS)
uninstall:
rm -f $(BIN_DIR)/$(PROGNAME)
rm -rf $(SHARE_DIR)/$(PROGNAME)
#install: all
# mkdir -p $(BIN_DIR)
# mkdir -p $(SHARE_DIR)/$(PROGNAME)
# install --mode=0755 $(PROGNAME) $(BIN_DIR)
# cd ..; cp -R $(PIXMAPS) $(SHARE_DIR)/$(PROGNAME)/ ; \
# chmod -R a+rX $(SHARE_DIR)/$(PROGNAME)/$(PIXMAPS)
# cd ..; cp -R $(SKINS) $(SHARE_DIR)/$(PROGNAME)/ ; \
# chmod -R a+rX $(SHARE_DIR)/$(PROGNAME)/$(SKINS)
# cd ..; cp -R $(RINGS) $(SHARE_DIR)/$(PROGNAME)/ ; \
# chmod -R a+rX $(SHARE_DIR)/$(PROGNAME)/$(RINGS)
#
#uninstall:
# rm -f $(BIN_DIR)/$(PROGNAME)
# rm -rf $(SHARE_DIR)/$(PROGNAME)
clean:
rm -f $(PROGNAME) *.o *.a *~ *.moc.cpp *.bak core.*
rm -f $(PROGNAME) *.o audio/*.o audio/gsm/*.o gui/*.o gui/qt/*.o audio/gsm/*.a *~ *.moc.cpp *.bak core.*
/**
* Copyright (C) 2004-2005 Savoir-Faire Linux inc.
* Author: Laurielle Lea <laurielle.lea@savoirfairelinux.com>
*
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include "g711.h"
#include "alaw.h"
Alaw::Alaw(int payload, const string& codec) : AudioCodec(payload, codec)
{
_codecName = codec;
_payload = payload;
}
Alaw::~Alaw (void)
{
}
int
Alaw::codecDecode (short *dst, unsigned char *src, unsigned int size)
{
return G711::ALawDecode (dst, src, size);
}
int
Alaw::codecEncode (unsigned char *dst, short *src, unsigned int size)
{
return G711::ALawEncode (dst, src, size);
}
/**
* Copyright (C) 2004-2005 Savoir-Faire Linux inc.
* Author: Laurielle Lea <laurielle.lea@savoirfairelinux.com>
*
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef __ALAW_H__
#define __ALAW_H__
#include "audiocodec.h"
class Alaw : public AudioCodec {
public:
Alaw (int payload, const string& codec);
~Alaw (void);
int codecDecode (short *, unsigned char *, unsigned int);
int codecEncode (unsigned char *, short *, unsigned int);
private:
string _codecName;
int _payload;
};
#endif // __ULAW_H__
/**
* Copyright (C) 2004 Savoir-Faire Linux inc.
* Copyright (C) 2004-2005 Savoir-Faire Linux inc.
* Author: Laurielle Lea <laurielle.lea@savoirfairelinux.com>
*
* Portions Copyright (c) 2000 Billy Biggs <bbiggs@div8.net>
......@@ -21,7 +21,7 @@
*/
#include "audiobuffer.h"
#include "global.h"
#include "../global.h"
#include <string.h>
......
/**
* Copyright (C) 2004 Savoir-Faire Linux inc.
* Copyright (C) 2004-2005 Savoir-Faire Linux inc.
* Author: Laurielle Lea <laurielle.lea@savoirfairelinux.com>
*
* Portions Copyright (c) 2000 Billy Biggs <bbiggs@div8.net>
......
/*
* Copyright (C) 2004-2005 Savoir-Faire Linux inc.
* Author: Laurielle Lea <laurielle.lea@savoirfairelinux.com>
*
* This 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,
* or (at your option) any later version.
*
* This 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 dpkg; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <endian.h>
#include <string.h>
#include <iostream>
#include <string>
#include "audiocodec.h"
#include "../configuration.h"
using namespace std;
AudioCodec::AudioCodec (int payload, const string& codec) {
_codecName = codec;
_payload = payload;
}
AudioCodec::~AudioCodec (void) {
}
void
AudioCodec::setCodecName (const string& codec)
{
_codecName = codec;
}
string
AudioCodec::getCodecName (void)
{
return _codecName;
}
/**
* Copyright (C) 2004-2005 Savoir-Faire Linux inc.
* Author: Laurielle Lea <laurielle.lea@savoirfairelinux.com>
*
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef __CODEC_AUDIO_H__
#define __CODEC_AUDIO_H__
#include <string>
using namespace std;
class AudioCodec {
public:
AudioCodec(int payload, const string& codec);
virtual ~AudioCodec (void);
virtual int codecDecode (short *, unsigned char *, unsigned int) = 0;
virtual int codecEncode (unsigned char *, short *, unsigned int) = 0;
void setCodecName (const string& codec);
string getCodecName (void);
private:
string _codecName;
int _payload;
};
#endif // __CODEC_AUDIO_H__
/**
* Copyright (C) 2004 Savoir-Faire Linux inc.
* Copyright (C) 2004-2005 Savoir-Faire Linux inc.
* Author: Laurielle Lea <laurielle.lea@savoirfairelinux.com>
*
* Portions Copyright (c) 2000 Billy Biggs <bbiggs@div8.net>
......
/**
* Copyright (C) 2004 Savoir-Faire Linux inc.
* Copyright (C) 2004-2005 Savoir-Faire Linux inc.
* Author : Laurielle Lea <laurielle.lea@savoirfairelinux.com>
*
* Portions Copyright (c) 2000 Billy Biggs <bbiggs@div8.net>
......
/**
* Copyright (C) 2004 Savoir-Faire Linux inc.
* Copyright (C) 2004-2005 Savoir-Faire Linux inc.
* Author: Jerome Oufella <jerome.oufella@savoirfairelinux.com>
*
* This program is free software; you can redistribute it and/or modify
......@@ -31,7 +31,7 @@
#include <errno.h>
#include "audiodriversalsa.h"
#include "global.h"
#include "../global.h"
#define ALSA_DEVICE "plughw:0,0"
......
/**
* Copyright (C) 2004 Savoir-Faire Linux inc.
* Copyright (C) 2004-2005 Savoir-Faire Linux inc.
* Author: Jerome Oufella <jerome.oufella@savoirfairelinux.com>
*
* This program is free software; you can redistribute it and/or modify
......@@ -23,7 +23,7 @@
#include <alsa/asoundlib.h>
#include "audiodrivers.h"
#include "error.h"
#include "../error.h"
/**
......
/**
* Copyright (C) 2004 Savoir-Faire Linux inc.
* Copyright (C) 2004-2005 Savoir-Faire Linux inc.
* Author: Laurielle Lea <laurielle.lea@savoirfairelinux.com>
*
* Portions Copyright (c) 2000 Billy Biggs <bbiggs@div8.net>
......@@ -32,7 +32,7 @@
#include <stdio.h>
#include "audiodriversoss.h"
#include "global.h"
#include "../global.h"
AudioDriversOSS::AudioDriversOSS (DeviceMode mode, Error *error) :
......
/**
* Copyright (C) 2004 Savoir-Faire Linux inc.
* Copyright (C) 2004-2005 Savoir-Faire Linux inc.
* Author: Laurielle Lea <laurielle.lea@savoirfairelinux.com>
*
* Portions Copyright (c) 2000 Billy Biggs <bbiggs@div8.net>
......@@ -25,7 +25,7 @@
#include "audiodrivers.h"
#include "error.h"
#include "../error.h"
// TODO : a mettre dans config
#define AUDIO_DEVICE "/dev/dsp"
......
This diff is collapsed.
......@@ -27,12 +27,12 @@
using namespace ost;
#include "sipcall.h"
#define LEN_BUFFER 160
class SIP;
class AudioDrivers;
class Manager;
class SipCall;
///////////////////////////////////////////////////////////////////////////////
// Two pair of sockets
......@@ -41,20 +41,21 @@ class AudioRtpRTX : public Thread, public TimerPort {
public:
AudioRtpRTX (SipCall *, AudioDrivers *, AudioDrivers *, Manager *, bool);
~AudioRtpRTX();
Time *time; // For incoming call notification
virtual void run ();
private:
SipCall *ca;
AudioDrivers *audioDevice;
SipCall* _ca;
AudioDrivers* _audioDevice;
#ifdef ALSA
AudioDrivers *audioDeviceRead;
AudioDrivers* _audioDeviceRead;
#endif
RTPSession *sessionSend;
RTPSession *sessionRecv;
SymmetricRTPSession *session;
Manager *manager;
bool sym;
RTPSession* _sessionSend;
RTPSession* _sessionRecv;
SymmetricRTPSession* _session;
Manager* _manager;
bool _sym;
};
///////////////////////////////////////////////////////////////////////////////
......@@ -65,14 +66,13 @@ public:
AudioRtp (Manager *);
~AudioRtp (void);
int createNewSession (SipCall *);
void closeRtpSession (SipCall *);
int createNewSession (SipCall *);
void closeRtpSession (SipCall *);
private:
AudioRtpRTX *RTXThread;
SIP *sip;
Manager *manager;
bool symetric;
AudioRtpRTX* _RTXThread;
Manager* _manager;
bool _symetric;
};
#endif // __AUDIO_RTP_H__
/**
* Copyright (C) 2004-2005 Savoir-Faire Linux inc.
* Author: Laurielle Lea <laurielle.lea@savoirfairelinux.com>
*
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <iostream>
#include "audio/audiocodec.h"
#include "audio/gsmcodec.h"
#include "audio/alaw.h"
#include "audio/ulaw.h"
#include "codecDescriptor.h"
CodecDescriptor::CodecDescriptor (int payload)
{
_payload = payload;
_codecName = "";
}
CodecDescriptor::CodecDescriptor (int payload, const string& name)
{
_payload = payload;
_codecName = name;
}
CodecDescriptor::~CodecDescriptor (void)
{
}
AudioCodec*
CodecDescriptor::alloc (int payload, const string& name)
{
switch(payload) {
case PAYLOAD_CODEC_ULAW:
return new Ulaw(payload, name);
break;
case PAYLOAD_CODEC_ALAW:
return new Alaw(payload, name);
break;
case PAYLOAD_CODEC_GSM:
return new Gsm(payload, name);
break;
default:
return NULL;
break;
}
}
void
CodecDescriptor::setPayload (int payload)
{
_payload =payload;
}
int
CodecDescriptor::getPayload (void)
{
return _payload;
}
void
CodecDescriptor::setNameCodec (const string& name)
{
_codecName = name;
}
string
CodecDescriptor::getNameCodec (void)
{
return _codecName;
}
int
CodecDescriptor::matchPayloadCodec (const string& codecname) {
if (codecname == CODEC_ALAW) {
return PAYLOAD_CODEC_ALAW;
} else if (codecname == CODEC_ULAW) {
return PAYLOAD_CODEC_ULAW;
} else if (codecname == CODEC_GSM) {
return PAYLOAD_CODEC_GSM;
} else if (codecname == CODEC_ILBC) {
return PAYLOAD_CODEC_ILBC;
} else if (codecname == CODEC_SPEEX) {
return PAYLOAD_CODEC_SPEEX;
} else
return -1;
}
string
CodecDescriptor::rtpmapPayload (int payload) {
switch (payload) {
case PAYLOAD_CODEC_ALAW:
return string("PCMA");
break;
case PAYLOAD_CODEC_ULAW:
return string("PCMU");
break;
case PAYLOAD_CODEC_GSM:
return string("GSM");
break;
case PAYLOAD_CODEC_ILBC:
return string("iLBC");
break;
case PAYLOAD_CODEC_SPEEX:
return string("speex");
break;
default:
break;
}
return "";
}
/**
* Copyright (C) 2004 Savoir-Faire Linux inc.
* Author: Laurielle Lea <laurielle.lea@savoirfairelinux.com>
* Copyright (C) 2004-2005 Savoir-Faire Linux inc.
* Author: Laurielle Lea <laurielle.lea@savoirfairelinux.com>
*
* 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
......@@ -17,12 +17,12 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef __CODEC_AUDIO_H__
#define __CODEC_AUDIO_H__
#include "../gsm/gsm.h"
#ifndef __CODEC_DESCRIPTOR_H__
#define __CODEC_DESCRIPTOR_H__
#include <string>
using namespace std;
typedef enum {
......@@ -39,27 +39,34 @@ typedef enum {
#define CODEC_ILBC string("iLBC")
#define CODEC_SPEEX string("SPEEX")
#define NB_CODECS 5
class AudioCodec {
class AudioCodec;