stream/tv: move new_handle() function from header to tv.c

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

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32225 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
diego
2010-09-13 18:09:29 +00:00
committed by Uoti Urpala
parent d65c47dfd0
commit 8939645dcf
8 changed files with 31 additions and 29 deletions

View File

@@ -80,6 +80,31 @@ static const tvi_info_t* tvi_driver_list[]={
NULL 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) void tv_free_handle(tvi_handle_t *h)
{ {
if (h) { if (h) {

View File

@@ -255,6 +255,7 @@ int tv_set_norm(tvi_handle_t *tvh, char* norm);
void tv_start_scan(tvi_handle_t *tvh, int start); 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); void tv_free_handle(tvi_handle_t *h);
#define TV_NORM_PAL 1 #define TV_NORM_PAL 1

View File

@@ -195,7 +195,7 @@ static tvi_handle_t *tvi_init_bsdbt848(tv_param_t* tv_param)
tvi_handle_t* tvh; tvi_handle_t* tvh;
priv_t* priv; priv_t* priv;
tvh=new_handle(); tvh = tv_new_handle(sizeof(priv_t), &functions);
if(!tvh) if(!tvh)
return NULL; return NULL;
priv=(priv_t*)tvh->priv; priv=(priv_t*)tvh->priv;

View File

@@ -45,29 +45,6 @@ static const tvi_functions_t functions =
get_audio_framesize 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. Fills video frame in given buffer with blue color for yv12,i420,uyvy,yuy2.
Other formats will be filled with 0xC0 Other formats will be filled with 0xC0

View File

@@ -3059,7 +3059,7 @@ static tvi_handle_t *tvi_init_dshow(tv_param_t* tv_param)
priv_t *priv; priv_t *priv;
int a; int a;
h = new_handle(); h = tv_new_handle(sizeof(priv_t), &functions);
if (!h) if (!h)
return NULL; return NULL;

View File

@@ -45,7 +45,7 @@ typedef struct priv {
/* handler creator - entry point ! */ /* handler creator - entry point ! */
static tvi_handle_t *tvi_init_dummy(tv_param_t* tv_param) static tvi_handle_t *tvi_init_dummy(tv_param_t* tv_param)
{ {
return new_handle(); return tv_new_handle(sizeof(priv_t), &functions);
} }
/* initialisation */ /* initialisation */

View File

@@ -309,7 +309,7 @@ static tvi_handle_t *tvi_init_v4l(tv_param_t* tv_param)
tvi_handle_t *h; tvi_handle_t *h;
priv_t *priv; priv_t *priv;
h = new_handle(); h = tv_new_handle(sizeof(priv_t), &functions);
if (!h) if (!h)
return NULL; return NULL;

View File

@@ -1068,8 +1068,7 @@ static tvi_handle_t *tvi_init_v4l2(tv_param_t* tv_param)
{ {
tvi_handle_t *tvi_handle; tvi_handle_t *tvi_handle;
/* new_handle initializes priv with memset 0 */ tvi_handle = tv_new_handle(sizeof(priv_t), &functions);
tvi_handle = new_handle();
if (!tvi_handle) { if (!tvi_handle) {
return NULL; return NULL;
} }