Changeset 6:0a8a07e9488b in verona
- Timestamp:
- Dec 29, 2009 7:51:46 PM (3 years ago)
- Branch:
- default
- Files:
-
- 1 added
- 14 edited
-
CMakeLists.txt (modified) (1 diff)
-
Macros.cmake (added)
-
oRTP/CMakeLists.txt (modified) (1 diff)
-
phapi/CMakeLists.txt (modified) (1 diff)
-
phapi/phastream.h (modified) (3 diffs)
-
phapi/phaudiodriver.c (modified) (1 diff)
-
phapi/phcodec.c (modified) (1 diff)
-
phapi/phconfig.c (modified) (2 diffs)
-
phapi/phmedia-alsa.c (modified) (1 diff)
-
phapi/phmedia-audio-null.c (modified) (1 diff)
-
phapi/phmedia-audio.c (modified) (16 diffs)
-
phapi/phmedia-oss.c (modified) (2 diffs)
-
phapi/phmedia.c (modified) (11 diffs)
-
phapi/phmedia.h (modified) (1 diff)
-
phapi/phmstream.h (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
CMakeLists.txt
r3 r6 8 8 set(VERONA_VERSION_STRING "0.1.0") 9 9 10 include(Macros.cmake) 11 12 if (CMAKE_SYSTEM_NAME MATCHES Linux) 13 set(LINUX True) 14 message("Building for ${CMAKE_SYSTEM_NAME}") 15 endif(CMAKE_SYSTEM_NAME MATCHES Linux) 10 16 11 17 -
oRTP/CMakeLists.txt
r1 r6 68 68 set_target_properties(ortp PROPERTIES VERSION ${ORTP_VERSION} SOVERSION ${ORTP_VERSION}) 69 69 70 set(ORTP_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/include" CACHE PATH "Include path for oRTP library")70 set(ORTP_INCLUDE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/include" CACHE PATH "Include path for oRTP library") 71 71 set(ORTP_LIB_DIR ${LIBRARY_OUTPUT_DIRECTORY} CACHE PATH "Output directory for oRTP library") 72 72 -
phapi/CMakeLists.txt
r5 r6 30 30 31 31 32 include_directories(${OSIP2_INCLUDE_DIRS} ${EXOSIP2_INCLUDE_DIRS} )32 include_directories(${OSIP2_INCLUDE_DIRS} ${EXOSIP2_INCLUDE_DIRS} ${ORTP_INCLUDE_DIRS}) 33 33 34 add_library(phapi SHARED phapi.c) 34 set(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 38 set(PHAPI_SRCS ${PHAPI_GENERIC_SRCS}) 39 40 if(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) 50 endif(LINUX) 51 52 set(PHAPI_SRCS ${PHAPI_GENERIC_SRCS} ${PHAPI_LINUX_SRCS}) 53 54 55 add_library(phapi SHARED ${PHAPI_SRCS}) 56 35 57 set_target_properties(phapi PROPERTIES VERSION ${PHAPI_VERSION_STRING} SOVERSION ${PHAPI_VERSION_STRING}) 36 target_link_libraries(phapi exosip2 osip2 ortp )58 target_link_libraries(phapi exosip2 osip2 ortp ${ALSA}) 37 59 38 60 -
phapi/phastream.h
r0 r6 23 23 24 24 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) 27 27 28 28 … … 38 38 int dtmfg_len; 39 39 struct dtmfgen dtmfg_ctx; 40 GMutex*dtmfg_lock;40 ph_mutex_t *dtmfg_lock; 41 41 }; 42 42 … … 89 89 GMutex *cng_lock; 90 90 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) 93 93 #else 94 94 #define CNG_LOCK(s) -
phapi/phaudiodriver.c
r0 r6 19 19 20 20 #include <string.h> 21 #include <stdio.h> 22 #include <stdlib.h> 23 21 24 #include "phdebug.h" 22 25 #include "phaudiodriver.h" -
phapi/phcodec.c
r0 r6 15 15 #endif 16 16 17 #include "rtpport.h"// only for GMutex <- phmedia.h <- phcodec-h263.h17 //#include <ortp/rtpport.h> // only for GMutex <- phmedia.h <- phcodec-h263.h 18 18 #include "phcodec.h" 19 19 -
phapi/phconfig.c
r0 r6 17 17 */ 18 18 19 #include <string.h> 20 #include <stdio.h> 19 21 #include "phapi.h" 20 22 … … 45 47 46 48 int ph_config_initialize_default(phConfig_t *cfg) { 47 if ( cfg == NULL)49 if (!cfg) 48 50 return -1; 49 51 -
phapi/phmedia-alsa.c
r0 r6 21 21 cf http://www.linuxjournal.com/article/6735 for an introduction to ALSA 22 22 */ 23 24 23 25 #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 24 37 #include <osip2/osip_mt.h> 25 38 #include <osip2/osip.h> 26 #include <sys/ioctl.h>27 #include <sys/time.h>28 #include <fcntl.h>29 #include <stdlib.h>30 39 #define ALSA_PCM_NEW_HW_PARAMS_API 31 40 #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> 35 43 #include "phdebug.h" 36 44 #include "phapi.h" -
phapi/phmedia-audio-null.c
r0 r6 17 17 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 18 */ 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 19 31 #include <osip2/osip_mt.h> 20 32 #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> 30 36 #include "phapi.h" 31 37 #include "phcall.h" -
phapi/phmedia-audio.c
r0 r6 2 2 * phmedia - Phone Api media streamer 3 3 * 4 * Copyright (C) 2009-2010 MBDSYS S.A.R.L. 4 5 * Copyright (C) 2005-2006 Wengo SAS 5 6 * Copyright (C) 2004 Vadim Lebedev <vadim@mbdsys.com> … … 20 21 */ 21 22 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 22 34 #ifdef WIN32 23 35 #include <winsock2.h> … … 35 47 #include <fcntl.h> 36 48 #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> 40 51 #include <assert.h> 41 52 … … 76 87 #ifdef DO_ECHO_CAN 77 88 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 */82 89 83 90 #define ECHO_SYNC_LOCK(x) … … 94 101 95 102 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)103 ph_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) 100 107 101 108 … … 257 264 { 258 265 memset(cb, 0, sizeof(*cb)); 259 cb->cb_buf = (char *) g_malloc(size);266 cb->cb_buf = (char *) osip_malloc(size); 260 267 cb->cb_siz = size; 261 268 } … … 264 271 cb_clean(struct circbuf *cb) 265 272 { 266 g_free(cb->cb_buf);273 osip_free(cb->cb_buf); 267 274 } 268 275 … … 705 712 DBG5_DYNA_AUDIO("PHMEDIA:send CNG %d\n", level,0,0,0); 706 713 /* 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 708 716 if (mp != NULL) 709 717 { 718 rtp_set_payload_TYPE(mp, stream->cngi.cng_pt); 710 719 rtp_session_sendm_with_ts(stream->ms.rtp_session, mp, timestamp); 711 720 } … … 1871 1880 else 1872 1881 { 1873 #if 01874 cngp->cng_lock = g_mutex_new();1875 #endif1876 1882 cngp->nidx = 0; 1877 1883 } … … 2216 2222 cb_init(&stream->pcmoutbuf, 2 * sizeof(short) * MAX_OUTPUT_LATENCY * clockrate/1000); 2217 2223 stream->sent_cnt = stream->recv_cnt = 0; 2218 stream->ecmux = g_mutex_new();2224 stream->ecmux = osip_mutex_init(); 2219 2225 2220 2226 } … … 2536 2542 #endif 2537 2543 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); 2540 2546 2541 2547 if (codecpt != stream->ms.payload) … … 2611 2617 2612 2618 stream->dtmfCallback = s->dtmfCallback; 2613 stream->dtmfi.dtmfg_lock = g_mutex_new();2619 stream->dtmfi.dtmfg_lock = osip_mutex_init(); 2614 2620 stream->dtmfi.dtmfq_cnt = 0; 2615 2621 stream->dtmfi.dtmfg_phase = DTMF_IDLE; … … 2649 2655 2650 2656 CNG_UNLOCK(stream); 2651 #if 0 2652 if ( stream->cngi.cng_lock ) 2653 g_mutex_free(stream->cng_lock); 2654 #endif 2657 2658 2655 2659 } 2656 2660 } … … 2758 2762 ph_ec_cleanup(stream->ec); 2759 2763 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); 2765 2769 2766 2770 if (stream->activate_recorder) … … 3042 3046 return; 3043 3047 3044 ph_audio_mux = g_mutex_new();3048 ph_audio_mux = osip_mutex_init(); 3045 3049 #ifdef OS_WINDOWS 3046 3050 ph_winmm_driver_init(); … … 3127 3131 stream->dtmfi.dtmfq_buf[stream->dtmfi.dtmfq_wr++] = (unsigned short) (dtmf | (mode << 8)); 3128 3132 if (stream->dtmfi.dtmfq_wr == DTMFQ_MAX) 3129 stream->dtmfi.dtmfq_wr = 0;3133 stream->dtmfi.dtmfq_wr = 0; 3130 3134 3131 3135 stream->dtmfi.dtmfq_cnt++; -
phapi/phmedia-oss.c
r0 r6 17 17 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 18 */ 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 19 31 #include <osip2/osip_mt.h> 20 32 #include <osip2/osip.h> 21 33 #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> 29 37 #include "phapi.h" 30 38 #include "phcall.h" … … 176 184 177 185 178 as->drvinfo = ( int) fd;186 as->drvinfo = (void *) fd; 179 187 180 188 PH_SNDDRVR_USE(); -
phapi/phmedia.c
r0 r6 21 21 */ 22 22 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 23 39 #include "phglobal.h" 24 40 #include "phdebug.h" 25 41 #include <osip2/osip_mt.h> 26 42 #include <osip2/osip.h> 27 #ifdef OS_POSIX28 #include <sys/ioctl.h>29 #include <sys/time.h>30 #endif31 43 32 44 #include <fcntl.h> 33 45 #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> 37 48 #include "phapi.h" 38 49 #include "phcall.h" … … 59 70 60 71 72 static RtpProfile* get_av_profile() 73 { 74 return &av_profile; 75 } 76 61 77 int ph_media_cleanup() 62 78 { … … 71 87 DBG2_MEDIA_ENGINE("MEDIA_ENGINE: entering ph_msession_start deviceId = %s\n", deviceid); 72 88 73 g_mutex_lock(s->critsec_mstream_init);89 osip_mutex_lock(s->critsec_mstream_init); 74 90 if (s->refcnt != 1) 75 91 { 76 g_mutex_unlock(s->critsec_mstream_init);92 osip_mutex_unlock(s->critsec_mstream_init); 77 93 return 0; 78 94 } … … 84 100 #endif 85 101 86 g_mutex_unlock(s->critsec_mstream_init);102 osip_mutex_unlock(s->critsec_mstream_init); 87 103 88 104 DBG4_MEDIA_ENGINE("MEDIA_ENGINE: ph_msession_start deviceId = %s audio_start : %d video_start :%d\n", deviceid, ret1, ret2); … … 100 116 int ret; 101 117 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); 104 120 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); 107 123 return ret; 108 124 } … … 111 127 int ret; 112 128 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); 115 131 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); 118 134 return ret; 119 135 } … … 123 139 { 124 140 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); 126 142 #ifdef PHAPI_VIDEO_SUPPORT 127 143 ph_msession_video_stop(s); 128 144 #endif 129 145 ph_msession_audio_suspend(s, traffictype, device); 130 g_mutex_unlock(s->critsec_mstream_init);146 osip_mutex_unlock(s->critsec_mstream_init); 131 147 return (0); 132 148 } … … 137 153 138 154 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); 140 156 141 157 ph_msession_audio_resume(s, traffictype, device); … … 144 160 #endif 145 161 146 g_mutex_unlock(s->critsec_mstream_init);162 osip_mutex_unlock(s->critsec_mstream_init); 147 163 return ret; 148 164 … … 154 170 155 171 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); 157 173 158 174 #ifdef PHAPI_VIDEO_SUPPORT … … 161 177 ph_msession_audio_stop(s, adevid); 162 178 163 g_mutex_unlock(s->critsec_mstream_init);179 osip_mutex_unlock(s->critsec_mstream_init); 164 180 165 181 } -
phapi/phmedia.h
r3 r6 126 126 127 127 128 typedef struct osip_mutex *ph_mutex_t;128 typedef struct osip_mutex ph_mutex_t; 129 129 130 130 /** -
phapi/phmstream.h
r0 r6 11 11 #define TYPE(val) .type = (val) 12 12 #define CLOCK_RATE(val) .clock_rate = (val) 13 #define BYTES_PER_SAMPLE(val) .b ytes_per_sample = (val)13 #define BYTES_PER_SAMPLE(val) .bits_per_sample = (val)*8 14 14 #define ZERO_PATTERN(val) .zero_pattern = (val) 15 15 #define PATTERN_LENGTH(val) .pattern_length = (val) … … 19 19 #define TYPE(val) (val) 20 20 #define CLOCK_RATE(val) (val) 21 #define BYTES_PER_SAMPLE(val) (val) 21 #define BYTES_PER_SAMPLE(val) (val)*8 22 22 #define ZERO_PATTERN(val) (val) 23 23 #define PATTERN_LENGTH(val) (val)
Note: See TracChangeset
for help on using the changeset viewer.
