[Mplayer-cvslog] CVS: main/libmpdemux Makefile,1.9,1.10 tv.c,1.13,1.14 tv.h,1.9,1.10 tvi_def.h,1.3,1.4
Alex Beregszaszi
alex at mplayer.dev.hu
Sat Nov 17 01:23:05 CET 2001
Update of /cvsroot/mplayer/main/libmpdemux
In directory mplayer:/var/tmp.root/cvs-serv11258
Modified Files:
Makefile tv.c tv.h tvi_def.h
Log Message:
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
Index: Makefile
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/Makefile,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- Makefile 9 Nov 2001 23:46:06 -0000 1.9
+++ Makefile 17 Nov 2001 00:23:03 -0000 1.10
@@ -3,7 +3,7 @@
include ../config.mak
-SRCS = mp3_hdr.c video.c mpeg_hdr.c cache2.c asfheader.c aviheader.c aviprint.c aviwrite.c demux_asf.c demux_avi.c demux_mov.c demux_mpg.c demux_viv.c demuxer.c dvdauth.c open.c parse_es.c stream.c tv.c tvi_dummy.c tvi_v4l.c
+SRCS = mp3_hdr.c video.c mpeg_hdr.c cache2.c asfheader.c aviheader.c aviprint.c aviwrite.c demux_asf.c demux_avi.c demux_mov.c demux_mpg.c demux_viv.c demuxer.c dvdauth.c open.c parse_es.c stream.c tv.c tvi_dummy.c tvi_v4l.c frequencies.c
ifeq ($(STREAMING),yes)
SRCS += asf_streaming.c url.c http.c network.c
endif
Index: tv.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/tv.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- tv.c 16 Nov 2001 22:59:07 -0000 1.13
+++ tv.c 17 Nov 2001 00:23:03 -0000 1.14
@@ -29,10 +29,13 @@
#include "tv.h"
+#include "frequencies.h"
+
/* some default values */
char *tv_param_freq = NULL;
char *tv_param_channel = "26"; /* hungarian national tv channel 1 */
char *tv_param_norm = "pal";
+char *tv_param_chanlist = "europe-east";
char *tv_param_device = NULL;
char *tv_param_driver = "dummy";
int tv_param_width = -1;
@@ -92,6 +95,7 @@
int stream_open_tv(stream_t *stream, tvi_handle_t *tvh)
{
+ int i;
tvi_functions_t *funcs = tvh->functions;
int picture_format = 0;
@@ -160,6 +164,56 @@
mp_msg(MSGT_TV, MSGL_INFO, "Current frequency: %lu (%.3f)\n",
freq, (float)freq/16);
}
+
+ /* 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;
+
+ mp_msg(MSGT_TV, MSGL_INFO, "Selected norm: %s\n", tv_param_norm);
+
+ /* select channel list */
+ for (i = 0; chanlists[i].name != NULL; i++)
+ {
+ if (!strcasecmp(chanlists[i].name, tv_param_chanlist))
+ {
+ tvh->chanlist = i;
+ tvh->chanlist_s = chanlists[i].list;
+ break;
+ }
+ }
+
+ if (tvh->chanlist == -1)
+ mp_msg(MSGT_TV, MSGL_WARN, "Unable to find selected channel list! (%s)\n",
+ tv_param_chanlist);
+
+ mp_msg(MSGT_TV, MSGL_INFO, "Selected channel list: %s (including %d channels)\n",
+ chanlists[tvh->chanlist].name, chanlists[tvh->chanlist].count);
+
+ if (tv_param_freq && tv_param_channel)
+ mp_msg(MSGT_TV, MSGL_HINT, "You can't set frequency and channel simultanly!\n");
+
+ if (!tv_param_freq && tv_param_channel)
+ {
+ struct CHANLIST cl;
+ for (i = 0; i < chanlists[tvh->chanlist].count; i++)
+ {
+ cl = tvh->chanlist_s[i];
+// printf("count%d: name: %s, freq: %d\n",
+// i, cl.name, cl.freq);
+ if (!strcasecmp(cl.name, tv_param_channel))
+ {
+ tvh->channel = i;
+ mp_msg(MSGT_TV, MSGL_INFO, "Selected channel: %s (freq: %.3f)\n",
+ cl.name, (float)cl.freq/1000);
+ tv_set_freq(tvh, (unsigned long)(((float)cl.freq/1000)*16));
+ break;
+ }
+ }
+ }
/* also start device! */
return(funcs->start(tvh->priv));
@@ -365,5 +419,55 @@
}
return(1);
+}
+
+int tv_set_freq(tvi_handle_t *tvh, unsigned long freq)
+{
+ if (tvh->functions->control(tvh->priv, TVI_CONTROL_IS_TUNER, 0) == TVI_CONTROL_TRUE)
+ {
+// unsigned long freq = atof(tv_param_freq)*16;
+
+ /* set freq in MHz */
+ tvh->functions->control(tvh->priv, TVI_CONTROL_TUN_SET_FREQ, &freq);
+
+ tvh->functions->control(tvh->priv, TVI_CONTROL_TUN_GET_FREQ, &freq);
+ mp_msg(MSGT_TV, MSGL_INFO, "Current frequency: %lu (%.3f)\n",
+ freq, (float)freq/16);
+ }
+}
+
+int tv_step_channel(tvi_handle_t *tvh, int direction)
+{
+ struct CHANLIST cl;
+
+ if (direction == TV_CHANNEL_LOWER)
+ {
+ if (tvh->channel-1 >= 0)
+ {
+ cl = tvh->chanlist_s[tvh->channel--];
+ mp_msg(MSGT_TV, MSGL_INFO, "Selected channel: %s (freq: %.3f)\n",
+ cl.name, (float)cl.freq/1000);
+ tv_set_freq(tvh, (unsigned long)(((float)cl.freq/1000)*16));
+ }
+ }
+
+ if (direction == TV_CHANNEL_HIGHER)
+ {
+ if (tvh->channel+1 <= chanlists[tvh->chanlist].count)
+ {
+ cl = tvh->chanlist_s[tvh->channel++];
+ mp_msg(MSGT_TV, MSGL_INFO, "Selected channel: %s (freq: %.3f)\n",
+ cl.name, (float)cl.freq/1000);
+ tv_set_freq(tvh, (unsigned long)(((float)cl.freq/1000)*16));
+ }
+ }
+}
+
+int tv_step_norm(tvi_handle_t *tvh)
+{
+}
+
+int tv_step_chanlist(tvi_handle_t *tvh)
+{
}
#endif /* USE_TV */
Index: tv.h
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/tv.h,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- tv.h 16 Nov 2001 22:59:07 -0000 1.9
+++ tv.h 17 Nov 2001 00:23:03 -0000 1.10
@@ -1,3 +1,5 @@
+#ifndef TV_H
+#define TV_H
extern int tv_param_on;
@@ -9,6 +11,7 @@
extern char *tv_param_freq;
extern char *tv_param_channel;
+extern char *tv_param_chanlist;
extern char *tv_param_norm;
extern char *tv_param_device;
extern char *tv_param_driver;
@@ -48,6 +51,12 @@
void *priv;
tvi_param_t *params;
int seq;
+
+ /* specific */
+ int norm;
+ int chanlist;
+ struct CHANLIST *chanlist_s;
+ int channel;
} tvi_handle_t;
@@ -111,10 +120,23 @@
extern int tv_init(tvi_handle_t *tvh);
extern int tv_uninit(tvi_handle_t *tvh);
-
+int tv_set_color_options(tvi_handle_t *tvh, int opt, int val);
#define TV_COLOR_BRIGHTNESS 1
#define TV_COLOR_HUE 2
#define TV_COLOR_SATURATION 3
#define TV_COLOR_CONTRAST 4
+int tv_step_channel(tvi_handle_t *tvh, int direction);
+#define TV_CHANNEL_LOWER 1
+#define TV_CHANNEL_HIGHER 2
+
+int tv_step_norm(tvi_handle_t *tvh);
+int tv_step_chanlist(tvi_handle_t *tvh);
+
+#define TV_NORM_PAL 1
+#define TV_NORM_NTSC 2
+#define TV_NORM_SECAM 3
+
#endif /* USE_TV */
+
+#endif /* TV_H */
Index: tvi_def.h
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/tvi_def.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- tvi_def.h 11 Nov 2001 03:53:42 -0000 1.3
+++ tvi_def.h 17 Nov 2001 00:23:03 -0000 1.4
@@ -36,6 +36,10 @@
h->functions = &functions;
h->params = NULL;
h->seq = 0;
+ h->chanlist = -1;
+ h->chanlist_s = NULL;
+ h->norm = -1;
+ h->channel = -1;
return(h);
}
More information about the MPlayer-cvslog
mailing list