- Timestamp:
- Jun 21, 2011 9:33:01 AM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/branches/projects/2.0-dev/pjmedia/src/pjmedia-videodev/ffmpeg_dev.c
r3489 r3592 61 61 pj_pool_factory *pf; 62 62 pj_pool_t *pool; 63 pj_pool_t *dev_pool; 63 64 unsigned dev_count; 64 65 ffmpeg_dev_info dev_info[MAX_DEV_CNT]; … … 79 80 static pj_status_t ffmpeg_factory_init(pjmedia_vid_dev_factory *f); 80 81 static pj_status_t ffmpeg_factory_destroy(pjmedia_vid_dev_factory *f); 82 static pj_status_t ffmpeg_factory_refresh(pjmedia_vid_dev_factory *f); 81 83 static unsigned ffmpeg_factory_get_dev_count(pjmedia_vid_dev_factory *f); 82 84 static pj_status_t ffmpeg_factory_get_dev_info(pjmedia_vid_dev_factory *f, … … 116 118 &ffmpeg_factory_get_dev_info, 117 119 &ffmpeg_factory_default_param, 118 &ffmpeg_factory_create_stream 120 &ffmpeg_factory_create_stream, 121 &ffmpeg_factory_refresh 119 122 }; 120 123 … … 220 223 static pj_status_t ffmpeg_factory_init(pjmedia_vid_dev_factory *f) 221 224 { 225 return ffmpeg_factory_refresh(f); 226 } 227 228 /* API: destroy factory */ 229 static pj_status_t ffmpeg_factory_destroy(pjmedia_vid_dev_factory *f) 230 { 231 ffmpeg_factory *ff = (ffmpeg_factory*)f; 232 pj_pool_t *pool = ff->pool; 233 234 ff->dev_count = 0; 235 ff->pool = NULL; 236 if (ff->dev_pool) 237 pj_pool_release(ff->dev_pool); 238 if (pool) 239 pj_pool_release(pool); 240 241 return PJ_SUCCESS; 242 } 243 244 /* API: refresh the list of devices */ 245 static pj_status_t ffmpeg_factory_refresh(pjmedia_vid_dev_factory *f) 246 { 222 247 ffmpeg_factory *ff = (ffmpeg_factory*)f; 223 248 AVInputFormat *p; … … 227 252 av_log_set_level(AV_LOG_DEBUG); 228 253 254 if (ff->dev_pool) { 255 pj_pool_release(ff->dev_pool); 256 ff->dev_pool = NULL; 257 } 258 229 259 /* TODO: this should enumerate devices, now it enumerates host APIs */ 230 260 ff->dev_count = 0; 261 ff->dev_pool = pj_pool_create(ff->pf, "ffmpeg_cap_dev", 500, 500, NULL); 262 231 263 p = av_iformat_next(NULL); 232 264 while (p) { … … 255 287 info->base.fmt_cnt = 1; 256 288 info->base.fmt = (pjmedia_format*) 257 pj_pool_calloc(ff-> pool, info->base.fmt_cnt,289 pj_pool_calloc(ff->dev_pool, info->base.fmt_cnt, 258 290 sizeof(pjmedia_format)); 259 291 for (i = 0; i < info->base.fmt_cnt; ++i) { … … 271 303 } 272 304 273 /* API: destroy factory */274 static pj_status_t ffmpeg_factory_destroy(pjmedia_vid_dev_factory *f)275 {276 ffmpeg_factory *ff = (ffmpeg_factory*)f;277 278 ff->dev_count = 0;279 280 return PJ_SUCCESS;281 }282 283 305 /* API: get number of devices */ 284 306 static unsigned ffmpeg_factory_get_dev_count(pjmedia_vid_dev_factory *f)
Note: See TracChangeset
for help on using the changeset viewer.