1
0
mirror of https://github.com/mpv-player/mpv synced 2024-12-18 04:45:33 +00:00

I'd like to change tv tuner frequency in the slave mode. So this patch

helps me.

Patch by Kir Kostuchenko <kir@users.sourceforge.net>


git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@10522 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
gabucino 2003-08-04 09:13:10 +00:00
parent 0bb8ec366f
commit bff4b3ee5e
6 changed files with 56 additions and 21 deletions

View File

@ -76,5 +76,9 @@ tv_set_channel channel
Set the current TV channel.
tv_last_channel
Set the current TV channel to the last one.
tv_set_freq <frequency in MHz>
Set the tv tuner frequency.
tv_set_norm <norm>
Set the tv tuner norm. PAL, SECAM, NTSC and so on..
gui_[loadsubtitle|about|play|stop]
GUI actions

View File

@ -85,6 +85,8 @@ static mp_cmd_t mp_cmds[] = {
{ MP_CMD_TV_STEP_CHANNEL_LIST, "tv_step_chanlist", 0, { {-1,{0}} } },
{ MP_CMD_TV_SET_CHANNEL, "tv_set_channel", 1, { { MP_CMD_ARG_STRING, {0}}, {-1,{0}} }},
{ MP_CMD_TV_LAST_CHANNEL, "tv_last_channel", 0, { {-1,{0}} } },
{ MP_CMD_TV_SET_FREQ, "tv_set_freq", 1, { {MP_CMD_ARG_FLOAT,{0}}, {-1,{0}} } },
{ MP_CMD_TV_SET_NORM, "tv_set_norm", 1, { {MP_CMD_ARG_STRING,{0}}, {-1,{0}} } },
#endif
{ MP_CMD_VO_FULLSCREEN, "vo_fullscreen", 0, { {-1,{0}} } },
{ MP_CMD_SCREENSHOT, "screenshot", 0, { {-1,{0}} } },

View File

@ -43,6 +43,8 @@
#define MP_CMD_SUB_ALIGNMENT 39
#define MP_CMD_TV_LAST_CHANNEL 40
#define MP_CMD_OSD_SHOW_TEXT 41
#define MP_CMD_TV_SET_FREQ 42
#define MP_CMD_TV_SET_NORM 43
#define MP_CMD_GUI_EVENTS 5000
#define MP_CMD_GUI_LOADFILE 5001

View File

@ -118,9 +118,27 @@ int demux_tv_fill_buffer(demuxer_t *demux, demux_stream_t *ds)
return 1;
}
/* forward declarations */
int tv_set_freq(tvi_handle_t *tvh, unsigned long freq);
int tv_get_freq(tvi_handle_t *tvh, unsigned long *freq);
static int norm_from_string(char* norm)
{
if (!strcasecmp(norm, "pal"))
return TV_NORM_PAL;
else if (!strcasecmp(norm, "ntsc"))
return TV_NORM_NTSC;
else if (!strcasecmp(norm, "secam"))
return TV_NORM_SECAM;
else if (!strcasecmp(norm, "palnc"))
return TV_NORM_PALNC;
else if (!strcasecmp(norm, "palm"))
return TV_NORM_PALM;
else if (!strcasecmp(norm, "paln"))
return TV_NORM_PALN;
else if (!strcasecmp(norm, "ntscjp"))
return TV_NORM_NTSCJP;
else {
mp_msg(MSGT_TV, MSGL_V, "tv.c : norm_from_string(%s): Bogus norm parameter, setting PAL.\n", norm);
return TV_NORM_PAL;
}
}
static int open_tv(tvi_handle_t *tvh)
{
@ -162,24 +180,7 @@ static int open_tv(tvi_handle_t *tvh)
funcs->control(tvh->priv, TVI_CONTROL_SPC_SET_INPUT, &tv_param_input);
/* select video norm */
if (!strcasecmp(tv_param_norm, "pal"))
tvh->norm = TV_NORM_PAL;
else if (!strcasecmp(tv_param_norm, "ntsc"))
tvh->norm = TV_NORM_NTSC;
else if (!strcasecmp(tv_param_norm, "secam"))
tvh->norm = TV_NORM_SECAM;
else if (!strcasecmp(tv_param_norm, "palnc"))
tvh->norm = TV_NORM_PALNC;
else if (!strcasecmp(tv_param_norm, "palm"))
tvh->norm = TV_NORM_PALM;
else if (!strcasecmp(tv_param_norm, "paln"))
tvh->norm = TV_NORM_PALN;
else if (!strcasecmp(tv_param_norm, "ntscjp"))
tvh->norm = TV_NORM_NTSCJP;
else {
mp_msg(MSGT_TV, MSGL_V, "Bogus norm parameter, setting PAL.\n");
tvh->norm = TV_NORM_PAL;
}
tvh->norm = norm_from_string(tv_param_norm);
mp_msg(MSGT_TV, MSGL_V, "Selected norm: %s\n", tv_param_norm);
if (funcs->control(tvh->priv, TVI_CONTROL_TUN_SET_NORM, &tvh->norm) != TVI_CONTROL_TRUE) {
@ -804,4 +805,17 @@ int tv_step_chanlist(tvi_handle_t *tvh)
{
return(1);
}
int tv_set_norm(tvi_handle_t *tvh, char* norm)
{
tvh->norm = norm_from_string(norm);
mp_msg(MSGT_TV, MSGL_V, "Selected norm: %s\n", tv_param_norm);
if (tvh->functions->control(tvh->priv, TVI_CONTROL_TUN_SET_NORM, &tvh->norm) != TVI_CONTROL_TRUE) {
mp_msg(MSGT_TV, MSGL_ERR, "Error: cannot set norm!\n");
return 0;
}
return(1);
}
#endif /* USE_TV */

View File

@ -177,6 +177,11 @@ int tv_set_channel(tvi_handle_t *tvh, char *channel);
int tv_step_norm(tvi_handle_t *tvh);
int tv_step_chanlist(tvi_handle_t *tvh);
int tv_set_freq(tvi_handle_t *tvh, unsigned long freq);
int tv_get_freq(tvi_handle_t *tvh, unsigned long *freq);
int tv_set_norm(tvi_handle_t *tvh, char* norm);
#define TV_NORM_PAL 1
#define TV_NORM_NTSC 2
#define TV_NORM_SECAM 3

View File

@ -2777,6 +2777,14 @@ if (stream->type==STREAMTYPE_DVDNAV && dvd_nav_still)
frame_dropping = v > 2 ? 2 : v;
} break;
#ifdef USE_TV
case MP_CMD_TV_SET_FREQ : {
if (file_format == DEMUXER_TYPE_TV)
tv_set_freq((tvi_handle_t*)(demuxer->priv), cmd->args[0].v.f * 16.0);
} break;
case MP_CMD_TV_SET_NORM : {
if (file_format == DEMUXER_TYPE_TV)
tv_set_norm((tvi_handle_t*)(demuxer->priv), cmd->args[0].v.s);
} break;
case MP_CMD_TV_STEP_CHANNEL : {
if (file_format == DEMUXER_TYPE_TV) {
int v = cmd->args[0].v.i;