- Timestamp:
- Jul 12, 2011 3:05:35 AM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/branches/projects/2.0-dev/pjmedia/src/pjmedia/vid_port.c
r3615 r3617 21 21 #include <pjmedia/converter.h> 22 22 #include <pjmedia/errno.h> 23 #include <pjmedia/event.h> 23 24 #include <pjmedia/vid_codec.h> 24 25 #include <pj/log.h> … … 56 57 pjmedia_conversion_param conv_param; 57 58 59 pjmedia_event_publisher epub; 60 pjmedia_event_subscription esub_dev; 61 58 62 pjmedia_clock *clock; 59 60 63 pjmedia_clock_src clocksrc; 61 64 … … 86 89 void *user_data, 87 90 pjmedia_frame *frame); 88 static pj_status_t vidstream_event_cb(pjmedia_vid_dev_stream *stream, 89 void *user_data, 90 pjmedia_vid_event *event); 91 static pj_status_t vidstream_event_cb(pjmedia_event_subscription *esub, 92 pjmedia_event *event); 91 93 92 94 static void enc_clock_cb(const pj_timestamp *ts, void *user_data); … … 152 154 vp->dir = prm->vidparam.dir; 153 155 // vp->cap_size = vfd->size; 156 pjmedia_event_publisher_init(&vp->epub); 154 157 155 158 vparam = prm->vidparam; … … 203 206 vid_cb.capture_cb = &vidstream_cap_cb; 204 207 vid_cb.render_cb = &vidstream_render_cb; 205 vid_cb.on_event_cb = &vidstream_event_cb;206 208 207 209 status = pjmedia_vid_dev_stream_create(&vparam, &vid_cb, vp, … … 216 218 vparam.fmt.det.vid.size.w, vparam.fmt.det.vid.size.h, 217 219 vparam.fmt.det.vid.fps.num, vparam.fmt.det.vid.fps.denum)); 220 221 /* Subscribe to device's events */ 222 pjmedia_event_subscription_init(&vp->esub_dev, vidstream_event_cb, vp); 223 pjmedia_event_subscribe( 224 pjmedia_vid_dev_stream_get_event_publisher(vp->strm), 225 &vp->esub_dev); 218 226 219 227 if (vp->dir & PJMEDIA_DIR_CAPTURE) { … … 339 347 } 340 348 349 PJ_DEF(pjmedia_event_publisher*) 350 pjmedia_vid_port_get_event_publisher(pjmedia_vid_port *vid_port) 351 { 352 PJ_ASSERT_RETURN(vid_port, NULL); 353 return &vid_port->epub; 354 } 355 341 356 PJ_DEF(pjmedia_vid_dev_stream*) 342 357 pjmedia_vid_port_get_stream(pjmedia_vid_port *vp) … … 498 513 */ 499 514 500 static pj_status_t vidstream_event_cb(pjmedia_vid_dev_stream *stream, 501 void *user_data, 502 pjmedia_vid_event *event) 503 { 504 pjmedia_vid_port *vp = (pjmedia_vid_port*)user_data; 515 static pj_status_t vidstream_event_cb(pjmedia_event_subscription *esub, 516 pjmedia_event *event) 517 { 518 pjmedia_vid_port *vp = (pjmedia_vid_port*)esub->user_data; 505 519 506 if (vp->strm_cb.on_event_cb) 507 return (*vp->strm_cb.on_event_cb)(stream, vp->strm_cb_data, event); 508 return PJ_SUCCESS; 520 /* Just republish the event to our client */ 521 return pjmedia_event_publish(&vp->epub, event); 509 522 } 510 523 … … 530 543 if (frame->bit_info & PJMEDIA_VID_CODEC_EVENT_FMT_CHANGED) { 531 544 const pjmedia_video_format_detail *vfd; 532 pjmedia_ vid_event pevent;545 pjmedia_event pevent; 533 546 pj_status_t status; 534 547 … … 593 606 594 607 /* Notify application of the format change. */ 595 p event.event_type = PJMEDIA_EVENT_FMT_CHANGED;596 pjmedia_format_copy(&pevent. event_desc.fmt_change.new_format,608 pjmedia_event_init(&pevent, PJMEDIA_EVENT_FMT_CHANGED, NULL, &vp->epub); 609 pjmedia_format_copy(&pevent.data.fmt_changed.new_fmt, 597 610 &vp->client_port->info.fmt); 598 if (vp->strm_cb.on_event_cb) 599 (*vp->strm_cb.on_event_cb)(vp->strm, vp->strm_cb_data, &pevent); 611 pjmedia_event_publish(&vp->epub, &pevent); 600 612 601 613 pjmedia_vid_port_start(vp);
Note: See TracChangeset
for help on using the changeset viewer.