summaryrefslogtreecommitdiffstats
path: root/libmpdemux
diff options
context:
space:
mode:
authoralex <alex@b3059339-0415-0410-9bf9-f77b7e298cf2>2001-11-11 15:45:23 +0000
committeralex <alex@b3059339-0415-0410-9bf9-f77b7e298cf2>2001-11-11 15:45:23 +0000
commit9743ad6832946ce55fdac12a31b591dbfadf49aa (patch)
tree54bd05a09861c7914de507c7019f48ce1bb24d37 /libmpdemux
parentee898ac2f938393b8d8106db9780ebde2e267cb1 (diff)
downloadmpv-9743ad6832946ce55fdac12a31b591dbfadf49aa.tar.bz2
mpv-9743ad6832946ce55fdac12a31b591dbfadf49aa.tar.xz
tuning worx (can set frequency)
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@2838 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libmpdemux')
-rw-r--r--libmpdemux/demuxer.c6
-rw-r--r--libmpdemux/open.c1
-rw-r--r--libmpdemux/tv.c28
-rw-r--r--libmpdemux/tv.h2
-rw-r--r--libmpdemux/tvi_dummy.c9
-rw-r--r--libmpdemux/tvi_v4l.c33
6 files changed, 59 insertions, 20 deletions
diff --git a/libmpdemux/demuxer.c b/libmpdemux/demuxer.c
index 3b39177f87..ac4fa7d8b7 100644
--- a/libmpdemux/demuxer.c
+++ b/libmpdemux/demuxer.c
@@ -556,7 +556,11 @@ switch(file_format){
}
#ifdef USE_TV
case DEMUXER_TYPE_TV: {
- demux_open_tv(demuxer, tv_handler);
+ if (!demux_open_tv(demuxer, tv_handler))
+ {
+ tv_uninit(tv_handler);
+ return(NULL);
+ }
break;
}
#endif
diff --git a/libmpdemux/open.c b/libmpdemux/open.c
index 298d7064c5..3279f6a8fa 100644
--- a/libmpdemux/open.c
+++ b/libmpdemux/open.c
@@ -257,6 +257,7 @@ if(dvd_title){
return(NULL);
if (tv_init(tv_handler) == 1)
return(stream);
+ tv_uninit(tv_handler);
return(NULL);
}
#endif
diff --git a/libmpdemux/tv.c b/libmpdemux/tv.c
index 7023fc8f29..a17d639924 100644
--- a/libmpdemux/tv.c
+++ b/libmpdemux/tv.c
@@ -29,7 +29,7 @@ int tv_param_on = 0;
#include "tv.h"
/* some default values */
-unsigned long tv_param_freq = 0;
+char *tv_param_freq = NULL;
char *tv_param_channel = "0";
char *tv_param_norm = "pal";
char *tv_param_device = NULL;
@@ -225,14 +225,23 @@ no_audio:
/* set some params got from cmdline */
funcs->control(tvh->priv, TVI_CONTROL_SPC_SET_INPUT, &tv_param_input);
- /* set freq in MHz - change this to float ! */
- funcs->control(tvh->priv, TVI_CONTROL_TUN_SET_FREQ, &tv_param_freq);
+ /* we need to set frequency */
+ if (tv_param_freq)
+ {
+ unsigned long freq = atof(tv_param_freq)*16;
+
+ printf("freq: %lu\n", freq);
- funcs->control(tvh->priv, TVI_CONTROL_TUN_GET_FREQ, &tv_param_freq);
- mp_msg(MSGT_TV, MSGL_INFO, "Setting to frequency: %lu\n", tv_param_freq);
+ /* set freq in MHz */
+ funcs->control(tvh->priv, TVI_CONTROL_TUN_SET_FREQ, &freq);
+
+ funcs->control(tvh->priv, TVI_CONTROL_TUN_GET_FREQ, &freq);
+ mp_msg(MSGT_TV, MSGL_INFO, "Current frequency: %lu (%.3f)\n",
+ freq, (float)freq/16);
+ }
/* also start device! */
- funcs->start(tvh->priv);
+ return(funcs->start(tvh->priv));
}
/* ================== STREAM_TV ===================== */
@@ -264,6 +273,11 @@ int tv_init(tvi_handle_t *tvh)
(int)*(void **)params[0].value = tv_param_input;
params[1].opt = params[1].value = NULL;
- return tvh->functions->init(tvh->priv, params);
+ return(tvh->functions->init(tvh->priv, params));
+}
+
+int tv_uninit(tvi_handle_t *tvh)
+{
+ return(tvh->functions->uninit(tvh->priv));
}
#endif /* USE_TV */
diff --git a/libmpdemux/tv.h b/libmpdemux/tv.h
index fd3c9ae953..19e5c2cd14 100644
--- a/libmpdemux/tv.h
+++ b/libmpdemux/tv.h
@@ -7,7 +7,7 @@ extern int tv_param_on;
//#include "../libvo/fastmemcpy.h"
//#include "mp_msg.h"
-extern unsigned long tv_param_freq;
+extern char *tv_param_freq;
extern char *tv_param_channel;
extern char *tv_param_norm;
extern char *tv_param_device;
diff --git a/libmpdemux/tvi_dummy.c b/libmpdemux/tvi_dummy.c
index e3cefc3285..765c8fcc7b 100644
--- a/libmpdemux/tvi_dummy.c
+++ b/libmpdemux/tvi_dummy.c
@@ -29,18 +29,19 @@ typedef struct {
/* handler creator - entry point ! */
tvi_handle_t *tvi_init_dummy(char *device)
{
- return new_handle();
+ return(new_handle());
}
/* initialisation */
static int init(priv_t *priv, tvi_param_t *params)
{
- return 1;
+ return(1);
}
/* that's the real start, we'got the format parameters (checked with control) */
static int start(priv_t *priv)
{
+ return(1);
}
static int uninit(priv_t *priv)
@@ -84,7 +85,7 @@ static int grab_video_frame(priv_t *priv, char *buffer, int len)
static int get_video_framesize(priv_t *priv)
{
/* YV12 */
- return priv->width*priv->height*12/8;
+ return(priv->width*priv->height*12/8);
}
static int grab_audio_frame(priv_t *priv, char *buffer, int len)
@@ -94,7 +95,7 @@ static int grab_audio_frame(priv_t *priv, char *buffer, int len)
static int get_audio_framesize(priv_t *priv)
{
- return 1;
+ return(1);
}
#endif /* USE_TV */
diff --git a/libmpdemux/tvi_v4l.c b/libmpdemux/tvi_v4l.c
index f88746c088..2d7fbda456 100644
--- a/libmpdemux/tvi_v4l.c
+++ b/libmpdemux/tvi_v4l.c
@@ -327,6 +327,7 @@ err:
static int uninit(priv_t *priv)
{
+ close(priv->fd);
#warning "Implement uninit!"
}
@@ -368,13 +369,31 @@ static int start(priv_t *priv)
priv->buf[i].height = priv->height;
mp_msg(MSGT_TV, MSGL_DBG2, "buffer: %d => %p\n", i, &priv->buf[i]);
}
-
+
+
+#if 0
+ {
+ struct video_window win;
+
+ win.x = 0;
+ win.y = 0;
+ win.width = priv->width;
+ win.height = priv->height;
+ win.chromakey = -1;
+ win.flags = 0;
+
+ ioctl(priv->fd, VIDIOCSWIN, &win);
+ }
+
/* start capture */
if (ioctl(priv->fd, VIDIOCCAPTURE, &one) == -1)
{
mp_msg(MSGT_TV, MSGL_ERR, "ioctl capture failed: %s\n", strerror(errno));
return(0);
}
+#endif
+
+ return(1);
}
static int control(priv_t *priv, int cmd, void *arg)
@@ -490,8 +509,8 @@ static int control(priv_t *priv, int cmd, void *arg)
}
/* tuner uses khz not mhz ! */
- if (priv->tuner.flags & VIDEO_TUNER_LOW)
- freq /= 1000;
+// if (priv->tuner.flags & VIDEO_TUNER_LOW)
+// freq /= 1000;
(unsigned long)*(void **)arg = freq;
return(TVI_CONTROL_TRUE);
}
@@ -500,12 +519,12 @@ static int control(priv_t *priv, int cmd, void *arg)
/* argument is in MHz ! */
unsigned long freq = (unsigned long)*(void **)arg;
- mp_msg(MSGT_TV, MSGL_V, "requested frequency: %lu MHz\n", (float)freq/16);
+ mp_msg(MSGT_TV, MSGL_V, "requested frequency: %.3f\n", (float)freq/16);
/* tuner uses khz not mhz ! */
- if (priv->tuner.flags & VIDEO_TUNER_LOW)
- freq *= 1000;
- mp_msg(MSGT_TV, MSGL_V, " requesting from driver: freq=%.3f\n", (float)freq/16);
+// if (priv->tuner.flags & VIDEO_TUNER_LOW)
+// freq *= 1000;
+// mp_msg(MSGT_TV, MSGL_V, " requesting from driver: freq=%.3f\n", (float)freq/16);
if (ioctl(priv->fd, VIDIOCSFREQ, &freq) == -1)
{
mp_msg(MSGT_TV, MSGL_ERR, "ioctl set freq failed: %s\n", strerror(errno));