Changeset 4016 for pjproject/trunk/pjmedia/src/pjmedia-videodev/videodev.c
- Timestamp:
- Apr 4, 2012 5:05:50 AM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjmedia/src/pjmedia-videodev/videodev.c
r3893 r4016 408 408 /* API: register a video device factory to the video device subsystem. */ 409 409 PJ_DEF(pj_status_t) 410 pjmedia_vid_register_factory(pjmedia_vid_dev_factory_create_func_ptr adf) 411 { 410 pjmedia_vid_register_factory(pjmedia_vid_dev_factory_create_func_ptr adf, 411 pjmedia_vid_dev_factory *factory) 412 { 413 pj_bool_t refresh = PJ_FALSE; 412 414 pj_status_t status; 413 415 … … 416 418 417 419 vid_subsys.drv[vid_subsys.drv_cnt].create = adf; 418 status = init_driver(vid_subsys.drv_cnt, PJ_FALSE); 420 vid_subsys.drv[vid_subsys.drv_cnt].f = factory; 421 422 if (factory) { 423 /* Call factory->init() */ 424 status = factory->op->init(factory); 425 if (status != PJ_SUCCESS) { 426 factory->op->destroy(factory); 427 return status; 428 } 429 refresh = PJ_TRUE; 430 } 431 432 status = init_driver(vid_subsys.drv_cnt, refresh); 419 433 if (status == PJ_SUCCESS) { 420 434 vid_subsys.drv_cnt++; … … 428 442 /* API: unregister a video device factory from the video device subsystem. */ 429 443 PJ_DEF(pj_status_t) 430 pjmedia_vid_unregister_factory(pjmedia_vid_dev_factory_create_func_ptr adf) 444 pjmedia_vid_unregister_factory(pjmedia_vid_dev_factory_create_func_ptr adf, 445 pjmedia_vid_dev_factory *factory) 431 446 { 432 447 unsigned i, j; … … 438 453 struct driver *drv = &vid_subsys.drv[i]; 439 454 440 if ( drv->create == adf) {455 if ((factory && drv->f==factory) || (adf && drv->create == adf)) { 441 456 for (j = drv->start_idx; j < drv->start_idx + drv->dev_cnt; j++) 442 457 { … … 579 594 } 580 595 596 /* API: lookup device id */ 597 PJ_DEF(pj_status_t) 598 pjmedia_vid_dev_get_local_index(pjmedia_vid_dev_index id, 599 pjmedia_vid_dev_factory **p_f, 600 unsigned *p_local_index) 601 { 602 return lookup_dev(id, p_f, p_local_index); 603 } 604 605 /* API: from factory and local index, get global index */ 606 PJ_DEF(pj_status_t) 607 pjmedia_vid_dev_get_global_index(const pjmedia_vid_dev_factory *f, 608 unsigned local_idx, 609 pjmedia_vid_dev_index *pid) 610 { 611 PJ_ASSERT_RETURN(f->sys.drv_idx >= 0 && f->sys.drv_idx < MAX_DRIVERS, 612 PJ_EINVALIDOP); 613 *pid = local_idx; 614 return make_global_index(f->sys.drv_idx, pid); 615 } 616 581 617 /* API: Get device information. */ 582 618 PJ_DEF(pj_status_t) pjmedia_vid_dev_get_info(pjmedia_vid_dev_index id,
Note: See TracChangeset
for help on using the changeset viewer.