changeset 32090:535ebcd085e4

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.
author diego
date Sat, 11 Sep 2010 23:53:15 +0000
parents 7f6ac03eb2ce
children 76c60eb30d56
files stream/tv.c stream/tv.h stream/tvi_def.h stream/tvi_dshow.c stream/tvi_v4l.c stream/tvi_v4l2.c
diffstat 6 files changed, 20 insertions(+), 18 deletions(-) [+]
line wrap: on
line diff
--- a/stream/tv.c	Sat Sep 11 23:30:52 2010 +0000
+++ b/stream/tv.c	Sat Sep 11 23:53:15 2010 +0000
@@ -81,6 +81,17 @@
     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");
--- a/stream/tv.h	Sat Sep 11 23:30:52 2010 +0000
+++ b/stream/tv.h	Sat Sep 11 23:53:15 2010 +0000
@@ -255,6 +255,8 @@
 
 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
--- a/stream/tvi_def.h	Sat Sep 11 23:30:52 2010 +0000
+++ b/stream/tvi_def.h	Sat Sep 11 23:53:15 2010 +0000
@@ -68,17 +68,6 @@
     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
--- a/stream/tvi_dshow.c	Sat Sep 11 23:30:52 2010 +0000
+++ b/stream/tvi_dshow.c	Sat Sep 11 23:53:15 2010 +0000
@@ -3078,12 +3078,12 @@
 	    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 @@
 	    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;
 	}
     }
--- a/stream/tvi_v4l.c	Sat Sep 11 23:30:52 2010 +0000
+++ b/stream/tvi_v4l.c	Sat Sep 11 23:53:15 2010 +0000
@@ -330,7 +330,7 @@
 
     /* allocation failed */
     if (!priv->video_device) {
-        free_handle(h);
+        tv_free_handle(h);
         return NULL;
     }
 
--- a/stream/tvi_v4l2.c	Sat Sep 11 23:30:52 2010 +0000
+++ b/stream/tvi_v4l2.c	Sat Sep 11 23:53:15 2010 +0000
@@ -1077,7 +1077,7 @@
 
     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 @@
         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;
         }
     }