- Timestamp:
- Feb 17, 2009 3:19:45 PM (16 years ago)
- Location:
- pjproject/branches/projects/aps-direct
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/branches/projects/aps-direct/pjmedia/include/pjmedia/codec.h
r2456 r2457 276 276 pj_uint8_t pcm_bits_per_sample; /**< Bits/sample in the PCM side */ 277 277 pj_uint8_t pt; /**< Payload type. */ 278 pjmedia_format format;/**< Source format, it's format of278 pjmedia_format_id fmt_id; /**< Source format, it's format of 279 279 encoder input and decoder 280 280 output. */ -
pjproject/branches/projects/aps-direct/pjmedia/include/pjmedia/sound.h
r2456 r2457 93 93 } pjmedia_snd_stream_info; 94 94 95 /** 96 * Audio routing destination. 97 */ 98 typedef enum pjmedia_snd_route 99 { 100 /** Route to default destination */ 101 PJMEDIA_SND_ROUTE_DEFAULT, 102 103 /** Route to loudspeaker */ 104 PJMEDIA_SND_ROUTE_LOUDSPEAKER, 105 106 /** Route to earpiece */ 107 PJMEDIA_SND_ROUTE_EARPIECE, 108 109 } pjmedia_snd_route; 110 95 111 96 112 /** … … 100 116 { 101 117 pjmedia_format format; /**< Format. */ 102 pj_uint32_t bitrate; /**< Bitrate (bps). */103 pj_uint32_t mode; /**< Mode, e.g: iLBC format has104 20ms or 30ms frame size. */105 118 pj_bool_t plc; /**< PLC enabled/disabled. */ 106 pj_bool_t vad; /**< VAD enabled/disabled. */107 119 pj_bool_t cng; /**< CNG enabled/disabled. */ 108 pj _bool_t loudspk; /**< Audio routed to loudspeaker.*/120 pjmedia_snd_route route; /**< Audio routing. */ 109 121 } pjmedia_snd_setting; 110 122 -
pjproject/branches/projects/aps-direct/pjmedia/include/pjmedia/types.h
r2456 r2457 179 179 } pjmedia_sock_info; 180 180 181 /** 182 * Declaration of format. 183 */ 184 typedef union pjmedia_format { 185 pj_uint32_t u32; 186 char c[4]; 181 182 /** 183 * Macro for packing format. 184 */ 185 #define PJMEDIA_FORMAT_PACK(C1, C2, C3, C4) ( C4<<24 | C3<<16 | C2<<8 | C1 ) 186 187 /** 188 * Format identifier definition. 189 */ 190 typedef enum pjmedia_format_id 191 { 192 PJMEDIA_FORMAT_L16 = 0, 193 PJMEDIA_FORMAT_PCMA = PJMEDIA_FORMAT_PACK('A', 'L', 'A', 'W'), 194 PJMEDIA_FORMAT_PCMU = PJMEDIA_FORMAT_PACK('u', 'L', 'A', 'W'), 195 PJMEDIA_FORMAT_AMR = PJMEDIA_FORMAT_PACK(' ', 'A', 'M', 'R'), 196 PJMEDIA_FORMAT_G729 = PJMEDIA_FORMAT_PACK('G', '7', '2', '9'), 197 PJMEDIA_FORMAT_ILBC = PJMEDIA_FORMAT_PACK('I', 'L', 'B', 'C') 198 } pjmedia_format_id; 199 200 201 /** 202 * Media format information. 203 */ 204 typedef struct pjmedia_format 205 { 206 /** Format ID */ 207 pjmedia_format_id fmt_id; 208 209 /** Bitrate. */ 210 pj_uint32_t bitrate; 211 212 /** Flag to indicate whether VAD is enabled */ 213 pj_bool_t vad; 214 187 215 } pjmedia_format; 188 216 189 190 /**191 * Macro for packing format.192 */193 #define PJMEDIA_FORMAT_PACK(C1, C2, C3, C4) ( C4<<24 | C3<<16 | C2<<8 | C1 )194 195 /**196 * Format identifier definitions.197 */198 #define PJMEDIA_FORMAT_L16 0199 #define PJMEDIA_FORMAT_PCMA PJMEDIA_FORMAT_PACK('A', 'L', 'A', 'W')200 #define PJMEDIA_FORMAT_PCMU PJMEDIA_FORMAT_PACK('u', 'L', 'A', 'W')201 #define PJMEDIA_FORMAT_AMR PJMEDIA_FORMAT_PACK(' ', 'A', 'M', 'R')202 #define PJMEDIA_FORMAT_G729 PJMEDIA_FORMAT_PACK('G', '7', '2', '9')203 #define PJMEDIA_FORMAT_ILBC PJMEDIA_FORMAT_PACK('I', 'L', 'B', 'C')204 217 205 218 -
pjproject/branches/projects/aps-direct/pjmedia/src/pjmedia-codec/passthrough.c
r2456 r2457 156 156 const char *name; /* Codec name. */ 157 157 pj_uint8_t pt; /* Payload type. */ 158 pjmedia_format format; /* Source format. */158 pjmedia_format_id fmt_id; /* Source format. */ 159 159 unsigned clock_rate; /* Codec's clock rate. */ 160 160 unsigned channel_count; /* Codec's channel count. */ … … 173 173 { 174 174 # if PJMEDIA_HAS_PASSTHROUGH_CODEC_AMR 175 {1, "AMR", PJMEDIA_RTP_PT_AMR, {PJMEDIA_FORMAT_AMR},175 {1, "AMR", PJMEDIA_RTP_PT_AMR, PJMEDIA_FORMAT_AMR, 176 176 8000, 1, 160, 177 177 7400, 12200, 2, 1, 1, … … 182 182 183 183 # if PJMEDIA_HAS_PASSTHROUGH_CODEC_G729 184 {1, "G729", PJMEDIA_RTP_PT_G729, {PJMEDIA_FORMAT_G729},184 {1, "G729", PJMEDIA_RTP_PT_G729, PJMEDIA_FORMAT_G729, 185 185 8000, 1, 80, 186 186 8000, 8000, 2, 1, 1 … … 189 189 190 190 # if PJMEDIA_HAS_PASSTHROUGH_CODEC_ILBC 191 {1, "iLBC", PJMEDIA_RTP_PT_ILBC, {PJMEDIA_FORMAT_ILBC},191 {1, "iLBC", PJMEDIA_RTP_PT_ILBC, PJMEDIA_FORMAT_ILBC, 192 192 8000, 1, 240, 193 193 13333, 15200, 1, 1, 1, … … 198 198 199 199 # if PJMEDIA_HAS_PASSTHROUGH_CODEC_PCMU 200 {1, "PCMU", PJMEDIA_RTP_PT_PCMU, {PJMEDIA_FORMAT_PCMU},200 {1, "PCMU", PJMEDIA_RTP_PT_PCMU, PJMEDIA_FORMAT_PCMU, 201 201 8000, 1, 80, 202 202 64000, 64000, 2, 1, 1 … … 205 205 206 206 # if PJMEDIA_HAS_PASSTHROUGH_CODEC_PCMA 207 {1, "PCMA", PJMEDIA_RTP_PT_PCMA, {PJMEDIA_FORMAT_PCMA},207 {1, "PCMA", PJMEDIA_RTP_PT_PCMA, PJMEDIA_FORMAT_PCMA, 208 208 8000, 1, 80, 209 209 64000, 64000, 2, 1, 1 … … 450 450 codec_desc[i].channel_count / 451 451 codec_desc[i].clock_rate); 452 attr->info.f ormat = codec_desc[i].format;452 attr->info.fmt_id = codec_desc[i].fmt_id; 453 453 454 454 /* Default flags. */ -
pjproject/branches/projects/aps-direct/pjmedia/src/pjmedia/conf_switch.c
r2456 r2457 589 589 590 590 /* Source and sink format must match. */ 591 if (src_port->info->format. u32 != dst_port->info->format.u32) {591 if (src_port->info->format.fmt_id != dst_port->info->format.fmt_id) { 592 592 pj_mutex_unlock(conf->mutex); 593 593 return PJMEDIA_ENOTCOMPATIBLE; … … 952 952 953 953 /* Level adjustment is applicable only for ports that work with raw PCM. */ 954 PJ_ASSERT_RETURN(conf_port->info->format. u32== PJMEDIA_FORMAT_L16,954 PJ_ASSERT_RETURN(conf_port->info->format.fmt_id == PJMEDIA_FORMAT_L16, 955 955 PJ_EIGNORED); 956 956 … … 986 986 987 987 /* Level adjustment is applicable only for ports that work with raw PCM. */ 988 PJ_ASSERT_RETURN(conf_port->info->format. u32== PJMEDIA_FORMAT_L16,988 PJ_ASSERT_RETURN(conf_port->info->format.fmt_id == PJMEDIA_FORMAT_L16, 989 989 PJ_EIGNORED); 990 990 … … 1111 1111 /* Check port format. */ 1112 1112 if (cport_dst->port && 1113 cport_dst->port->info.format. u32== PJMEDIA_FORMAT_L16)1113 cport_dst->port->info.format.fmt_id == PJMEDIA_FORMAT_L16) 1114 1114 { 1115 1115 /* When there is already some samples in listener's TX buffer, -
pjproject/branches/projects/aps-direct/pjmedia/src/pjmedia/sound_port.c
r2456 r2457 290 290 unsigned i, size_decoded; 291 291 292 switch (snd_port->setting.format. u32) {292 switch (snd_port->setting.format.fmt_id) { 293 293 case PJMEDIA_FORMAT_PCMA: 294 294 decoder = &pjmedia_alaw_decode; … … 299 299 default: 300 300 PJ_LOG(1,(THIS_FILE, "Unsupported format %d", 301 snd_port->setting.format. u32));301 snd_port->setting.format.fmt_id)); 302 302 goto no_frame; 303 303 } … … 392 392 fx->base.timestamp.u32.lo = timestamp; 393 393 394 switch (snd_port->setting.format. u32) {394 switch (snd_port->setting.format.fmt_id) { 395 395 case PJMEDIA_FORMAT_PCMA: 396 396 encoder = &pjmedia_alaw_encode; … … 401 401 default: 402 402 PJ_LOG(1,(THIS_FILE, "Unsupported format %d", 403 snd_port->setting.format. u32));403 snd_port->setting.format.fmt_id)); 404 404 return PJ_SUCCESS; 405 405 } … … 435 435 PJ_EBUG); 436 436 437 if (snd_port->setting.format. u32== PJMEDIA_FORMAT_L16) {437 if (snd_port->setting.format.fmt_id == PJMEDIA_FORMAT_L16) { 438 438 snd_rec_cb = &rec_cb; 439 439 snd_play_cb = &play_cb; … … 716 716 #if !defined(PJMEDIA_SND_SUPPORT_OPEN2) || PJMEDIA_SND_SUPPORT_OPEN2==0 717 717 /* For devices that doesn't support open2(), enable simulation */ 718 if (snd_port->setting.format. u32!= PJMEDIA_FORMAT_L16) {718 if (snd_port->setting.format.fmt_id != PJMEDIA_FORMAT_L16) { 719 719 snd_port->frm_buf_size = sizeof(pjmedia_frame_ext) + 720 720 (samples_per_frame << 1) + -
pjproject/branches/projects/aps-direct/pjmedia/src/pjmedia/stream.c
r2456 r2457 868 868 } else if (frame->type == PJMEDIA_FRAME_TYPE_AUDIO && 869 869 frame->buf == NULL && 870 stream->port.info.format. u32== PJMEDIA_FORMAT_L16 &&870 stream->port.info.format.fmt_id == PJMEDIA_FORMAT_L16 && 871 871 (stream->dir & PJMEDIA_DIR_ENCODING) && 872 872 stream->codec_param.info.frm_ptime * … … 1606 1606 stream->port.info.clock_rate = info->fmt.clock_rate; 1607 1607 stream->port.info.channel_count = info->fmt.channel_cnt; 1608 stream->port.info.format = info->param->info.format; 1608 stream->port.info.format.fmt_id = info->param->info.fmt_id; 1609 stream->port.info.format.bitrate = info->param->info.avg_bps; 1610 stream->port.info.format.vad = (info->param->setting.vad != 0); 1609 1611 stream->port.port_data.pdata = stream; 1610 if (stream->port.info.format. u32== PJMEDIA_FORMAT_L16) {1612 if (stream->port.info.format.fmt_id == PJMEDIA_FORMAT_L16) { 1611 1613 stream->port.put_frame = &put_frame; 1612 1614 stream->port.get_frame = &get_frame; -
pjproject/branches/projects/aps-direct/pjsip-apps/src/pjsua/pjsua_app.c
r2454 r2457 2434 2434 pjmedia_port *conf; 2435 2435 pjmedia_session_info sess_info; 2436 pjmedia_port *port; 2436 2437 pjmedia_stream_info *strm_info; 2437 2438 pjmedia_snd_setting setting; … … 2446 2447 strm_info = &sess_info.stream_info[stream_idx]; 2447 2448 2449 pjmedia_session_get_port(sess, stream_idx, &port); 2450 2448 2451 /* Init sound device setting based on stream info. */ 2449 2452 pj_bzero(&setting, sizeof(setting)); 2450 setting.format = strm_info->param->info.format; 2451 setting.bitrate = strm_info->param->info.avg_bps; 2453 setting.format = port->info.format; 2452 2454 setting.cng = strm_info->param->setting.cng; 2453 setting.vad = strm_info->param->setting.vad;2454 2455 setting.plc = strm_info->param->setting.plc; 2455 2456
Note: See TracChangeset
for help on using the changeset viewer.