Mercurial > mplayer.hg
changeset 2837:c63562f5f56f
tuning worx (can set frequency)
author | alex |
---|---|
date | Sun, 11 Nov 2001 15:45:23 +0000 |
parents | ec672ea5ac2c |
children | 3e045cebc446 |
files | libmpdemux/demuxer.c libmpdemux/open.c libmpdemux/tv.c libmpdemux/tv.h libmpdemux/tvi_dummy.c libmpdemux/tvi_v4l.c |
diffstat | 6 files changed, 59 insertions(+), 20 deletions(-) [+] |
line wrap: on
line diff
--- a/libmpdemux/demuxer.c Sun Nov 11 15:41:17 2001 +0000 +++ b/libmpdemux/demuxer.c Sun Nov 11 15:45:23 2001 +0000 @@ -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
--- a/libmpdemux/open.c Sun Nov 11 15:41:17 2001 +0000 +++ b/libmpdemux/open.c Sun Nov 11 15:45:23 2001 +0000 @@ -257,6 +257,7 @@ return(NULL); if (tv_init(tv_handler) == 1) return(stream); + tv_uninit(tv_handler); return(NULL); } #endif
--- a/libmpdemux/tv.c Sun Nov 11 15:41:17 2001 +0000 +++ b/libmpdemux/tv.c Sun Nov 11 15:45:23 2001 +0000 @@ -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 */
--- a/libmpdemux/tv.h Sun Nov 11 15:41:17 2001 +0000 +++ b/libmpdemux/tv.h Sun Nov 11 15:45:23 2001 +0000 @@ -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;
--- a/libmpdemux/tvi_dummy.c Sun Nov 11 15:41:17 2001 +0000 +++ b/libmpdemux/tvi_dummy.c Sun Nov 11 15:45:23 2001 +0000 @@ -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 */
--- a/libmpdemux/tvi_v4l.c Sun Nov 11 15:41:17 2001 +0000 +++ b/libmpdemux/tvi_v4l.c Sun Nov 11 15:45:23 2001 +0000 @@ -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));