summaryrefslogtreecommitdiffstats
path: root/stream
diff options
context:
space:
mode:
Diffstat (limited to 'stream')
-rw-r--r--stream/tv.c25
-rw-r--r--stream/tv.h1
-rw-r--r--stream/tvi_bsdbt848.c2
-rw-r--r--stream/tvi_def.h23
-rw-r--r--stream/tvi_dshow.c2
-rw-r--r--stream/tvi_dummy.c2
-rw-r--r--stream/tvi_v4l.c2
-rw-r--r--stream/tvi_v4l2.c3
8 files changed, 31 insertions, 29 deletions
diff --git a/stream/tv.c b/stream/tv.c
index 76f4850999..daa6b7dd7f 100644
--- a/stream/tv.c
+++ b/stream/tv.c
@@ -80,6 +80,31 @@ static const tvi_info_t* tvi_driver_list[]={
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) {
diff --git a/stream/tv.h b/stream/tv.h
index ed5fd135d7..6919fa20b8 100644
--- a/stream/tv.h
+++ b/stream/tv.h
@@ -255,6 +255,7 @@ int tv_set_norm(tvi_handle_t *tvh, char* norm);
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
diff --git a/stream/tvi_bsdbt848.c b/stream/tvi_bsdbt848.c
index 1fd6b879d4..9e2a77a542 100644
--- a/stream/tvi_bsdbt848.c
+++ b/stream/tvi_bsdbt848.c
@@ -195,7 +195,7 @@ static tvi_handle_t *tvi_init_bsdbt848(tv_param_t* tv_param)
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;
diff --git a/stream/tvi_def.h b/stream/tvi_def.h
index 2c35160473..b0fd24e130 100644
--- a/stream/tvi_def.h
+++ b/stream/tvi_def.h
@@ -45,29 +45,6 @@ static const tvi_functions_t functions =
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
diff --git a/stream/tvi_dshow.c b/stream/tvi_dshow.c
index 1aedc10642..9394176719 100644
--- a/stream/tvi_dshow.c
+++ b/stream/tvi_dshow.c
@@ -3059,7 +3059,7 @@ static tvi_handle_t *tvi_init_dshow(tv_param_t* tv_param)
priv_t *priv;
int a;
- h = new_handle();
+ h = tv_new_handle(sizeof(priv_t), &functions);
if (!h)
return NULL;
diff --git a/stream/tvi_dummy.c b/stream/tvi_dummy.c
index 50941a2925..95c9489070 100644
--- a/stream/tvi_dummy.c
+++ b/stream/tvi_dummy.c
@@ -45,7 +45,7 @@ typedef struct priv {
/* 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 */
diff --git a/stream/tvi_v4l.c b/stream/tvi_v4l.c
index cc16e92e22..74098f8cae 100644
--- a/stream/tvi_v4l.c
+++ b/stream/tvi_v4l.c
@@ -309,7 +309,7 @@ static tvi_handle_t *tvi_init_v4l(tv_param_t* tv_param)
tvi_handle_t *h;
priv_t *priv;
- h = new_handle();
+ h = tv_new_handle(sizeof(priv_t), &functions);
if (!h)
return NULL;
diff --git a/stream/tvi_v4l2.c b/stream/tvi_v4l2.c
index 4bdf4c499d..7f528d65e5 100644
--- a/stream/tvi_v4l2.c
+++ b/stream/tvi_v4l2.c
@@ -1068,8 +1068,7 @@ static tvi_handle_t *tvi_init_v4l2(tv_param_t* tv_param)
{
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;
}