Changeset 3593
- Timestamp:
- Jun 21, 2011 10:23:53 AM (13 years ago)
- Location:
- pjproject/branches/projects/2.0-dev/pjmedia/src/pjmedia-videodev
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/branches/projects/2.0-dev/pjmedia/src/pjmedia-videodev/ios_dev.m
r3581 r3593 102 102 static pj_status_t ios_factory_init(pjmedia_vid_dev_factory *f); 103 103 static pj_status_t ios_factory_destroy(pjmedia_vid_dev_factory *f); 104 static pj_status_t ios_factory_refresh(pjmedia_vid_dev_factory *f); 104 105 static unsigned ios_factory_get_dev_count(pjmedia_vid_dev_factory *f); 105 106 static pj_status_t ios_factory_get_dev_info(pjmedia_vid_dev_factory *f, … … 139 140 &ios_factory_get_dev_info, 140 141 &ios_factory_default_param, 141 &ios_factory_create_stream 142 &ios_factory_create_stream, 143 &ios_factory_refresh 142 144 }; 143 145 … … 239 241 pj_pool_release(pool); 240 242 243 return PJ_SUCCESS; 244 } 245 246 /* API: refresh the list of devices */ 247 static pj_status_t ios_factory_refresh(pjmedia_vid_dev_factory *f) 248 { 249 PJ_UNUSED_ARG(f); 241 250 return PJ_SUCCESS; 242 251 } -
pjproject/branches/projects/2.0-dev/pjmedia/src/pjmedia-videodev/qt_dev.m
r3581 r3593 59 59 pjmedia_vid_dev_factory base; 60 60 pj_pool_t *pool; 61 pj_pool_t *dev_pool; 61 62 pj_pool_factory *pf; 62 63 … … 101 102 static pj_status_t qt_factory_init(pjmedia_vid_dev_factory *f); 102 103 static pj_status_t qt_factory_destroy(pjmedia_vid_dev_factory *f); 104 static pj_status_t qt_factory_refresh(pjmedia_vid_dev_factory *f); 103 105 static unsigned qt_factory_get_dev_count(pjmedia_vid_dev_factory *f); 104 106 static pj_status_t qt_factory_get_dev_info(pjmedia_vid_dev_factory *f, … … 136 138 &qt_factory_get_dev_info, 137 139 &qt_factory_default_param, 138 &qt_factory_create_stream 140 &qt_factory_create_stream, 141 &qt_factory_refresh 139 142 }; 140 143 … … 176 179 static pj_status_t qt_factory_init(pjmedia_vid_dev_factory *f) 177 180 { 181 return qt_factory_refresh(f); 182 } 183 184 /* API: destroy factory */ 185 static pj_status_t qt_factory_destroy(pjmedia_vid_dev_factory *f) 186 { 187 struct qt_factory *qf = (struct qt_factory*)f; 188 pj_pool_t *pool = qf->pool; 189 190 if (qf->dev_pool) 191 pj_pool_release(qf->dev_pool); 192 qf->pool = NULL; 193 if (pool) 194 pj_pool_release(pool); 195 196 return PJ_SUCCESS; 197 } 198 199 /* API: refresh the list of devices */ 200 static pj_status_t qt_factory_refresh(pjmedia_vid_dev_factory *f) 201 { 178 202 struct qt_factory *qf = (struct qt_factory*)f; 179 203 struct qt_dev_info *qdi; … … 181 205 NSAutoreleasePool *apool = [[NSAutoreleasePool alloc]init]; 182 206 NSArray *dev_array; 183 207 208 if (qf->dev_pool) { 209 pj_pool_release(qf->dev_pool); 210 qf->dev_pool = NULL; 211 } 212 184 213 dev_array = [QTCaptureDevice inputDevices]; 185 214 for (i = 0; i < [dev_array count]; i++) { … … 194 223 /* Initialize input and output devices here */ 195 224 qf->dev_count = 0; 225 qf->dev_pool = pj_pool_create(qf->pf, "qt video", 500, 500, NULL); 226 196 227 qf->dev_info = (struct qt_dev_info*) 197 pj_pool_calloc(qf->pool, dev_count,198 228 pj_pool_calloc(qf->dev_pool, dev_count, 229 sizeof(struct qt_dev_info)); 199 230 for (i = 0; i < [dev_array count]; i++) { 200 231 QTCaptureDevice *dev = [dev_array objectAtIndex:i]; … … 207 238 pj_bzero(qdi, sizeof(*qdi)); 208 239 [[dev localizedDisplayName] getCString:qdi->info.name 209 210 211 240 maxLength:sizeof(qdi->info.name) 241 encoding: 242 [NSString defaultCStringEncoding]]; 212 243 [[dev uniqueID] getCString:qdi->dev_id 213 214 244 maxLength:sizeof(qdi->dev_id) 245 encoding:[NSString defaultCStringEncoding]]; 215 246 strcpy(qdi->info.driver, "QT"); 216 247 qdi->info.dir = PJMEDIA_DIR_CAPTURE; 217 248 qdi->info.has_callback = PJ_TRUE; 218 249 219 250 qdi->info.fmt_cnt = 0; 220 251 for (k = 0; k < [[dev formatDescriptions] count]; k++) { … … 231 262 qdi->info.caps = PJMEDIA_VID_DEV_CAP_FORMAT; 232 263 qdi->info.fmt = (pjmedia_format*) 233 pj_pool_calloc(qf->pool, qdi->info.fmt_cnt,234 264 pj_pool_calloc(qf->dev_pool, qdi->info.fmt_cnt, 265 sizeof(pjmedia_format)); 235 266 for (j = k = 0; k < [[dev formatDescriptions] count]; k++) { 236 267 unsigned l; … … 249 280 } 250 281 } 251 282 252 283 PJ_LOG(4, (THIS_FILE, " dev_id %d: %s", i, qdi->info.name)); 253 284 } 254 285 } 255 286 256 287 [apool release]; 257 288 258 PJ_LOG(4, (THIS_FILE, "qt video initialized with%d devices",289 PJ_LOG(4, (THIS_FILE, "qt video has %d devices", 259 290 qf->dev_count)); 260 291 261 return PJ_SUCCESS;262 }263 264 /* API: destroy factory */265 static pj_status_t qt_factory_destroy(pjmedia_vid_dev_factory *f)266 {267 struct qt_factory *qf = (struct qt_factory*)f;268 pj_pool_t *pool = qf->pool;269 270 qf->pool = NULL;271 pj_pool_release(pool);272 273 292 return PJ_SUCCESS; 274 293 } … … 384 403 PJ_ASSERT_RETURN(param->fmt.type == PJMEDIA_TYPE_VIDEO && 385 404 param->fmt.detail_type == PJMEDIA_FORMAT_DETAIL_VIDEO && 386 param->dir == PJMEDIA_DIR_ RENDER,405 param->dir == PJMEDIA_DIR_CAPTURE, 387 406 PJ_EINVAL); 388 407
Note: See TracChangeset
for help on using the changeset viewer.