[MPlayer-cvslog] r32174 - in trunk/stream: tv.c tv.h tvi_def.h tvi_dshow.c tvi_v4l.c tvi_v4l2.c

diego subversion at mplayerhq.hu
Sun Sep 12 01:53:15 CEST 2010


Author: diego
Date: Sun Sep 12 01:53:15 2010
New Revision: 32174

Log:
Move TV input free_handle static function to tv.c and make it non-static.
There is no need to pointlessly duplicate the function in the binary.

Modified:
   trunk/stream/tv.c
   trunk/stream/tv.h
   trunk/stream/tvi_def.h
   trunk/stream/tvi_dshow.c
   trunk/stream/tvi_v4l.c
   trunk/stream/tvi_v4l2.c

Modified: trunk/stream/tv.c
==============================================================================
--- trunk/stream/tv.c	Sun Sep 12 01:30:52 2010	(r32173)
+++ trunk/stream/tv.c	Sun Sep 12 01:53:15 2010	(r32174)
@@ -81,6 +81,17 @@ static const tvi_info_t* tvi_driver_list
     NULL
 };
 
+void tv_free_handle(tvi_handle_t *h)
+{
+    if (h) {
+        if (h->priv)
+            free(h->priv);
+        if (h->scan)
+            free(h->scan);
+        free(h);
+    }
+}
+
 void tv_start_scan(tvi_handle_t *tvh, int start)
 {
     mp_msg(MSGT_TV,MSGL_INFO,"start scan\n");

Modified: trunk/stream/tv.h
==============================================================================
--- trunk/stream/tv.h	Sun Sep 12 01:30:52 2010	(r32173)
+++ trunk/stream/tv.h	Sun Sep 12 01:53:15 2010	(r32174)
@@ -255,6 +255,8 @@ int tv_set_norm(tvi_handle_t *tvh, char*
 
 void tv_start_scan(tvi_handle_t *tvh, int start);
 
+void tv_free_handle(tvi_handle_t *h);
+
 #define TV_NORM_PAL		1
 #define TV_NORM_NTSC		2
 #define TV_NORM_SECAM		3

Modified: trunk/stream/tvi_def.h
==============================================================================
--- trunk/stream/tvi_def.h	Sun Sep 12 01:30:52 2010	(r32173)
+++ trunk/stream/tvi_def.h	Sun Sep 12 01:53:15 2010	(r32174)
@@ -68,17 +68,6 @@ static tvi_handle_t *new_handle(void)
     return h;
 }
 
-static void free_handle(tvi_handle_t *h)
-{
-    if (h) {
-	if (h->priv)
-	    free(h->priv);
-	if (h->scan)
-	    free(h->scan);
-	free(h);
-    }
-}
-
 /**
  Fills video frame in given buffer with blue color for yv12,i420,uyvy,yuy2.
  Other formats will be filled with 0xC0

Modified: trunk/stream/tvi_dshow.c
==============================================================================
--- trunk/stream/tvi_dshow.c	Sun Sep 12 01:30:52 2010	(r32173)
+++ trunk/stream/tvi_dshow.c	Sun Sep 12 01:53:15 2010	(r32174)
@@ -3078,12 +3078,12 @@ static tvi_handle_t *tvi_init_dshow(tv_p
 	    priv->dev_index = a;
 	} else {
 	    mp_msg(MSGT_TV, MSGL_ERR, MSGTR_TVI_DS_WrongDeviceParam, tv_param->device);
-	    free_handle(h);
+	    tv_free_handle(h);
 	    return NULL;
 	}
 	if (priv->dev_index < 0) {
 	    mp_msg(MSGT_TV, MSGL_ERR, MSGTR_TVI_DS_WrongDeviceIndex, a);
-	    free_handle(h);
+	    tv_free_handle(h);
 	    return NULL;
 	}
     }
@@ -3092,12 +3092,12 @@ static tvi_handle_t *tvi_init_dshow(tv_p
 	    priv->adev_index = a;
 	} else {
 	    mp_msg(MSGT_TV, MSGL_ERR, MSGTR_TVI_DS_WrongADeviceParam, tv_param->adevice);
-	    free_handle(h);
+	    tv_free_handle(h);
 	    return NULL;
 	}
 	if (priv->dev_index < 0) {
 	    mp_msg(MSGT_TV, MSGL_ERR, MSGTR_TVI_DS_WrongADeviceIndex, a);
-	    free_handle(h);
+	    tv_free_handle(h);
 	    return NULL;
 	}
     }

Modified: trunk/stream/tvi_v4l.c
==============================================================================
--- trunk/stream/tvi_v4l.c	Sun Sep 12 01:30:52 2010	(r32173)
+++ trunk/stream/tvi_v4l.c	Sun Sep 12 01:53:15 2010	(r32174)
@@ -330,7 +330,7 @@ static tvi_handle_t *tvi_init_v4l(tv_par
 
     /* allocation failed */
     if (!priv->video_device) {
-        free_handle(h);
+        tv_free_handle(h);
         return NULL;
     }
 

Modified: trunk/stream/tvi_v4l2.c
==============================================================================
--- trunk/stream/tvi_v4l2.c	Sun Sep 12 01:30:52 2010	(r32173)
+++ trunk/stream/tvi_v4l2.c	Sun Sep 12 01:53:15 2010	(r32174)
@@ -1077,7 +1077,7 @@ static tvi_handle_t *tvi_init_v4l2(tv_pa
 
     PRIV->video_dev = strdup(tv_param->device? tv_param->device: "/dev/video0");
     if (!PRIV->video_dev) {
-        free_handle(tvi_handle);
+        tv_free_handle(tvi_handle);
         return NULL;
     }
 
@@ -1085,7 +1085,7 @@ static tvi_handle_t *tvi_init_v4l2(tv_pa
         PRIV->audio_dev = strdup(tv_param->adevice);
         if (!PRIV->audio_dev) {
             free(PRIV->video_dev);
-            free_handle(tvi_handle);
+            tv_free_handle(tvi_handle);
             return NULL;
         }
     }


More information about the MPlayer-cvslog mailing list