Changeset 3664 for pjproject/trunk/pjsip-apps/src/samples/encdec.c
- Timestamp:
- Jul 19, 2011 3:42:28 AM (13 years ago)
- Location:
- pjproject/trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk
- Property svn:mergeinfo changed
-
pjproject/trunk/pjsip-apps/src/samples/encdec.c
r3553 r3664 138 138 /* Alloc codec */ 139 139 CHECK( pjmedia_codec_mgr_alloc_codec(cm, pci, &codec) ); 140 CHECK( codec->op->init(codec, pool) );141 CHECK( codec->op->open(codec, ¶m) );140 CHECK( pjmedia_codec_init(codec, pool) ); 141 CHECK( pjmedia_codec_open(codec, ¶m) ); 142 142 143 143 for (;;) { … … 163 163 frm_bit.buf = bitstream; 164 164 frm_bit.size = sizeof(bitstream); 165 CHECK(codec->op->encode(codec, &frm_pcm, sizeof(bitstream), &frm_bit)); 165 CHECK(pjmedia_codec_encode(codec, &frm_pcm, sizeof(bitstream), 166 &frm_bit)); 166 167 167 168 /* On DTX, write zero frame to wavout to maintain duration */ … … 181 182 ts.u64 = 0; 182 183 cnt = PJ_ARRAY_SIZE(frames); 183 CHECK( codec->op->parse(codec, bitstream, frm_bit.size, &ts, &cnt,184 frames) );184 CHECK( pjmedia_codec_parse(codec, bitstream, frm_bit.size, &ts, &cnt, 185 frames) ); 185 186 CHECK( (cnt==1 ? PJ_SUCCESS : -1) ); 186 187 … … 191 192 if ((pj_rand() % 100) < (int)lost_pct) { 192 193 /* Simulate loss */ 193 CHECK( codec->op->recover(codec, sizeof(pcmbuf), &out_frm) );194 CHECK( pjmedia_codec_recover(codec, sizeof(pcmbuf), &out_frm) ); 194 195 TRACE_((THIS_FILE, "%d.%03d Packet lost", T)); 195 196 } else { 196 197 /* Decode */ 197 CHECK( codec->op->decode(codec, &frames[0], sizeof(pcmbuf),198 CHECK( pjmedia_codec_decode(codec, &frames[0], sizeof(pcmbuf), 198 199 &out_frm) ); 199 200 } … … 211 212 212 213 /* Close codec */ 213 codec->op->close(codec);214 pjmedia_codec_close(codec); 214 215 pjmedia_codec_mgr_dealloc_codec(cm, codec); 215 216 … … 239 240 240 241 /* Register all codecs */ 241 #if PJMEDIA_HAS_G711_CODEC 242 CHECK( pjmedia_codec_g711_init(mept) ); 243 #endif 244 #if PJMEDIA_HAS_GSM_CODEC 245 CHECK( pjmedia_codec_gsm_init(mept) ); 246 #endif 247 #if PJMEDIA_HAS_ILBC_CODEC 248 CHECK( pjmedia_codec_ilbc_init(mept, 30) ); 249 #endif 250 #if PJMEDIA_HAS_SPEEX_CODEC 251 CHECK( pjmedia_codec_speex_init(mept, 0, 5, 5) ); 252 #endif 253 #if PJMEDIA_HAS_G722_CODEC 254 CHECK( pjmedia_codec_g722_init(mept) ); 255 #endif 242 CHECK( pjmedia_codec_register_audio_codecs(mept, NULL) ); 256 243 257 244 pj_gettimeofday(&t0);
Note: See TracChangeset
for help on using the changeset viewer.