[Mplayer-cvslog] CVS: main/libmpdemux demuxer.c,1.41,1.42 open.c,1.19,1.20 tv.c,1.8,1.9 tv.h,1.6,1.7 tvi_dummy.c,1.4,1.5 tvi_v4l.c,1.7,1.8
Alex Beregszaszi
alex at mplayer.dev.hu
Sun Nov 11 16:45:26 CET 2001
Update of /cvsroot/mplayer/main/libmpdemux
In directory mplayer:/var/tmp.root/cvs-serv21439
Modified Files:
demuxer.c open.c tv.c tv.h tvi_dummy.c tvi_v4l.c
Log Message:
tuning worx (can set frequency)
Index: demuxer.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/demuxer.c,v
retrieving revision 1.41
retrieving revision 1.42
diff -u -r1.41 -r1.42
--- demuxer.c 10 Nov 2001 23:31:08 -0000 1.41
+++ demuxer.c 11 Nov 2001 15:45:23 -0000 1.42
@@ -556,7 +556,11 @@
}
#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
Index: open.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/open.c,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -r1.19 -r1.20
--- open.c 10 Nov 2001 23:31:08 -0000 1.19
+++ open.c 11 Nov 2001 15:45:23 -0000 1.20
@@ -257,6 +257,7 @@
return(NULL);
if (tv_init(tv_handler) == 1)
return(stream);
+ tv_uninit(tv_handler);
return(NULL);
}
#endif
Index: tv.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/tv.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- tv.c 11 Nov 2001 13:47:42 -0000 1.8
+++ tv.c 11 Nov 2001 15:45:23 -0000 1.9
@@ -29,7 +29,7 @@
#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 @@
/* 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)*(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 */
Index: tv.h
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/tv.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- tv.h 11 Nov 2001 13:47:42 -0000 1.6
+++ tv.h 11 Nov 2001 15:45:23 -0000 1.7
@@ -7,7 +7,7 @@
//#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;
Index: tvi_dummy.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/tvi_dummy.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- tvi_dummy.c 11 Nov 2001 13:47:42 -0000 1.4
+++ tvi_dummy.c 11 Nov 2001 15:45:23 -0000 1.5
@@ -29,18 +29,19 @@
/* 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 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 get_audio_framesize(priv_t *priv)
{
- return 1;
+ return(1);
}
#endif /* USE_TV */
Index: tvi_v4l.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/tvi_v4l.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- tvi_v4l.c 11 Nov 2001 13:47:42 -0000 1.7
+++ tvi_v4l.c 11 Nov 2001 15:45:23 -0000 1.8
@@ -327,6 +327,7 @@
static int uninit(priv_t *priv)
{
+ close(priv->fd);
#warning "Implement uninit!"
}
@@ -368,13 +369,31 @@
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 @@
}
/* 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 @@
/* 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));
More information about the MPlayer-cvslog
mailing list