Index: pjproject/branches/projects/2.0-dev/pjmedia/src/pjmedia-videodev/ffmpeg_dev.c
===================================================================
--- pjproject/branches/projects/2.0-dev/pjmedia/src/pjmedia-videodev/ffmpeg_dev.c	(revision 3392)
+++ pjproject/branches/projects/2.0-dev/pjmedia/src/pjmedia-videodev/ffmpeg_dev.c	(revision 3420)
@@ -68,5 +68,5 @@
 typedef struct ffmpeg_stream
 {
-    pjmedia_vid_stream           base;
+    pjmedia_vid_dev_stream       base;
     ffmpeg_factory              *factory;
     pj_pool_t                   *pool;
@@ -81,29 +81,30 @@
 static unsigned    ffmpeg_factory_get_dev_count(pjmedia_vid_dev_factory *f);
 static pj_status_t ffmpeg_factory_get_dev_info(pjmedia_vid_dev_factory *f,
-					      unsigned index,
-					      pjmedia_vid_dev_info *info);
+					       unsigned index,
+					       pjmedia_vid_dev_info *info);
 static pj_status_t ffmpeg_factory_default_param(pj_pool_t *pool,
                                                 pjmedia_vid_dev_factory *f,
 					        unsigned index,
 					        pjmedia_vid_param *param);
-static pj_status_t ffmpeg_factory_create_stream(pjmedia_vid_dev_factory *f,
-					       const pjmedia_vid_param *param,
-					       const pjmedia_vid_cb *cb,
-					       void *user_data,
-					       pjmedia_vid_stream **p_vid_strm);
-
-static pj_status_t ffmpeg_stream_get_param(pjmedia_vid_stream *strm,
-					  pjmedia_vid_param *param);
-static pj_status_t ffmpeg_stream_get_cap(pjmedia_vid_stream *strm,
-				        pjmedia_vid_dev_cap cap,
-				        void *value);
-static pj_status_t ffmpeg_stream_set_cap(pjmedia_vid_stream *strm,
-				        pjmedia_vid_dev_cap cap,
-				        const void *value);
-static pj_status_t ffmpeg_stream_start(pjmedia_vid_stream *strm);
-static pj_status_t ffmpeg_stream_get_frame(pjmedia_vid_stream *s,
+static pj_status_t ffmpeg_factory_create_stream(
+					pjmedia_vid_dev_factory *f,
+					const pjmedia_vid_param *param,
+					const pjmedia_vid_cb *cb,
+					void *user_data,
+					pjmedia_vid_dev_stream **p_vid_strm);
+
+static pj_status_t ffmpeg_stream_get_param(pjmedia_vid_dev_stream *strm,
+					   pjmedia_vid_param *param);
+static pj_status_t ffmpeg_stream_get_cap(pjmedia_vid_dev_stream *strm,
+				         pjmedia_vid_dev_cap cap,
+				         void *value);
+static pj_status_t ffmpeg_stream_set_cap(pjmedia_vid_dev_stream *strm,
+				         pjmedia_vid_dev_cap cap,
+				         const void *value);
+static pj_status_t ffmpeg_stream_start(pjmedia_vid_dev_stream *strm);
+static pj_status_t ffmpeg_stream_get_frame(pjmedia_vid_dev_stream *s,
                                            pjmedia_frame *frame);
-static pj_status_t ffmpeg_stream_stop(pjmedia_vid_stream *strm);
-static pj_status_t ffmpeg_stream_destroy(pjmedia_vid_stream *strm);
+static pj_status_t ffmpeg_stream_stop(pjmedia_vid_dev_stream *strm);
+static pj_status_t ffmpeg_stream_destroy(pjmedia_vid_dev_stream *strm);
 
 /* Operations */
@@ -118,5 +119,5 @@
 };
 
