changeset 32141:2802b8095bf7

Move TV input new_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 Mon, 13 Sep 2010 18:09:29 +0000
parents 0822f7483159
children 4614728cab25
files stream/tv.c stream/tv.h stream/tvi_bsdbt848.c stream/tvi_def.h stream/tvi_dshow.c stream/tvi_dummy.c stream/tvi_v4l.c stream/tvi_v4l2.c
diffstat 8 files changed, 31 insertions(+), 29 deletions(-) [+]
line wrap: on
line diff
--- a/stream/tv.c	Mon Sep 13 18:06:20 2010 +0000
+++ b/stream/tv.c	Mon Sep 13 18:09:29 2010 +0000
@@ -81,6 +81,31 @@
     NULL
 };
 
+tvi_handle_t *tv_new_handle(int size, const tvi_functions_t *functions)
+{
+    tvi_handle_t *h = malloc(sizeof(*h));
+
+    if (!h)
+        return NULL;
+
+    h->priv = calloc(1, size);
+
+    if (!h->priv) {
+        free(h);
+        return NULL;
+    }
+
+    h->functions  = functions;
+    h->seq        = 0;
+    h->chanlist   = -1;
+    h->chanlist_s = NULL;
+    h->norm       = -1;
+    h->channel    = -1;
+    h->scan       = NULL;
+
+    return h;
+}
+
 void tv_free_handle(tvi_handle_t *h)
 {
     if (h) {
--- a/stream/tv.h	Mon Sep 13 18:06:20 2010 +0000
+++ b/stream/tv.h	Mon Sep 13 18:09:29 2010 +0000
@@ -255,6 +255,7 @@
 
 void tv_start_scan(tvi_handle_t *tvh, int start);
 
+tvi_handle_t *tv_new_handle(int size, const tvi_functions_t *functions);
 void tv_free_handle(tvi_handle_t *h);
 
 #define TV_NORM_PAL		1
--- a/stream/tvi_bsdbt848.c	Mon Sep 13 18:06:20 2010 +0000
+++ b/stream/tvi_bsdbt848.c	Mon Sep 13 18:09:29 2010 +0000
@@ -196,7 +196,7 @@
     tvi_handle_t* tvh;
     priv_t* priv;
 
-    tvh=new_handle();
+    tvh = tv_new_handle(sizeof(priv_t), &functions);
     if(!tvh)
         return NULL;
     priv=(priv_t*)tvh->priv;
--- a/stream/tvi_def.h	Mon Sep 13 18:06:20 2010 +0000
+++ b/stream/tvi_def.h	Mon Sep 13 18:09:29 2010 +0000
@@ -45,29 +45,6 @@
     get_audio_framesize
 };
 
-static tvi_handle_t *new_handle(void)
-{
-    tvi_handle_t *h = malloc(sizeof(*h));
-
-    if (!h)
-	return NULL;
-    h->priv = calloc(1, sizeof(priv_t));
-    if (!h->priv)
-    {
-	free(h);
-	return NULL;
-    }
-
-    h->functions = &functions;
-    h->seq = 0;
-    h->chanlist = -1;
-    h->chanlist_s = NULL;
-    h->norm = -1;
-    h->channel = -1;
-    h->scan = NULL;
-    return 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	Mon Sep 13 18:06:20 2010 +0000
+++ b/stream/tvi_dshow.c	Mon Sep 13 18:09:29 2010 +0000
@@ -3060,7 +3060,7 @@
     priv_t *priv;
     int a;
 
-    h = new_handle();
+    h = tv_new_handle(sizeof(priv_t), &functions);
     if (!h)
 	return NULL;
 
--- a/stream/tvi_dummy.c	Mon Sep 13 18:06:20 2010 +0000
+++ b/stream/tvi_dummy.c	Mon Sep 13 18:09:29 2010 +0000
@@ -45,7 +45,7 @@
 /* handler creator - entry point ! */
 static tvi_handle_t *tvi_init_dummy(tv_param_t* tv_param)
 {
-    return new_handle();
+    return tv_new_handle(sizeof(priv_t), &functions);
 }
 
 /* initialisation */
--- a/stream/tvi_v4l.c	Mon Sep 13 18:06:20 2010 +0000
+++ b/stream/tvi_v4l.c	Mon Sep 13 18:09:29 2010 +0000
@@ -309,7 +309,7 @@
     tvi_handle_t *h;
     priv_t *priv;
 
-    h = new_handle();
+    h = tv_new_handle(sizeof(priv_t), &functions);
     if (!h)
         return NULL;
 
--- a/stream/tvi_v4l2.c	Mon Sep 13 18:06:20 2010 +0000
+++ b/stream/tvi_v4l2.c	Mon Sep 13 18:09:29 2010 +0000
@@ -1068,8 +1068,7 @@
 {
     tvi_handle_t *tvi_handle;
 
-    /* new_handle initializes priv with memset 0 */
-    tvi_handle = new_handle();
+    tvi_handle = tv_new_handle(sizeof(priv_t), &functions);
     if (!tvi_handle) {
         return NULL;
     }