- Timestamp:
- Jul 12, 2011 9:08:56 AM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/branches/projects/2.0-dev/pjmedia/src/test/vid_codec_test.c
r3579 r3622 29 29 } codec_port_data_t; 30 30 31 static pj_status_t codec_on_event(pjmedia_event_subscription *esub, 32 pjmedia_event *event) 33 { 34 codec_port_data_t *port_data = (codec_port_data_t*)esub->user_data; 35 36 if (event->type == PJMEDIA_EVENT_FMT_CHANGED) { 37 pjmedia_vid_codec *codec = port_data->codec; 38 pjmedia_vid_codec_param codec_param; 39 pj_status_t status; 40 41 ++event->proc_cnt; 42 43 status = codec->op->get_param(codec, &codec_param); 44 if (status != PJ_SUCCESS) 45 return status; 46 47 status = pjmedia_vid_dev_stream_set_cap( 48 pjmedia_vid_port_get_stream(port_data->rdr_port), 49 PJMEDIA_VID_DEV_CAP_FORMAT, 50 &codec_param.dec_fmt); 51 if (status != PJ_SUCCESS) 52 return status; 53 } 54 55 return PJ_SUCCESS; 56 } 57 31 58 static pj_status_t codec_put_frame(pjmedia_port *port, 32 59 pjmedia_frame *frame) … … 48 75 #if !BYPASS_PACKETIZER 49 76 if (enc_frame.size) { 50 unsigned pos = 0 , i = 0;77 unsigned pos = 0; 51 78 pj_bool_t packetized = PJ_FALSE; 52 79 unsigned unpack_pos = 0; … … 59 86 (pj_uint8_t*)enc_frame.buf, 60 87 enc_frame.size, &pos, 61 &payload, &payload_len); 88 (const pj_uint8_t**)&payload, 89 &payload_len); 62 90 if (status == PJ_ENOTSUP) 63 91 break; … … 87 115 status = codec->op->decode(codec, &enc_frame, frame->size, frame); 88 116 if (status != PJ_SUCCESS) goto on_error; 89 90 /* Detect format change */91 if (frame->bit_info & PJMEDIA_VID_CODEC_EVENT_FMT_CHANGED) {92 pjmedia_vid_codec_param codec_param;93 94 status = codec->op->get_param(codec, &codec_param);95 if (status != PJ_SUCCESS) goto on_error;96 97 status = pjmedia_vid_dev_stream_set_cap(98 pjmedia_vid_port_get_stream(port_data->rdr_port),99 PJMEDIA_VID_DEV_CAP_FORMAT,100 &codec_param.dec_fmt);101 if (status != PJ_SUCCESS) goto on_error;102 }103 117 } 104 118 #endif … … 170 184 pjmedia_vid_port_param vport_param; 171 185 pjmedia_video_format_detail *vfd; 186 pjmedia_event_subscription esub; 172 187 pj_status_t status; 173 188 int rc = 0; … … 277 292 codec_param.dec_fmt.det = codec_param.enc_fmt.det; 278 293 294 /* Subscribe to codec events */ 295 pjmedia_event_subscription_init(&esub, &codec_on_event, 296 &codec_port_data); 297 pjmedia_event_subscribe(&codec->epub, &esub); 279 298 #endif /* !BYPASS_CODEC */ 280 299 } 281 282 300 283 301 pjmedia_vid_port_param_default(&vport_param);
Note: See TracChangeset
for help on using the changeset viewer.