Changeset 2363 for pjproject/trunk
- Timestamp:
- Nov 11, 2008 11:25:13 AM (16 years ago)
- Location:
- pjproject/trunk/pjmedia
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjmedia/include/pjmedia-codec/amr_helper.h
r2359 r2363 613 613 * This structure describes AMR settings. 614 614 */ 615 typedef struct pjmedia_codec_amr_ settings{616 pj_ bool_t amr_nb; /**< TRUE for AMR-NB, FALSEfor AMR-WB. */617 pj_ bool_t reorder;/**< Reorder bitstream into descending615 typedef struct pjmedia_codec_amr_pack_setting { 616 pj_uint8_t amr_nb:1; /**< Set 1 for AMR-NB, 0 for AMR-WB. */ 617 pj_uint8_t reorder:1; /**< Reorder bitstream into descending 618 618 sensitivity order or vice versa. */ 619 pj_uint8_t octet_aligned ; /**< TRUE if payload is in octet-aligned mode,619 pj_uint8_t octet_aligned:1; /**< TRUE if payload is in octet-aligned mode, 620 620 FALSE if payload is in bandwidth 621 621 efficient mode. */ 622 pj_uint8_t CMR; /**< Change Mode Request for remote622 pj_uint8_t cmr:4; /**< Change Mode Request for remote 623 623 encoder. */ 624 } pjmedia_codec_amr_ settings;624 } pjmedia_codec_amr_pack_setting; 625 625 626 626 … … 686 686 * @param amr_nb Set PJ_TRUE for AMR-NB and PJ_FALSE for AMR-WB. 687 687 * @param in Input frame. 688 * @param setting Settings, see @pjmedia_codec_amr_ settings.688 * @param setting Settings, see @pjmedia_codec_amr_pack_setting. 689 689 * @param out Output frame. 690 690 * … … 692 692 */ 693 693 PJ_INLINE(pj_status_t) pjmedia_codec_amr_predecode( 694 695 const pjmedia_codec_amr_settings*setting,696 694 const pjmedia_frame *in, 695 const pjmedia_codec_amr_pack_setting *setting, 696 pjmedia_frame *out) 697 697 { 698 698 pj_int8_t amr_bits[477 + 7] = {0}; … … 758 758 out_info->mode = in_info->frame_type; 759 759 out->size = framelen_tbl[out_info->mode]; 760 PJ_ASSERT_RETURN(out->size <= in->size, PJMEDIA_CODEC_EFRMINLEN);761 760 762 761 pj_bzero(out->buf, out->size); … … 826 825 * @param frames AMR frames to be packed. 827 826 * @param nframes Number of frames to be packed. 828 * @param setting Settings, see @pjmedia_codec_amr_ settings.827 * @param setting Settings, see @pjmedia_codec_amr_pack_setting. 829 828 * @param pkt Payload. 830 829 * @param pkt_size Payload size, as input this specifies payload maximum size, … … 834 833 */ 835 834 PJ_INLINE (pj_status_t) pjmedia_codec_amr_pack( 836 837 838 const pjmedia_codec_amr_settings*setting,839 840 835 const pjmedia_frame frames[], 836 unsigned nframes, 837 const pjmedia_codec_amr_pack_setting *setting, 838 void *pkt, 839 pj_size_t *pkt_size) 841 840 { 842 841 /* Write cursor */ … … 876 875 877 876 /* Code Mode Request, 4 bits */ 878 *w = (pj_uint8_t)(setting-> CMR<< 4);877 *w = (pj_uint8_t)(setting->cmr << 4); 879 878 w_bitptr = 4; 880 879 if (setting->octet_aligned) { … … 1043 1042 * @param pkt_size Payload size. 1044 1043 * @param ts Base timestamp. 1045 * @param setting Settings, see @pjmedia_codec_amr_ settings.1044 * @param setting Settings, see @pjmedia_codec_amr_pack_setting. 1046 1045 * @param frames Frames parsed. 1047 1046 * @param nframes Number of frames parsed. 1048 * @param CMRChange Mode Request message for local encoder.1047 * @param cmr Change Mode Request message for local encoder. 1049 1048 * 1050 1049 * @return PJ_SUCCESS on success. 1051 1050 */ 1052 1051 PJ_INLINE(pj_status_t) pjmedia_codec_amr_parse( 1053 1054 1055 1056 const pjmedia_codec_amr_settings* setting,1057 1058 1059 pj_uint8_t *CMR)1052 void *pkt, 1053 pj_size_t pkt_size, 1054 const pj_timestamp *ts, 1055 const pjmedia_codec_amr_pack_setting* setting, 1056 pjmedia_frame frames[], 1057 unsigned *nframes, 1058 pj_uint8_t *cmr) 1060 1059 { 1061 1060 unsigned cnt = 0; … … 1090 1089 1091 1090 /* Code Mode Request, 4 bits */ 1092 * CMR= (pj_uint8_t)((*r >> 4) & 0x0F);1091 *cmr = (pj_uint8_t)((*r >> 4) & 0x0F); 1093 1092 r_bitptr = 4; 1094 1093 if (setting->octet_aligned) { -
pjproject/trunk/pjmedia/src/pjmedia-codec/ipp_codecs.c
r2359 r2363 230 230 5900, 12200, 4, 1, 1, 231 231 &predecode_amr, &parse_amr, &pack_amr 232 /*, {1, {{{"octet-align", 11}, {"1", 1}}} } */ 232 233 }, 233 234 # endif … … 424 425 425 426 typedef struct amr_settings_t { 426 pjmedia_codec_amr_ settingsenc_setting;427 pjmedia_codec_amr_ settingsdec_setting;427 pjmedia_codec_amr_pack_setting enc_setting; 428 pjmedia_codec_amr_pack_setting dec_setting; 428 429 pj_int8_t enc_mode; 429 430 } amr_settings_t; … … 442 443 pjmedia_frame frame; 443 444 pjmedia_codec_amr_bit_info *info; 444 pjmedia_codec_amr_ settings*setting;445 pjmedia_codec_amr_pack_setting *setting; 445 446 446 447 setting = &((amr_settings_t*)codec_data->codec_setting)->dec_setting; … … 492 493 pj_uint8_t *r; /* Read cursor */ 493 494 pj_uint8_t SID_FT; 494 pjmedia_codec_amr_ settings*setting;495 pjmedia_codec_amr_pack_setting *setting; 495 496 496 497 setting = &((amr_settings_t*)codec_data->codec_setting)->enc_setting; … … 540 541 { 541 542 amr_settings_t* s = (amr_settings_t*)codec_data->codec_setting; 542 pjmedia_codec_amr_ settings*setting;543 pjmedia_codec_amr_pack_setting *setting; 543 544 pj_status_t status; 544 pj_uint8_t CMR;545 pj_uint8_t cmr; 545 546 546 547 setting = &s->dec_setting; 547 548 548 549 status = pjmedia_codec_amr_parse(pkt, pkt_size, ts, setting, frames, 549 frame_cnt, & CMR);550 frame_cnt, &cmr); 550 551 if (status != PJ_SUCCESS) 551 552 return status; 552 553 553 554 /* Check Change Mode Request. */ 554 if ((setting->amr_nb && CMR <= 7) || (!setting->amr_nb && CMR<= 8)) {555 s->enc_mode = CMR;555 if ((setting->amr_nb && cmr <= 7) || (!setting->amr_nb && cmr <= 8)) { 556 s->enc_mode = cmr; 556 557 } 557 558 … … 1024 1025 if (ippc->pt == PJMEDIA_RTP_PT_AMR || ippc->pt == PJMEDIA_RTP_PT_AMRWB) { 1025 1026 amr_settings_t *s; 1027 pj_uint8_t octet_align = 0; 1028 const pj_str_t STR_FMTP_OCTET_ALIGN = {"octet-align", 11}; 1029 1030 /* Check octet-align */ 1031 for (i = 0; i < attr->setting.dec_fmtp.cnt; ++i) { 1032 if (pj_stricmp(&attr->setting.dec_fmtp.param[i].name, 1033 &STR_FMTP_OCTET_ALIGN) == 0) 1034 { 1035 octet_align=(pj_uint8_t) 1036 (pj_strtoul(&attr->setting.dec_fmtp.param[i].val)); 1037 break; 1038 } 1039 } 1026 1040 1027 1041 s = PJ_POOL_ZALLOC_T(pool, amr_settings_t); … … 1033 1047 1034 1048 s->enc_setting.amr_nb = ippc->pt == PJMEDIA_RTP_PT_AMR; 1035 s->enc_setting.octet_aligned = 0;1049 s->enc_setting.octet_aligned = octet_align; 1036 1050 s->enc_setting.reorder = PJ_TRUE; 1037 s->enc_setting. CMR= 15;1051 s->enc_setting.cmr = 15; 1038 1052 1039 1053 s->dec_setting.amr_nb = ippc->pt == PJMEDIA_RTP_PT_AMR; 1040 s->dec_setting.octet_aligned = 0;1054 s->dec_setting.octet_aligned = octet_align; 1041 1055 s->dec_setting.reorder = PJ_TRUE; 1042 1056 }
Note: See TracChangeset
for help on using the changeset viewer.