Changeset 6:0a8a07e9488b in verona


Ignore:
Timestamp:
Dec 29, 2009 7:51:46 PM (3 years ago)
Author:
vadim@…
Branch:
default
Message:

Fixes to use latest libs in the mediastreamer

Files:
1 added
14 edited

Legend:

Unmodified
Added
Removed
  • CMakeLists.txt

    r3 r6  
    88set(VERONA_VERSION_STRING "0.1.0") 
    99 
     10include(Macros.cmake) 
     11 
     12if (CMAKE_SYSTEM_NAME MATCHES Linux) 
     13 set(LINUX True) 
     14 message("Building for ${CMAKE_SYSTEM_NAME}") 
     15endif(CMAKE_SYSTEM_NAME MATCHES Linux) 
    1016 
    1117 
  • oRTP/CMakeLists.txt

    r1 r6  
    6868set_target_properties(ortp PROPERTIES VERSION ${ORTP_VERSION} SOVERSION ${ORTP_VERSION}) 
    6969 
    70 set(ORTP_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/include" CACHE PATH "Include path for oRTP library")  
     70set(ORTP_INCLUDE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/include" CACHE PATH "Include path for oRTP library")  
    7171set(ORTP_LIB_DIR ${LIBRARY_OUTPUT_DIRECTORY} CACHE PATH "Output directory for oRTP library") 
    7272 
  • phapi/CMakeLists.txt

    r5 r6  
    3030 
    3131 
    32 include_directories(${OSIP2_INCLUDE_DIRS} ${EXOSIP2_INCLUDE_DIRS}) 
     32include_directories(${OSIP2_INCLUDE_DIRS} ${EXOSIP2_INCLUDE_DIRS} ${ORTP_INCLUDE_DIRS}) 
    3333 
    34 add_library(phapi SHARED phapi.c) 
     34set(PHAPI_GENERIC_SRCS phapi.c phmedia.c phcodec.c phmedia-audio.c phmedia-audio-null.c 
     35  phaudiodriver.c phrecorder.c phmbuf.c wav.c tonegen.c 
     36) 
     37 
     38set(PHAPI_SRCS ${PHAPI_GENERIC_SRCS}) 
     39 
     40if(LINUX) 
     41  add_definitions(-DENABLE_OSS -DOS_LINUX) 
     42 
     43  set(PHAPI_LINUX_SRCS  phmedia-oss.c) 
     44 
     45  find_library(ALSA  asound) 
     46  if (ALSA) 
     47    set(PHAPI_LINUX_SRCS  ${PHAPI_LINUX_SRCS} phmedia-alsa.c) 
     48    add_definitions(-DENABLE_ALSA) 
     49  endif(ALSA)    
     50endif(LINUX) 
     51 
     52set(PHAPI_SRCS ${PHAPI_GENERIC_SRCS} ${PHAPI_LINUX_SRCS}) 
     53 
     54   
     55add_library(phapi SHARED ${PHAPI_SRCS}) 
     56 
    3557set_target_properties(phapi PROPERTIES VERSION ${PHAPI_VERSION_STRING} SOVERSION ${PHAPI_VERSION_STRING}) 
    36 target_link_libraries(phapi exosip2 osip2 ortp) 
     58target_link_libraries(phapi exosip2 osip2 ortp ${ALSA}) 
    3759 
    3860 
  • phapi/phastream.h

    r0 r6  
    2323 
    2424 
    25 #define DTMF_LOCK(s) g_mutex_lock(s->dtmfi.dtmfg_lock) 
    26 #define DTMF_UNLOCK(s) g_mutex_unlock(s->dtmfi.dtmfg_lock) 
     25#define DTMF_LOCK(s) osip_mutex_lock(s->dtmfi.dtmfg_lock) 
     26#define DTMF_UNLOCK(s) osip_mutex_unlock(s->dtmfi.dtmfg_lock) 
    2727 
    2828 
     
    3838  int   dtmfg_len; 
    3939  struct dtmfgen dtmfg_ctx; 
    40   GMutex *dtmfg_lock; 
     40  ph_mutex_t *dtmfg_lock; 
    4141}; 
    4242 
     
    8989  GMutex *cng_lock; 
    9090 
    91 #define CNG_LOCK(s) g_mutex_lock(s->cng_lock) 
    92 #define CNG_UNLOCK(s) g_mutex_unlock(s->cng_lock) 
     91#define CNG_LOCK(s) osip_mutex_lock(s->cng_lock) 
     92#define CNG_UNLOCK(s) osip_mutex_unlock(s->cng_lock) 
    9393#else 
    9494#define CNG_LOCK(s) 
  • phapi/phaudiodriver.c

    r0 r6  
    1919 
    2020#include <string.h> 
     21#include <stdio.h> 
     22#include <stdlib.h> 
     23 
    2124#include "phdebug.h" 
    2225#include "phaudiodriver.h" 
  • phapi/phcodec.c

    r0 r6  
    1515#endif 
    1616 
    17 #include "rtpport.h" // only for GMutex <- phmedia.h <- phcodec-h263.h 
     17//#include <ortp/rtpport.h> // only for GMutex <- phmedia.h <- phcodec-h263.h 
    1818#include "phcodec.h" 
    1919 
  • phapi/phconfig.c

    r0 r6  
    1717 */ 
    1818 
     19#include <string.h> 
     20#include <stdio.h> 
    1921#include "phapi.h" 
    2022 
     
    4547 
    4648int ph_config_initialize_default(phConfig_t *cfg) { 
    47         if (cfg == NULL) 
     49        if (!cfg) 
    4850                return -1; 
    4951 
  • phapi/phmedia-alsa.c

    r0 r6  
    2121 cf http://www.linuxjournal.com/article/6735 for an introduction to ALSA 
    2222*/ 
     23 
     24 
    2325#ifdef ENABLE_ALSA 
     26#include <stdio.h> 
     27#include <string.h> 
     28#include <stdlib.h> 
     29#include <sys/stat.h> 
     30#include <sys/types.h> 
     31#include <errno.h> 
     32#include <limits.h> 
     33#include <ctype.h> 
     34#include <assert.h> 
     35#include <time.h> 
     36 
    2437#include <osip2/osip_mt.h> 
    2538#include <osip2/osip.h> 
    26 #include <sys/ioctl.h> 
    27 #include <sys/time.h> 
    28 #include <fcntl.h> 
    29 #include <stdlib.h> 
    3039#define ALSA_PCM_NEW_HW_PARAMS_API 
    3140#include <alsa/asoundlib.h> 
    32 #include <ortp.h> 
    33 #include <ortp-export.h> 
    34 #include <telephonyevents.h> 
     41#include <ortp/ortp.h> 
     42#include <ortp/telephonyevents.h> 
    3543#include "phdebug.h" 
    3644#include "phapi.h" 
  • phapi/phmedia-audio-null.c

    r0 r6  
    1717 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA 
    1818 */ 
     19 
     20#include <stdio.h> 
     21#include <string.h> 
     22#include <stdlib.h> 
     23#include <sys/stat.h> 
     24#include <sys/types.h> 
     25#include <errno.h> 
     26#include <limits.h> 
     27#include <ctype.h> 
     28#include <assert.h> 
     29#include <time.h> 
     30 
    1931#include <osip2/osip_mt.h> 
    2032#include <osip2/osip.h> 
    21 #ifndef T_MSVC 
    22 #include <sys/ioctl.h> 
    23 #include <sys/time.h> 
    24 #endif 
    25 #include <fcntl.h> 
    26 #include <stdlib.h> 
    27 #include <ortp.h> 
    28 #include <ortp-export.h> 
    29 #include <telephonyevents.h> 
     33 
     34#include <ortp/ortp.h> 
     35#include <ortp/telephonyevents.h> 
    3036#include "phapi.h" 
    3137#include "phcall.h" 
  • phapi/phmedia-audio.c

    r0 r6  
    22 * phmedia -  Phone Api media streamer 
    33 * 
     4 * Copyright (C) 2009-2010 MBDSYS S.A.R.L. 
    45 * Copyright (C) 2005-2006 Wengo SAS 
    56 * Copyright (C) 2004 Vadim Lebedev <vadim@mbdsys.com> 
     
    2021 */ 
    2122 
     23#include <stdio.h> 
     24#include <string.h> 
     25#include <stdlib.h> 
     26#include <sys/stat.h> 
     27#include <sys/types.h> 
     28#include <errno.h> 
     29#include <limits.h> 
     30#include <ctype.h> 
     31#include <assert.h> 
     32#include <time.h> 
     33 
    2234#ifdef WIN32 
    2335#include <winsock2.h> 
     
    3547#include <fcntl.h> 
    3648#include <stdlib.h> 
    37 #include <ortp.h> 
    38 #include <ortp-export.h> 
    39 #include <telephonyevents.h> 
     49#include <ortp/ortp.h> 
     50#include <ortp/telephonyevents.h> 
    4051#include <assert.h> 
    4152 
     
    7687#ifdef DO_ECHO_CAN 
    7788 
    78 /* 
    79 #define ECHO_SYNC_LOCK(x) if (s->ec) g_mutex_lock(s->ecmux) 
    80 #define ECHO_SYNC_UNLOCK(x) if (s->ec) g_mutex_unlock(s->ecmux) 
    81 */ 
    8289 
    8390#define ECHO_SYNC_LOCK(x) 
     
    94101 
    95102 
    96 GMutex *ph_audio_mux; 
    97  
    98 #define PH_MSESSION_AUDIO_LOCK() g_mutex_lock(ph_audio_mux) 
    99 #define PH_MSESSION_AUDIO_UNLOCK() g_mutex_unlock(ph_audio_mux) 
     103ph_mutex_t *ph_audio_mux; 
     104 
     105#define PH_MSESSION_AUDIO_LOCK() osip_mutex_lock(ph_audio_mux) 
     106#define PH_MSESSION_AUDIO_UNLOCK() osip_mutex_unlock(ph_audio_mux) 
    100107 
    101108 
     
    257264{ 
    258265    memset(cb, 0, sizeof(*cb)); 
    259     cb->cb_buf = (char *) g_malloc(size); 
     266    cb->cb_buf = (char *) osip_malloc(size); 
    260267    cb->cb_siz = size; 
    261268} 
     
    264271cb_clean(struct circbuf *cb) 
    265272{ 
    266     g_free(cb->cb_buf); 
     273    osip_free(cb->cb_buf); 
    267274} 
    268275 
     
    705712   DBG5_DYNA_AUDIO("PHMEDIA:send CNG %d\n", level,0,0,0); 
    706713  /* send CNG packet */ 
    707    mp = rtp_session_create_specific_payload_packet(stream->ms.rtp_session, RTP_FIXED_HEADER_SIZE, stream->cngi.cng_pt, &level, 1); 
     714   mp = rtp_session_create_packet(stream->ms.rtp_session, RTP_FIXED_HEADER_SIZE, &level, 1); 
     715 
    708716   if (mp != NULL) 
    709717       { 
     718       rtp_set_payload_TYPE(mp,  stream->cngi.cng_pt); 
    710719       rtp_session_sendm_with_ts(stream->ms.rtp_session, mp, timestamp); 
    711720       } 
     
    18711880  else 
    18721881    { 
    1873 #if 0 
    1874       cngp->cng_lock = g_mutex_new(); 
    1875 #endif 
    18761882      cngp->nidx = 0; 
    18771883    } 
     
    22162222          cb_init(&stream->pcmoutbuf, 2 * sizeof(short) * MAX_OUTPUT_LATENCY * clockrate/1000); 
    22172223          stream->sent_cnt = stream->recv_cnt = 0; 
    2218           stream->ecmux = g_mutex_new(); 
     2224          stream->ecmux = osip_mutex_init(); 
    22192225           
    22202226        } 
     
    25362542#endif   
    25372543   
    2538   rtp_session_set_scheduling_mode(session, SCHEDULING_MODE); /* yes */ 
    2539   rtp_session_set_blocking_mode(session, BLOCKING_MODE); 
     2544  rtp_session_set_scheduling_mode(session, 1); /* yes */ 
     2545  rtp_session_set_blocking_mode(session, 1); 
    25402546 
    25412547  if (codecpt != stream->ms.payload) 
     
    26112617 
    26122618  stream->dtmfCallback = s->dtmfCallback; 
    2613   stream->dtmfi.dtmfg_lock = g_mutex_new(); 
     2619  stream->dtmfi.dtmfg_lock = osip_mutex_init(); 
    26142620  stream->dtmfi.dtmfq_cnt = 0; 
    26152621  stream->dtmfi.dtmfg_phase = DTMF_IDLE; 
     
    26492655 
    26502656      CNG_UNLOCK(stream); 
    2651 #if 0 
    2652       if ( stream->cngi.cng_lock ) 
    2653     g_mutex_free(stream->cng_lock); 
    2654 #endif 
     2657 
     2658 
    26552659    } 
    26562660} 
     
    27582762        ph_ec_cleanup(stream->ec); 
    27592763 
    2760     g_mutex_free(stream->ecmux); 
    2761     } 
    2762 #endif 
    2763  
    2764   g_mutex_free(stream->dtmfi.dtmfg_lock); 
     2764    osip_mutex_destroy(stream->ecmux); 
     2765    } 
     2766#endif 
     2767 
     2768  osip_mutex_destroy(stream->dtmfi.dtmfg_lock); 
    27652769 
    27662770  if (stream->activate_recorder) 
     
    30423046    return; 
    30433047 
    3044   ph_audio_mux = g_mutex_new(); 
     3048  ph_audio_mux = osip_mutex_init(); 
    30453049#ifdef OS_WINDOWS 
    30463050  ph_winmm_driver_init(); 
     
    31273131      stream->dtmfi.dtmfq_buf[stream->dtmfi.dtmfq_wr++] = (unsigned short) (dtmf | (mode << 8)); 
    31283132      if (stream->dtmfi.dtmfq_wr == DTMFQ_MAX) 
    3129     stream->dtmfi.dtmfq_wr = 0; 
     3133        stream->dtmfi.dtmfq_wr = 0; 
    31303134 
    31313135      stream->dtmfi.dtmfq_cnt++; 
  • phapi/phmedia-oss.c

    r0 r6  
    1717  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA 
    1818*/ 
     19 
     20#include <stdio.h> 
     21#include <string.h> 
     22#include <stdlib.h> 
     23#include <sys/stat.h> 
     24#include <sys/types.h> 
     25#include <errno.h> 
     26#include <limits.h> 
     27#include <ctype.h> 
     28#include <assert.h> 
     29#include <time.h> 
     30 
    1931#include <osip2/osip_mt.h> 
    2032#include <osip2/osip.h> 
    2133#include <sys/soundcard.h> 
    22 #include <sys/ioctl.h> 
    23 #include <sys/time.h> 
    24 #include <fcntl.h> 
    25 #include <stdlib.h> 
    26 #include <ortp.h> 
    27 #include <ortp-export.h> 
    28 #include <telephonyevents.h> 
     34 
     35#include <ortp/ortp.h> 
     36#include <ortp/telephonyevents.h> 
    2937#include "phapi.h" 
    3038#include "phcall.h" 
     
    176184 
    177185 
    178   as->drvinfo = (int)  fd; 
     186  as->drvinfo = (void *)  fd; 
    179187 
    180188  PH_SNDDRVR_USE(); 
  • phapi/phmedia.c

    r0 r6  
    2121 */ 
    2222 
     23#include <stdio.h> 
     24#include <string.h> 
     25#include <stdlib.h> 
     26#include <sys/stat.h> 
     27#include <sys/types.h> 
     28#include <errno.h> 
     29#include <limits.h> 
     30#include <ctype.h> 
     31#include <assert.h> 
     32#include <time.h> 
     33 
     34#ifdef OS_POSIX 
     35#include <sys/ioctl.h> 
     36#include <sys/time.h> 
     37#endif 
     38 
    2339#include "phglobal.h" 
    2440#include "phdebug.h" 
    2541#include <osip2/osip_mt.h> 
    2642#include <osip2/osip.h> 
    27 #ifdef OS_POSIX 
    28 #include <sys/ioctl.h> 
    29 #include <sys/time.h> 
    30 #endif 
    3143 
    3244#include <fcntl.h> 
    3345#include <stdlib.h> 
    34 #include <ortp.h> 
    35 #include <ortp-export.h> 
    36 #include <telephonyevents.h> 
     46#include <ortp/ortp.h> 
     47#include <ortp/telephonyevents.h> 
    3748#include "phapi.h" 
    3849#include "phcall.h" 
     
    5970 
    6071 
     72static RtpProfile* get_av_profile() 
     73{ 
     74  return &av_profile; 
     75} 
     76 
    6177int ph_media_cleanup() 
    6278{ 
     
    7187  DBG2_MEDIA_ENGINE("MEDIA_ENGINE: entering ph_msession_start deviceId = %s\n", deviceid); 
    7288 
    73   g_mutex_lock(s->critsec_mstream_init); 
     89  osip_mutex_lock(s->critsec_mstream_init); 
    7490  if (s->refcnt != 1) 
    7591    { 
    76       g_mutex_unlock(s->critsec_mstream_init); 
     92      osip_mutex_unlock(s->critsec_mstream_init); 
    7793      return 0; 
    7894    } 
     
    84100#endif 
    85101 
    86   g_mutex_unlock(s->critsec_mstream_init); 
     102  osip_mutex_unlock(s->critsec_mstream_init); 
    87103 
    88104  DBG4_MEDIA_ENGINE("MEDIA_ENGINE:  ph_msession_start deviceId = %s audio_start : %d video_start :%d\n", deviceid, ret1, ret2); 
     
    100116  int ret; 
    101117  DBG1_MEDIA_ENGINE("MEDIA_ENGINE: entering ph_msession_conf_start\n"); 
    102   g_mutex_lock(s1->critsec_mstream_init); 
    103   g_mutex_lock(s2->critsec_mstream_init); 
     118  osip_mutex_lock(s1->critsec_mstream_init); 
     119  osip_mutex_lock(s2->critsec_mstream_init); 
    104120  ret = ph_msession_audio_conf_start(s1, s2, device); 
    105   g_mutex_unlock(s2->critsec_mstream_init); 
    106   g_mutex_unlock(s1->critsec_mstream_init); 
     121  osip_mutex_unlock(s2->critsec_mstream_init); 
     122  osip_mutex_unlock(s1->critsec_mstream_init); 
    107123  return ret; 
    108124} 
     
    111127  int ret; 
    112128  DBG1_MEDIA_ENGINE("MEDIA_ENGINE: entering ph_msession_conf_stop\n"); 
    113   g_mutex_lock(s1->critsec_mstream_init); 
    114   g_mutex_lock(s2->critsec_mstream_init); 
     129  osip_mutex_lock(s1->critsec_mstream_init); 
     130  osip_mutex_lock(s2->critsec_mstream_init); 
    115131  ret = ph_msession_audio_conf_stop(s1, s2); 
    116   g_mutex_unlock(s2->critsec_mstream_init); 
    117   g_mutex_unlock(s1->critsec_mstream_init); 
     132  osip_mutex_unlock(s2->critsec_mstream_init); 
     133  osip_mutex_unlock(s1->critsec_mstream_init); 
    118134  return ret; 
    119135} 
     
    123139{ 
    124140  DBG1_MEDIA_ENGINE("MEDIA_ENGINE: entering ph_msession_suspend\n"); 
    125   g_mutex_lock(s->critsec_mstream_init); 
     141  osip_mutex_lock(s->critsec_mstream_init); 
    126142#ifdef PHAPI_VIDEO_SUPPORT 
    127143   ph_msession_video_stop(s); 
    128144#endif 
    129145   ph_msession_audio_suspend(s, traffictype, device); 
    130    g_mutex_unlock(s->critsec_mstream_init); 
     146   osip_mutex_unlock(s->critsec_mstream_init); 
    131147   return (0); 
    132148} 
     
    137153 
    138154  DBG1_MEDIA_ENGINE("MEDIA_ENGINE: entering ph_msession_resume\n"); 
    139   g_mutex_lock(s->critsec_mstream_init); 
     155  osip_mutex_lock(s->critsec_mstream_init); 
    140156 
    141157  ph_msession_audio_resume(s, traffictype, device); 
     
    144160#endif 
    145161 
    146   g_mutex_unlock(s->critsec_mstream_init); 
     162  osip_mutex_unlock(s->critsec_mstream_init); 
    147163  return ret;   
    148164 
     
    154170 
    155171  DBG1_MEDIA_ENGINE("MEDIA_ENGINE: entering ph_msession_stop\n"); 
    156   g_mutex_lock(s->critsec_mstream_init); 
     172  osip_mutex_lock(s->critsec_mstream_init); 
    157173 
    158174#ifdef PHAPI_VIDEO_SUPPORT 
     
    161177  ph_msession_audio_stop(s, adevid); 
    162178 
    163   g_mutex_unlock(s->critsec_mstream_init); 
     179  osip_mutex_unlock(s->critsec_mstream_init); 
    164180 
    165181} 
  • phapi/phmedia.h

    r3 r6  
    126126 
    127127 
    128 typedef struct osip_mutex *ph_mutex_t; 
     128typedef struct osip_mutex ph_mutex_t; 
    129129 
    130130/** 
  • phapi/phmstream.h

    r0 r6  
    1111#define TYPE(val) .type = (val) 
    1212#define CLOCK_RATE(val) .clock_rate = (val) 
    13 #define BYTES_PER_SAMPLE(val) .bytes_per_sample = (val) 
     13#define BYTES_PER_SAMPLE(val) .bits_per_sample = (val)*8 
    1414#define ZERO_PATTERN(val)   .zero_pattern = (val) 
    1515#define PATTERN_LENGTH(val) .pattern_length = (val) 
     
    1919#define TYPE(val) (val) 
    2020#define CLOCK_RATE(val) (val) 
    21 #define BYTES_PER_SAMPLE(val) (val) 
     21#define BYTES_PER_SAMPLE(val) (val)*8 
    2222#define ZERO_PATTERN(val)   (val) 
    2323#define PATTERN_LENGTH(val) (val) 
Note: See TracChangeset for help on using the changeset viewer.