Changeset 180:ecf35790a355 in mediastreamer2


Ignore:
Timestamp:
Nov 27, 2008 3:47:06 PM (4 years ago)
Author:
smorlat <smorlat@…>
Branch:
default
Message:
  • 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

Location:
linphone
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • linphone/coreapi/linphonecore.c

    r178 r180  
    5151#define LOCAL_RING "rings/oldphone.wav" 
    5252/* same for remote ring (ringback)*/ 
    53 #define REMOTE_RING_FR "ringback.wav" 
    54 #define REMOTE_RING_US "ringback.wav" 
     53#define REMOTE_RING "ringback.wav"  
    5554 
    5655 
     
    385384        linphone_core_set_ring(lc,tmpbuf); 
    386385         
    387         tmpbuf=PACKAGE_SOUND_DIR "/" REMOTE_RING_FR; 
     386        tmpbuf=PACKAGE_SOUND_DIR "/" REMOTE_RING; 
    388387        tmpbuf=lp_config_get_string(lc->config,"sound","remote_ring",tmpbuf); 
    389388        if (access(tmpbuf,F_OK)==-1){ 
    390                 tmpbuf=PACKAGE_SOUND_DIR "/" REMOTE_RING_FR; 
     389                tmpbuf=PACKAGE_SOUND_DIR "/" REMOTE_RING; 
    391390        } 
    392391        if (strstr(tmpbuf,".wav")==NULL){ 
    393392                /* it currently uses old sound files, so replace them */ 
    394                 tmpbuf=PACKAGE_SOUND_DIR "/" REMOTE_RING_FR; 
    395         } 
    396         linphone_core_set_ringback(lc,0); 
     393                tmpbuf=PACKAGE_SOUND_DIR "/" REMOTE_RING; 
     394        } 
     395        linphone_core_set_ringback(lc,tmpbuf); 
    397396        check_sound_device(lc); 
    398397        lc->sound_conf.latency=0; 
     
    17631762} 
    17641763 
    1765 const char *linphone_core_get_ring(LinphoneCore *lc){ 
     1764const char *linphone_core_get_ring(const LinphoneCore *lc){ 
    17661765        return lc->sound_conf.local_ring; 
    17671766} 
     
    17871786 
    17881787 
    1789 void linphone_core_set_ringback(LinphoneCore *lc,RingBackType type){ 
    1790         switch(type){ 
    1791                 case RINGBACK_TYPE_FR: 
    1792                         lc->sound_conf.remote_ring=PACKAGE_SOUND_DIR "/" REMOTE_RING_FR; 
    1793                 break; 
    1794                 case RINGBACK_TYPE_US: 
    1795                         lc->sound_conf.remote_ring=PACKAGE_SOUND_DIR "/" REMOTE_RING_US; 
    1796                 break; 
    1797         } 
    1798 } 
    1799 RingBackType linphone_core_get_ringback(LinphoneCore *lc); 
     1788void linphone_core_set_ringback(LinphoneCore *lc, const char *path){ 
     1789        if (lc->sound_conf.remote_ring!=0){ 
     1790                ms_free(lc->sound_conf.remote_ring); 
     1791        } 
     1792        lc->sound_conf.remote_ring=ms_strdup(path); 
     1793} 
     1794 
     1795const char * linphone_core_get_ringback(const LinphoneCore *lc){ 
     1796        return lc->sound_conf.remote_ring; 
     1797} 
    18001798 
    18011799void linphone_core_enable_echo_cancelation(LinphoneCore *lc, bool_t val){ 
     
    22262224        lp_config_set_int(lc->config,"sound","echocancelation",config->ec); 
    22272225        if (config->local_ring) ms_free(config->local_ring); 
     2226        if (config->remote_ring) ms_free(config->remote_ring); 
    22282227} 
    22292228 
  • linphone/coreapi/linphonecore.h

    r177 r180  
    653653void linphone_core_set_sound_source(LinphoneCore *lc, char source); 
    654654void linphone_core_set_ring(LinphoneCore *lc, const char *path); 
    655 const char *linphone_core_get_ring(LinphoneCore *lc); 
     655const char *linphone_core_get_ring(const LinphoneCore *lc); 
     656void linphone_core_set_ringback(LinphoneCore *lc, const char *path); 
     657const char * linphone_core_get_ringback(const LinphoneCore *lc); 
    656658int linphone_core_preview_ring(LinphoneCore *lc, const char *ring,LinphoneCoreCbFunc func,void * userdata); 
    657 typedef enum {RINGBACK_TYPE_FR,RINGBACK_TYPE_US} RingBackType; 
    658 void linphone_core_set_ringback(LinphoneCore *lc,RingBackType type); 
    659 RingBackType linphone_core_get_ringback(LinphoneCore *lc); 
    660659void linphone_core_enable_echo_cancelation(LinphoneCore *lc, bool_t val); 
    661660bool_t linphone_core_echo_cancelation_enabled(LinphoneCore *lc); 
  • linphone/mediastreamer2/include/mediastreamer2/mswebcam.h

    r0 r180  
    218218/** @} */ 
    219219 
     220 
     221/*specific methods for static image:*/ 
     222 
     223void ms_static_image_set_default_image(const char *path); 
     224 
    220225#ifdef __cplusplus 
    221226} 
  • linphone/mediastreamer2/src/nowebcam.c

    r150 r180  
    9797} 
    9898 
     99 
     100 
    99101#ifndef PACKAGE_DATA_DIR 
    100102#define PACKAGE_DATA_DIR "." 
     
    104106#define NOWEBCAM_JPG "nowebcamCIF" 
    105107#endif 
     108 
     109static char *def_image=NULL; 
     110 
     111static const char *def_image_path=PACKAGE_DATA_DIR "/images/" NOWEBCAM_JPG ".jpg"; 
     112 
    106113 
    107114mblk_t *ms_load_nowebcam(MSVideoSize *reqsize, int idx){ 
     
    116123typedef struct _SIData{ 
    117124        MSVideoSize vsize; 
    118         char nowebcamimage[256]; 
    119         int index; 
     125        char *nowebcamimage; 
    120126        uint64_t lasttime; 
    121127        mblk_t *pic; 
     
    126132        d->vsize.width=MS_VIDEO_SIZE_CIF_W; 
    127133        d->vsize.height=MS_VIDEO_SIZE_CIF_H; 
    128         memset(d->nowebcamimage, 0, sizeof(d->nowebcamimage)); 
    129         d->index=-1; 
     134 
     135        if (def_image==NULL) 
     136                def_image=ms_strdup(def_image_path); 
     137 
     138        d->nowebcamimage=ms_strdup(def_image); 
    130139        d->lasttime=0; 
    131140        d->pic=NULL; 
     
    140149        SIData *d=(SIData*)f->data; 
    141150        if (d->pic==NULL){ 
    142                 if (d->nowebcamimage[0] != '\0') 
    143                         d->pic=ms_load_jpeg_as_yuv(d->nowebcamimage,&d->vsize); 
    144                 else 
    145                         d->pic=ms_load_nowebcam(&d->vsize,d->index); 
     151                d->pic=ms_load_jpeg_as_yuv(d->nowebcamimage,&d->vsize); 
    146152        } 
    147153} 
     
    190196static int static_image_set_image(MSFilter *f, void *arg){ 
    191197        SIData *d=(SIData*)f->data; 
    192         char *image = (char *)arg; 
    193         ms_mutex_lock(&f->lock); 
     198        const char *image = (const char *)arg; 
     199        ms_filter_lock(f); 
     200        if (d->nowebcamimage) ms_free(d->nowebcamimage); 
    194201        if (image!=NULL && image[0]!='\0') 
    195                 snprintf(d->nowebcamimage, sizeof(d->nowebcamimage), "%s", image); 
     202                d->nowebcamimage=ms_strdup(image); 
    196203        else 
    197                 d->nowebcamimage[0] = '\0'; 
    198  
    199         if (d->pic!=NULL) 
     204                d->nowebcamimage = def_image; 
     205 
     206        if (d->pic!=NULL){ 
    200207                freemsg(d->pic); 
    201  
    202   //if (d->nowebcamimage[0] != '\0') 
    203          // d->pic=ms_load_jpeg_as_yuv(d->nowebcamimage,&d->vsize); 
    204   //else 
    205          // d->pic=ms_load_nowebcam(&d->vsize,d->index); 
    206         ms_mutex_unlock(&f->lock); 
     208                d->pic=NULL; 
     209        } 
     210 
     211        ms_filter_unlock(f); 
    207212        return 0; 
    208213} 
     
    258263} 
    259264 
     265void ms_static_image_set_default_image(const char *path){ 
     266        if (def_image!=NULL) 
     267                ms_free(def_image); 
     268        def_image=NULL; 
     269        if (path) 
     270                def_image=ms_strdup(path); 
     271} 
  • linphone/oRTP/src/rtpsession.c

    r0 r180  
    13651365        rtp_stats_reset(&session->rtp.stats); 
    13661366        rtp_session_resync(session); 
     1367        session->ssrc_set=FALSE; 
    13671368} 
    13681369 
Note: See TracChangeset for help on using the changeset viewer.