2001-12-27 23:52:48 +00:00
|
|
|
#include <stdlib.h> /* malloc */
|
|
|
|
|
|
|
|
static int init(priv_t *priv);
|
2001-11-10 23:32:10 +00:00
|
|
|
static int uninit(priv_t *priv);
|
2001-11-09 23:46:06 +00:00
|
|
|
static int control(priv_t *priv, int cmd, void *arg);
|
2001-11-10 23:32:10 +00:00
|
|
|
static int start(priv_t *priv);
|
2001-11-09 23:46:06 +00:00
|
|
|
static int grab_video_frame(priv_t *priv, char *buffer, int len);
|
|
|
|
static int get_video_framesize(priv_t *priv);
|
|
|
|
static int grab_audio_frame(priv_t *priv, char *buffer, int len);
|
|
|
|
static int get_audio_framesize(priv_t *priv);
|
|
|
|
|
|
|
|
static tvi_functions_t functions =
|
|
|
|
{
|
|
|
|
init,
|
2001-11-10 23:32:10 +00:00
|
|
|
uninit,
|
2001-11-09 23:46:06 +00:00
|
|
|
control,
|
2001-11-10 23:32:10 +00:00
|
|
|
start,
|
2001-11-09 23:46:06 +00:00
|
|
|
grab_video_frame,
|
|
|
|
get_video_framesize,
|
|
|
|
grab_audio_frame,
|
|
|
|
get_audio_framesize
|
|
|
|
};
|
|
|
|
|
|
|
|
static tvi_handle_t *new_handle()
|
|
|
|
{
|
2001-11-11 03:53:42 +00:00
|
|
|
tvi_handle_t *h = (tvi_handle_t *)malloc(sizeof(tvi_handle_t));
|
2001-11-09 23:46:06 +00:00
|
|
|
|
|
|
|
if (!h)
|
|
|
|
return(NULL);
|
2001-11-10 23:32:10 +00:00
|
|
|
h->priv = (priv_t *)malloc(sizeof(priv_t));
|
2001-11-09 23:46:06 +00:00
|
|
|
if (!h->priv)
|
|
|
|
{
|
|
|
|
free(h);
|
|
|
|
return(NULL);
|
|
|
|
}
|
|
|
|
memset(h->priv, 0, sizeof(priv_t));
|
|
|
|
h->info = &info;
|
|
|
|
h->functions = &functions;
|
2001-11-10 23:32:10 +00:00
|
|
|
h->seq = 0;
|
2001-11-17 00:23:48 +00:00
|
|
|
h->chanlist = -1;
|
|
|
|
h->chanlist_s = NULL;
|
|
|
|
h->norm = -1;
|
|
|
|
h->channel = -1;
|
2001-11-09 23:46:06 +00:00
|
|
|
return(h);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void free_handle(tvi_handle_t *h)
|
|
|
|
{
|
2001-12-19 12:54:06 +00:00
|
|
|
if (h) {
|
|
|
|
if (h->priv)
|
|
|
|
free(h->priv);
|
2001-11-09 23:46:06 +00:00
|
|
|
free(h);
|
2001-12-19 12:54:06 +00:00
|
|
|
}
|
2001-11-09 23:46:06 +00:00
|
|
|
}
|