[MPlayer-cvslog] r24423 - in trunk: DOCS/man/en/mplayer.1 help/help_mp-en.h stream/stream_tv.c stream/tv.c

voroshil subversion at mplayerhq.hu
Mon Sep 10 19:09:36 CEST 2007


Author: voroshil
Date: Mon Sep 10 19:09:35 2007
New Revision: 24423

Log:
Implementation of tv:// driver autodetection.
If user did not specify driver directly, all available
drivers will be probed (in order: v4l2,v4l1,bsdbt848,dummy).
In most cases first probed driver will be successfully autodetected
and used.
Autodetection will be disabled if user specified driver directly (in
command line or config).


Modified:
   trunk/stream/stream_tv.c
   trunk/stream/tv.c

Changes in other areas also in this revision:
Modified:
   trunk/DOCS/man/en/mplayer.1
   trunk/help/help_mp-en.h

Modified: trunk/stream/stream_tv.c
==============================================================================
--- trunk/stream/stream_tv.c	(original)
+++ trunk/stream/stream_tv.c	Mon Sep 10 19:09:35 2007
@@ -40,7 +40,7 @@ tv_param_t stream_tv_defaults = {
     -1,            //normid
 #endif
     NULL,          //device
-    "dummy",       //driver
+    NULL,          //driver
     -1,            //width
     -1,            //height
     0,             //input, used in v4l and bttv

Modified: trunk/stream/tv.c
==============================================================================
--- trunk/stream/tv.c	(original)
+++ trunk/stream/tv.c	Mon Sep 10 19:09:35 2007
@@ -52,17 +52,18 @@ extern tvi_info_t tvi_info_v4l2;
 extern tvi_info_t tvi_info_bsdbt848;
 #endif
 
+/** List of drivers in autodetection order */
 static const tvi_info_t* tvi_driver_list[]={
-    &tvi_info_dummy,
-#ifdef HAVE_TV_V4L1
-    &tvi_info_v4l,
-#endif
 #ifdef HAVE_TV_V4L2
     &tvi_info_v4l2,
 #endif
+#ifdef HAVE_TV_V4L1
+    &tvi_info_v4l,
+#endif
 #ifdef HAVE_TV_BSDBT848
     &tvi_info_bsdbt848,
 #endif
+    &tvi_info_dummy,
     NULL
 };
 
@@ -560,7 +561,7 @@ static tvi_handle_t *tv_begin(tv_param_t
 {
     int i;
     tvi_handle_t* h;
-    if(!strcmp(tv_param->driver,"help")){
+    if(tv_param->driver && !strcmp(tv_param->driver,"help")){
         mp_msg(MSGT_TV,MSGL_INFO,MSGTR_TV_AvailableDrivers);
         for(i=0;tvi_driver_list[i];i++){
 	    mp_msg(MSGT_TV,MSGL_INFO," %s\t%s",tvi_driver_list[i]->short_name,tvi_driver_list[i]->name);
@@ -572,20 +573,29 @@ static tvi_handle_t *tv_begin(tv_param_t
     }
 
     for(i=0;tvi_driver_list[i];i++){
-        if (!strcmp(tvi_driver_list[i]->short_name, tv_param->driver)){
+        if (!tv_param->driver || !strcmp(tvi_driver_list[i]->short_name, tv_param->driver)){
             h=tvi_driver_list[i]->tvi_init(tv_param);
-            if(!h) return NULL;
+            //Requested driver initialization failed
+            if (!h && tv_param->driver)
+                return NULL;
+            //Driver initialization failed during autodetection process.
+            if (!h)
+                continue;
 
             h->tv_param=tv_param;
             mp_msg(MSGT_TV, MSGL_INFO, MSGTR_TV_DriverInfo, tvi_driver_list[i]->short_name,
             tvi_driver_list[i]->name,
             tvi_driver_list[i]->author,
             tvi_driver_list[i]->comment?tvi_driver_list[i]->comment:"");
+            tv_param->driver=strdup(tvi_driver_list[i]->short_name);
             return h;
         }
     }
     
-    mp_msg(MSGT_TV, MSGL_ERR, MSGTR_TV_NoSuchDriver, tv_param->driver); 
+    if(tv_param->driver)
+        mp_msg(MSGT_TV, MSGL_ERR, MSGTR_TV_NoSuchDriver, tv_param->driver); 
+    else
+        mp_msg(MSGT_TV, MSGL_ERR, MSGTR_TV_DriverAutoDetectionFailed);
     return(NULL);
 }
 



More information about the MPlayer-cvslog mailing list