Commit cab938cb authored by smorlat's avatar smorlat

- allow setting of nowebcam and remote ring path



git-svn-id: svn+ssh://svn.savannah.nongnu.org/linphone/trunk@183 3f6dc0c8-ddfe-455d-9043-3cd528dc4637
parent 844b13a2
......@@ -50,8 +50,7 @@ static void toggle_video_preview(LinphoneCore *lc, bool_t val);
/* relative path where is stored local ring*/
#define LOCAL_RING "rings/oldphone.wav"
/* same for remote ring (ringback)*/
#define REMOTE_RING_FR "ringback.wav"
#define REMOTE_RING_US "ringback.wav"
#define REMOTE_RING "ringback.wav"
sdp_handler_t linphone_sdphandler={
......@@ -384,16 +383,16 @@ void sound_config_read(LinphoneCore *lc)
linphone_core_set_ring(lc,tmpbuf);
tmpbuf=PACKAGE_SOUND_DIR "/" REMOTE_RING_FR;
tmpbuf=PACKAGE_SOUND_DIR "/" REMOTE_RING;
tmpbuf=lp_config_get_string(lc->config,"sound","remote_ring",tmpbuf);
if (access(tmpbuf,F_OK)==-1){
tmpbuf=PACKAGE_SOUND_DIR "/" REMOTE_RING_FR;
tmpbuf=PACKAGE_SOUND_DIR "/" REMOTE_RING;
}
if (strstr(tmpbuf,".wav")==NULL){
/* it currently uses old sound files, so replace them */
tmpbuf=PACKAGE_SOUND_DIR "/" REMOTE_RING_FR;
tmpbuf=PACKAGE_SOUND_DIR "/" REMOTE_RING;
}
linphone_core_set_ringback(lc,0);
linphone_core_set_ringback(lc,tmpbuf);
check_sound_device(lc);
lc->sound_conf.latency=0;
......@@ -1762,7 +1761,7 @@ void linphone_core_set_ring(LinphoneCore *lc,const char *path){
lc->sound_conf.local_ring=ms_strdup(path);
}
const char *linphone_core_get_ring(LinphoneCore *lc){
const char *linphone_core_get_ring(const LinphoneCore *lc){
return lc->sound_conf.local_ring;
}
......@@ -1786,17 +1785,16 @@ int linphone_core_preview_ring(LinphoneCore *lc, const char *ring,LinphoneCoreCb
}
void linphone_core_set_ringback(LinphoneCore *lc,RingBackType type){
switch(type){
case RINGBACK_TYPE_FR:
lc->sound_conf.remote_ring=PACKAGE_SOUND_DIR "/" REMOTE_RING_FR;
break;
case RINGBACK_TYPE_US:
lc->sound_conf.remote_ring=PACKAGE_SOUND_DIR "/" REMOTE_RING_US;
break;
void linphone_core_set_ringback(LinphoneCore *lc, const char *path){
if (lc->sound_conf.remote_ring!=0){
ms_free(lc->sound_conf.remote_ring);
}
lc->sound_conf.remote_ring=ms_strdup(path);
}
const char * linphone_core_get_ringback(const LinphoneCore *lc){
return lc->sound_conf.remote_ring;
}
RingBackType linphone_core_get_ringback(LinphoneCore *lc);
void linphone_core_enable_echo_cancelation(LinphoneCore *lc, bool_t val){
lc->sound_conf.ec=val;
......@@ -2225,6 +2223,7 @@ void sound_config_uninit(LinphoneCore *lc)
lp_config_set_string(lc->config,"sound","remote_ring",config->remote_ring);
lp_config_set_int(lc->config,"sound","echocancelation",config->ec);
if (config->local_ring) ms_free(config->local_ring);
if (config->remote_ring) ms_free(config->remote_ring);
}
void video_config_uninit(LinphoneCore *lc)
......
......@@ -652,11 +652,10 @@ int linphone_core_set_capture_device(LinphoneCore *lc, const char * devid);
char linphone_core_get_sound_source(LinphoneCore *lc);
void linphone_core_set_sound_source(LinphoneCore *lc, char source);
void linphone_core_set_ring(LinphoneCore *lc, const char *path);
const char *linphone_core_get_ring(LinphoneCore *lc);
const char *linphone_core_get_ring(const LinphoneCore *lc);
void linphone_core_set_ringback(LinphoneCore *lc, const char *path);
const char * linphone_core_get_ringback(const LinphoneCore *lc);
int linphone_core_preview_ring(LinphoneCore *lc, const char *ring,LinphoneCoreCbFunc func,void * userdata);
typedef enum {RINGBACK_TYPE_FR,RINGBACK_TYPE_US} RingBackType;
void linphone_core_set_ringback(LinphoneCore *lc,RingBackType type);
RingBackType linphone_core_get_ringback(LinphoneCore *lc);
void linphone_core_enable_echo_cancelation(LinphoneCore *lc, bool_t val);
bool_t linphone_core_echo_cancelation_enabled(LinphoneCore *lc);
......
......@@ -217,6 +217,11 @@ const char *ms_web_cam_get_string_id(MSWebCam *obj);
/** @} */
/*specific methods for static image:*/
void ms_static_image_set_default_image(const char *path);
#ifdef __cplusplus
}
#endif
......
......@@ -96,6 +96,8 @@ mblk_t *ms_load_jpeg_as_yuv(const char *jpgpath, MSVideoSize *reqsize){
return m;
}
#ifndef PACKAGE_DATA_DIR
#define PACKAGE_DATA_DIR "."
#endif
......@@ -104,6 +106,11 @@ mblk_t *ms_load_jpeg_as_yuv(const char *jpgpath, MSVideoSize *reqsize){
#define NOWEBCAM_JPG "nowebcamCIF"
#endif
static char *def_image=NULL;
static const char *def_image_path=PACKAGE_DATA_DIR "/images/" NOWEBCAM_JPG ".jpg";
mblk_t *ms_load_nowebcam(MSVideoSize *reqsize, int idx){
char tmp[256];
if (idx<0)
......@@ -115,8 +122,7 @@ mblk_t *ms_load_nowebcam(MSVideoSize *reqsize, int idx){
typedef struct _SIData{
MSVideoSize vsize;
char nowebcamimage[256];
int index;
char *nowebcamimage;
uint64_t lasttime;
mblk_t *pic;
}SIData;
......@@ -125,8 +131,11 @@ void static_image_init(MSFilter *f){
SIData *d=(SIData*)ms_new(SIData,1);
d->vsize.width=MS_VIDEO_SIZE_CIF_W;
d->vsize.height=MS_VIDEO_SIZE_CIF_H;
memset(d->nowebcamimage, 0, sizeof(d->nowebcamimage));
d->index=-1;
if (def_image==NULL)
def_image=ms_strdup(def_image_path);
d->nowebcamimage=ms_strdup(def_image);
d->lasttime=0;
d->pic=NULL;
f->data=d;
......@@ -139,10 +148,7 @@ void static_image_uninit(MSFilter *f){
void static_image_preprocess(MSFilter *f){
SIData *d=(SIData*)f->data;
if (d->pic==NULL){
if (d->nowebcamimage[0] != '\0')
d->pic=ms_load_jpeg_as_yuv(d->nowebcamimage,&d->vsize);
else
d->pic=ms_load_nowebcam(&d->vsize,d->index);
d->pic=ms_load_jpeg_as_yuv(d->nowebcamimage,&d->vsize);
}
}
......@@ -189,21 +195,20 @@ int static_image_get_pix_fmt(MSFilter *f, void *data){
static int static_image_set_image(MSFilter *f, void *arg){
SIData *d=(SIData*)f->data;
char *image = (char *)arg;
ms_mutex_lock(&f->lock);
const char *image = (const char *)arg;
ms_filter_lock(f);
if (d->nowebcamimage) ms_free(d->nowebcamimage);
if (image!=NULL && image[0]!='\0')
snprintf(d->nowebcamimage, sizeof(d->nowebcamimage), "%s", image);
d->nowebcamimage=ms_strdup(image);
else
d->nowebcamimage[0] = '\0';
d->nowebcamimage = def_image;
if (d->pic!=NULL)
if (d->pic!=NULL){
freemsg(d->pic);
d->pic=NULL;
}
//if (d->nowebcamimage[0] != '\0')
// d->pic=ms_load_jpeg_as_yuv(d->nowebcamimage,&d->vsize);
//else
// d->pic=ms_load_nowebcam(&d->vsize,d->index);
ms_mutex_unlock(&f->lock);
ms_filter_unlock(f);
return 0;
}
......@@ -257,3 +262,10 @@ static void static_image_detect(MSWebCamManager *obj){
ms_web_cam_manager_add_cam(obj,cam);
}
void ms_static_image_set_default_image(const char *path){
if (def_image!=NULL)
ms_free(def_image);
def_image=NULL;
if (path)
def_image=ms_strdup(path);
}
......@@ -1364,6 +1364,7 @@ void rtp_session_reset (RtpSession * session)
rtp_session_clear_recv_error_code(session);
rtp_stats_reset(&session->rtp.stats);
rtp_session_resync(session);
session->ssrc_set=FALSE;
}
/**
......
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