-static pjmedia_vid_stream_op stream_op =
+static pjmedia_vid_dev_stream_op stream_op =
 {
     &ffmpeg_stream_get_param,
@@ -153,5 +154,5 @@
 {
     AVFormatParameters fp;
-    pjmedia_video_format_detail *fmt_detail;
+    pjmedia_video_format_detail *vfd;
     int err;
 
@@ -160,5 +161,5 @@
                      PJ_EINVAL);
 
-    fmt_detail = (pjmedia_video_format_detail*)param->fmt.detail;
+    vfd = pjmedia_format_get_video_format_detail(&param->fmt, PJ_TRUE);
 
     /* Init ffmpeg format context */
@@ -168,9 +169,9 @@
     pj_bzero(&fp, sizeof(fp));
     fp.prealloced_context = 1;
-    fp.width = fmt_detail->size.w;
-    fp.height = fmt_detail->size.h;
+    fp.width = vfd->size.w;
+    fp.height = vfd->size.h;
     fp.pix_fmt = PIX_FMT_BGR24;
-    fp.time_base.num = param->frame_rate.denum;
-    fp.time_base.den = param->frame_rate.num;
+    fp.time_base.num = vfd->fps.denum;
+    fp.time_base.den = vfd->fps.num;
 
     /* Open capture stream */
@@ -289,6 +290,6 @@
 /* API: get device info */
 static pj_status_t ffmpeg_factory_get_dev_info(pjmedia_vid_dev_factory *f,
-					      unsigned index,
-					      pjmedia_vid_dev_info *info)
+					       unsigned index,
+					       pjmedia_vid_dev_info *info)
 {
     ffmpeg_factory *ff = (ffmpeg_factory*)f;
@@ -309,7 +310,9 @@
     ffmpeg_factory *ff = (ffmpeg_factory*)f;
     ffmpeg_dev_info *info;
-    pjmedia_video_format_detail *fmt_detail;
 
     PJ_ASSERT_RETURN(index < ff->dev_count, PJMEDIA_EVID_INVDEV);
+
+    PJ_UNUSED_ARG(pool);
+
     info = &ff->dev_info[index];
 
@@ -322,11 +325,7 @@
     /* Set the device capabilities here */
     param->flags = PJMEDIA_VID_DEV_CAP_FORMAT;
-    pj_memcpy(&param->fmt, &info->base.fmt[0], sizeof(param->fmt));
     param->clock_rate = 90000;
-    pjmedia_format_init_video(pool, &param->fmt, 320, 240, 25, 1,
-                              0, 0);
-    fmt_detail = (pjmedia_video_format_detail*)param->fmt.detail;
-    param->frame_rate.num = fmt_detail->fps.num;
-    param->frame_rate.denum = fmt_detail->fps.denum;
+    pjmedia_format_init_video(&param->fmt, 0, 320, 240, 25, 1);
+    param->fmt.id = info->base.fmt[0].id;
 
     return PJ_SUCCESS;
@@ -336,9 +335,10 @@
 
 /* API: create stream */
-static pj_status_t ffmpeg_factory_create_stream(pjmedia_vid_dev_factory *f,
-					       const pjmedia_vid_param *param,
-					       const pjmedia_vid_cb *cb,
-					       void *user_data,
-					       pjmedia_vid_stream **p_vid_strm)
+static pj_status_t ffmpeg_factory_create_stream(
+					pjmedia_vid_dev_factory *f,
+					const pjmedia_vid_param *param,
+					const pjmedia_vid_cb *cb,
+					void *user_data,
+					pjmedia_vid_dev_stream **p_vid_strm)
 {
     ffmpeg_factory *ff = (ffmpeg_factory*)f;
@@ -349,6 +349,6 @@
     PJ_ASSERT_RETURN(param->dir == PJMEDIA_DIR_CAPTURE, PJ_EINVAL);
     PJ_ASSERT_RETURN((unsigned)param->cap_id < ff->dev_count, PJ_EINVAL);
-    PJ_ASSERT_RETURN(param->fmt.detail_type == PJMEDIA_FORMAT_DETAIL_VIDEO &&
-                     param->fmt.detail, PJ_EINVAL);
+    PJ_ASSERT_RETURN(param->fmt.detail_type == PJMEDIA_FORMAT_DETAIL_VIDEO,
+		     PJ_EINVAL);
 
     PJ_UNUSED_ARG(cb);
@@ -372,5 +372,5 @@
 
 /* API: Get stream info. */
-static pj_status_t ffmpeg_stream_get_param(pjmedia_vid_stream *s,
+static pj_status_t ffmpeg_stream_get_param(pjmedia_vid_dev_stream *s,
 					   pjmedia_vid_param *pi)
 {
@@ -385,7 +385,7 @@
 
 /* API: get capability */
-static pj_status_t ffmpeg_stream_get_cap(pjmedia_vid_stream *s,
-				        pjmedia_vid_dev_cap cap,
-				        void *pval)
+static pj_status_t ffmpeg_stream_get_cap(pjmedia_vid_dev_stream *s,
+				         pjmedia_vid_dev_cap cap,
+				         void *pval)
 {
     ffmpeg_stream *strm = (ffmpeg_stream*)s;
@@ -399,7 +399,7 @@
 
 /* API: set capability */
-static pj_status_t ffmpeg_stream_set_cap(pjmedia_vid_stream *s,
-				        pjmedia_vid_dev_cap cap,
-				        const void *pval)
+static pj_status_t ffmpeg_stream_set_cap(pjmedia_vid_dev_stream *s,
+				         pjmedia_vid_dev_cap cap,
+				         const void *pval)
 {
     ffmpeg_stream *strm = (ffmpeg_stream*)s;
@@ -414,5 +414,5 @@
 
 /* API: Start stream. */
-static pj_status_t ffmpeg_stream_start(pjmedia_vid_stream *s)
+static pj_status_t ffmpeg_stream_start(pjmedia_vid_dev_stream *s)
 {
     ffmpeg_stream *strm = (ffmpeg_stream*)s;
@@ -436,5 +436,5 @@
 
 /* API: Get frame from stream */
-static pj_status_t ffmpeg_stream_get_frame(pjmedia_vid_stream *s,
+static pj_status_t ffmpeg_stream_get_frame(pjmedia_vid_dev_stream *s,
                                            pjmedia_frame *frame)
 {
@@ -459,5 +459,5 @@
 
 /* API: Stop stream. */
-static pj_status_t ffmpeg_stream_stop(pjmedia_vid_stream *s)
+static pj_status_t ffmpeg_stream_stop(pjmedia_vid_dev_stream *s)
 {
     ffmpeg_stream *strm = (ffmpeg_stream*)s;
@@ -473,5 +473,5 @@
 
 /* API: Destroy stream. */
-static pj_status_t ffmpeg_stream_destroy(pjmedia_vid_stream *s)
+static pj_status_t ffmpeg_stream_destroy(pjmedia_vid_dev_stream *s)
 {
     ffmpeg_stream *strm = (ffmpeg_stream*)s;
