- Timestamp:
- Feb 18, 2009 2:28:49 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/branches/projects/aps-direct/pjmedia/src/pjmedia/symbian_sound_aps.cpp
r2456 r2460 708 708 pjmedia_frame_ext *frame = (pjmedia_frame_ext*) strm->rec_buf; 709 709 710 switch(strm->setting.format. u32) {710 switch(strm->setting.format.id) { 711 711 case PJMEDIA_FORMAT_AMR: 712 712 { … … 757 757 unsigned samples_got; 758 758 759 samples_got = strm->setting. mode == 30? 240 : 160;759 samples_got = strm->setting.format.bitrate == 15200? 160 : 240; 760 760 761 761 /* Check if we got a normal frame. */ … … 836 836 buf.iBuffer.Zero(); 837 837 838 switch(strm->setting.format. u32) {838 switch(strm->setting.format.id) { 839 839 case PJMEDIA_FORMAT_AMR: 840 840 { … … 949 949 sf = pjmedia_frame_ext_get_subframe(frame, 0); 950 950 samples_cnt = frame->samples_cnt / frame->subframe_cnt; 951 pj_assert((strm->setting.mode == 30 && samples_cnt == 240) || 952 (strm->setting.mode == 20 && samples_cnt == 160)); 951 952 pj_assert((strm->setting.format.bitrate == 15200 && 953 samples_cnt == 160) || 954 (strm->setting.format.bitrate != 15200 && 955 samples_cnt == 240)); 953 956 954 957 if (sf->data && sf->bitlen) { … … 1006 1009 } else { 1007 1010 pj_uint8_t silc; 1008 silc = (strm->setting.format. u32==PJMEDIA_FORMAT_PCMU)?1011 silc = (strm->setting.format.id==PJMEDIA_FORMAT_PCMU)? 1009 1012 pjmedia_linear2ulaw(0) : pjmedia_linear2alaw(0); 1010 1013 buf.iBuffer.AppendFill(silc, samples_cnt); … … 1017 1020 pj_uint8_t silc; 1018 1021 1019 silc = (strm->setting.format. u32==PJMEDIA_FORMAT_PCMU)?1022 silc = (strm->setting.format.id==PJMEDIA_FORMAT_PCMU)? 1020 1023 pjmedia_linear2ulaw(0) : pjmedia_linear2alaw(0); 1021 1024 buf.iBuffer.AppendFill(silc, samples_req - samples_ready); … … 1106 1109 1107 1110 /* Set audio engine fourcc. */ 1108 if (strm->setting.format.u32 == PJMEDIA_FORMAT_PCMU || 1109 strm->setting.format.u32 == PJMEDIA_FORMAT_PCMA || 1110 strm->setting.format.u32 == PJMEDIA_FORMAT_L16) 1111 switch(strm->setting.format.id) { 1112 case PJMEDIA_FORMAT_L16: 1113 case PJMEDIA_FORMAT_PCMU: 1114 case PJMEDIA_FORMAT_PCMA: 1115 aps_setting.fourcc = TFourCC(KMCPFourCCIdG711); 1116 break; 1117 case PJMEDIA_FORMAT_AMR: 1118 aps_setting.fourcc = TFourCC(KMCPFourCCIdAMRNB); 1119 break; 1120 case PJMEDIA_FORMAT_G729: 1121 aps_setting.fourcc = TFourCC(KMCPFourCCIdG729); 1122 break; 1123 case PJMEDIA_FORMAT_ILBC: 1124 aps_setting.fourcc = TFourCC(KMCPFourCCIdILBC); 1125 break; 1126 default: 1127 aps_setting.fourcc = 0; 1128 break; 1129 } 1130 1131 /* Set audio engine mode. */ 1132 if (strm->setting.format.id == PJMEDIA_FORMAT_AMR) 1111 1133 { 1112 aps_setting.fourcc = TFourCC(KMCPFourCCIdG711); 1113 } else { 1114 aps_setting.fourcc = TFourCC(strm->setting.format.u32); 1115 } 1116 1117 /* Set audio engine mode. */ 1118 if (strm->setting.format.u32 == PJMEDIA_FORMAT_AMR) 1119 { 1120 aps_setting.mode = (TAPSCodecMode)strm->setting.bitrate; 1134 aps_setting.mode = (TAPSCodecMode)strm->setting.format.bitrate; 1121 1135 } 1122 else if (strm->setting.format. u32== PJMEDIA_FORMAT_PCMU ||1123 strm->setting.format. u32== PJMEDIA_FORMAT_L16 ||1124 (strm->setting.format. u32== PJMEDIA_FORMAT_ILBC &&1125 strm->setting. mode == 30))1136 else if (strm->setting.format.id == PJMEDIA_FORMAT_PCMU || 1137 strm->setting.format.id == PJMEDIA_FORMAT_L16 || 1138 (strm->setting.format.id == PJMEDIA_FORMAT_ILBC && 1139 strm->setting.format.bitrate != 15200)) 1126 1140 { 1127 1141 aps_setting.mode = EULawOr30ms; 1128 1142 } 1129 else if (strm->setting.format. u32== PJMEDIA_FORMAT_PCMA ||1130 (strm->setting.format. u32== PJMEDIA_FORMAT_ILBC &&1131 strm->setting. mode == 20))1143 else if (strm->setting.format.id == PJMEDIA_FORMAT_PCMA || 1144 (strm->setting.format.id == PJMEDIA_FORMAT_ILBC && 1145 strm->setting.format.bitrate == 15200)) 1132 1146 { 1133 1147 aps_setting.mode = EALawOr20ms; … … 1135 1149 1136 1150 /* Disable VAD on L16 and G711. */ 1137 if (strm->setting.format. u32== PJMEDIA_FORMAT_PCMU ||1138 strm->setting.format. u32== PJMEDIA_FORMAT_PCMA ||1139 strm->setting.format. u32== PJMEDIA_FORMAT_L16)1151 if (strm->setting.format.id == PJMEDIA_FORMAT_PCMU || 1152 strm->setting.format.id == PJMEDIA_FORMAT_PCMA || 1153 strm->setting.format.id == PJMEDIA_FORMAT_L16) 1140 1154 { 1141 1155 aps_setting.vad = EFalse; 1142 1156 } else { 1143 aps_setting.vad = strm->setting. vad;1157 aps_setting.vad = strm->setting.format.vad; 1144 1158 } 1145 1159 1146 1160 /* Set other audio engine attributes. */ 1147 1161 aps_setting.plc = strm->setting.plc; 1148 aps_setting.cng = strm->setting.cng;1149 aps_setting.loudspk = strm->setting. loudspk;1162 aps_setting.cng = aps_setting.vad; 1163 aps_setting.loudspk = strm->setting.route == PJMEDIA_SND_ROUTE_LOUDSPEAKER; 1150 1164 1151 1165 /* Set audio engine callbacks. */ 1152 if (strm->setting.format. u32== PJMEDIA_FORMAT_L16) {1166 if (strm->setting.format.id == PJMEDIA_FORMAT_L16) { 1153 1167 aps_play_cb = &PlayCbPcm; 1154 1168 aps_rec_cb = &RecCbPcm; … … 1180 1194 strm->rec_buf_len = 0; 1181 1195 1182 if (strm->setting.format. u32== PJMEDIA_FORMAT_G729) {1196 if (strm->setting.format.id == PJMEDIA_FORMAT_G729) { 1183 1197 TBitStream *g729_bitstream = new TBitStream; 1184 1198 … … 1212 1226 1213 1227 pj_bzero(&setting, sizeof(setting)); 1214 setting.format. u32= PJMEDIA_FORMAT_L16;1228 setting.format.id = PJMEDIA_FORMAT_L16; 1215 1229 1216 1230 return sound_open(PJMEDIA_DIR_CAPTURE, clock_rate, channel_count, … … 1234 1248 1235 1249 pj_bzero(&setting, sizeof(setting)); 1236 setting.format. u32= PJMEDIA_FORMAT_L16;1250 setting.format.id = PJMEDIA_FORMAT_L16; 1237 1251 1238 1252 return sound_open(PJMEDIA_DIR_PLAYBACK, clock_rate, channel_count, … … 1259 1273 1260 1274 pj_bzero(&setting, sizeof(setting)); 1261 setting.format. u32= PJMEDIA_FORMAT_L16;1275 setting.format.id = PJMEDIA_FORMAT_L16; 1262 1276 1263 1277 return sound_open(PJMEDIA_DIR_CAPTURE_PLAYBACK, clock_rate, channel_count, … … 1347 1361 stream->engine = NULL; 1348 1362 1349 if (stream->setting.format. u32== PJMEDIA_FORMAT_G729) {1363 if (stream->setting.format.id == PJMEDIA_FORMAT_G729) { 1350 1364 TBitStream *g729_bitstream = (TBitStream*)stream->strm_data; 1351 1365 stream->strm_data = NULL;
Note: See TracChangeset
for help on using the changeset viewer.