aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorvektor <devnull@localhost>2002-10-26 14:59:17 +0000
committervektor <devnull@localhost>2002-10-26 14:59:17 +0000
commit39df1bc67a60efe01ef6c06e6d929202e3ee965e (patch)
treedea38e6b9cfdbe548ed39a39d8386918add0971f
parentc8faa5ece3598f74cd62946bbd6f62a9f1247115 (diff)
You can now toggle through the inputs on the card using F9.
-rw-r--r--docs/default.tvtimerc2
-rw-r--r--src/Makefile.am2
-rw-r--r--src/input.c8
-rw-r--r--src/tvtimeconf.c6
-rw-r--r--src/tvtimeconf.h1
-rw-r--r--src/videoinput.c48
-rw-r--r--src/videoinput.h20
7 files changed, 84 insertions, 3 deletions
diff --git a/docs/default.tvtimerc b/docs/default.tvtimerc
index a9a99bd..9485c9d 100644
--- a/docs/default.tvtimerc
+++ b/docs/default.tvtimerc
@@ -87,6 +87,7 @@ DebugMode = 0
# key_cont_up = F6
# key_colour_down = F7
# key_colour_up = F8
+# key_tv_video = F9
# key_show_bars = F11
# key_show_test = F12
# key_debug = d
@@ -112,6 +113,7 @@ key_cont_down = F5
key_cont_up = F6
key_colour_down = F7
key_colour_up = F8
+key_tv_video = F9
key_show_bars = F11
key_show_test = F12
key_debug = d
diff --git a/src/Makefile.am b/src/Makefile.am
index d5cd86d..419e16f 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -14,7 +14,7 @@ OPT_CFLAGS = -Wall -I. -O3 -rdynamic -DDATADIR="$(tvtimedatadir)"
AM_CFLAGS = $(SDL_CFLAGS) $(TTF_CFLAGS) $(PNG_CFLAGS) $(OPT_CFLAGS) $(PLUGINS_CFLAGS)
AM_CXXFLAGS = $(SDL_CFLAGS) $(TTF_CFLAGS) $(PNG_CFLAGS) $(OPT_CFLAGS) $(PLUGINS_CFLAGS)
-LDFLAGS = $(SDL_LIBS) $(TTF_LIBS) $(PNG_LIBS) $(PLUGINS_LIBS) -lm
+AM_LDFLAGS = $(SDL_LIBS) $(TTF_LIBS) $(PNG_LIBS) $(PLUGINS_LIBS) -lm
COMMON_SRCS = frequencies.c mixer.c videoinput.c sdloutput.c \
rtctimer.c ttfont.cpp efs.cpp osd.c parser.c tvtimeconf.c \
diff --git a/src/input.c b/src/input.c
index f3f6b20..07e8e11 100644
--- a/src/input.c
+++ b/src/input.c
@@ -43,6 +43,7 @@ struct input_s {
int digit_counter;
int videohold;
int quit;
+ int inputnum;
int screenshot;
int printdebug;
@@ -267,6 +268,13 @@ void input_callback( input_t *in, InputEvent command, int arg )
mixer_toggle_mute();
break;
+ case TVTIME_TV_VIDEO:
+ videoinput_set_input_num( in->vidin, ( videoinput_get_input_num( in->vidin ) + 1 ) % videoinput_get_num_inputs( in->vidin ) );
+ if( in->osd ) {
+ tvtime_osd_show_message( in->osd, videoinput_get_input_name( in->vidin ) );
+ }
+ break;
+
case TVTIME_HUE_UP:
case TVTIME_HUE_DOWN:
videoinput_set_hue_relative(
diff --git a/src/tvtimeconf.c b/src/tvtimeconf.c
index 1b4d5e6..775fce6 100644
--- a/src/tvtimeconf.c
+++ b/src/tvtimeconf.c
@@ -139,6 +139,7 @@ config_t *config_new( int argc, char **argv )
ct->keymap[ TVTIME_MIXER_DOWN ] = '-';
ct->keymap[ TVTIME_ENTER ] = I_ENTER;
ct->keymap[ TVTIME_CHANNEL_CHAR ] = 0;
+ ct->keymap[ TVTIME_TV_VIDEO ] = I_F9;
ct->keymap[ TVTIME_HUE_DOWN ] = I_F1;
ct->keymap[ TVTIME_HUE_UP ] = I_F2;
ct->keymap[ TVTIME_BRIGHT_DOWN ] = I_F3;
@@ -459,6 +460,11 @@ void config_init_keymap( config_t *ct )
ct->keymap[ TVTIME_MIXER_DOWN ] = key;
}
+ if( (tmp = parser_get( &(ct->pf), "key_tv_video")) ) {
+ key = string_to_key( tmp );
+ ct->keymap[ TVTIME_TV_VIDEO ] = key;
+ }
+
if( (tmp = parser_get( &(ct->pf), "key_hue_down")) ) {
key = string_to_key( tmp );
ct->keymap[ TVTIME_HUE_DOWN ] = key;
diff --git a/src/tvtimeconf.h b/src/tvtimeconf.h
index ed58190..6ee252d 100644
--- a/src/tvtimeconf.h
+++ b/src/tvtimeconf.h
@@ -39,6 +39,7 @@ enum tvtime_commands
TVTIME_ENTER,
TVTIME_CHANNEL_CHAR,
+ TVTIME_TV_VIDEO,
TVTIME_HUE_DOWN,
TVTIME_HUE_UP,
TVTIME_BRIGHT_DOWN,
diff --git a/src/videoinput.c b/src/videoinput.c
index 3b65d2c..60f3503 100644
--- a/src/videoinput.c
+++ b/src/videoinput.c
@@ -67,6 +67,7 @@ struct videoinput_s
int grab_size;
int numframes;
int have_mmap;
+ int numinputs;
int width;
int height;
@@ -154,12 +155,16 @@ int videoinput_get_numframes( videoinput_t *vidin )
return vidin->numframes;
}
+int videoinput_get_num_inputs( videoinput_t *vidin )
+{
+ return vidin->numinputs;
+}
+
/**
* Reasonable defaults:
*
* v4l_device : /dev/video0
- * inputnum : 1
- * max_buffers : 16
+ * inputnum : 0 ??
*/
videoinput_t *videoinput_new( const char *v4l_device, int inputnum,
int capwidth, int palmode, int verbose )
@@ -195,6 +200,21 @@ videoinput_t *videoinput_new( const char *v4l_device, int inputnum,
return 0;
}
+
+ vidin->numinputs = 0;
+ for(;;) {
+ vidin->grab_chan.channel = vidin->numinputs;
+ if( ioctl( vidin->grab_fd, VIDIOCGCHAN, &(vidin->grab_chan) ) < 0 ) {
+ break;
+ }
+ vidin->numinputs++;
+ }
+
+ if( inputnum >= vidin->numinputs ) {
+ fprintf( stderr, "videoinput: Requested input number %d not valid, "
+ "max is %d.\n", inputnum, vidin->numinputs );
+ }
+
vidin->grab_chan.channel = inputnum;
if( ioctl( vidin->grab_fd, VIDIOCGCHAN, &(vidin->grab_chan) ) < 0 ) {
perror( "ioctl VIDIOCGCHAN" );
@@ -586,6 +606,30 @@ int videoinput_freq_present( videoinput_t *vidin )
return 0;
}
+int videoinput_get_input_num( videoinput_t *vidin )
+{
+ return vidin->grab_chan.channel;
+}
+
+const char *videoinput_get_input_name( videoinput_t *vidin )
+{
+ return vidin->grab_chan.name;
+}
+
+void videoinput_set_input_num( videoinput_t *vidin, int inputnum )
+{
+ if( inputnum >= vidin->numinputs ) {
+ fprintf( stderr, "videoinput: Requested input number %d not valid, "
+ "max is %d.\n", inputnum, vidin->numinputs );
+ } else {
+ vidin->grab_chan.channel = inputnum;
+ if( ioctl( vidin->grab_fd, VIDIOCSCHAN, &(vidin->grab_chan) ) < 0 ) {
+ perror( "ioctl VIDIOCSCHAN" );
+ }
+ ioctl( vidin->grab_fd, VIDIOCGCHAN, &(vidin->grab_chan) );
+ }
+}
+
void videoinput_delete( videoinput_t *vidin )
{
diff --git a/src/videoinput.h b/src/videoinput.h
index c0621b0..4aeafa9 100644
--- a/src/videoinput.h
+++ b/src/videoinput.h
@@ -126,6 +126,26 @@ int videoinput_get_tuner_freq( videoinput_t *vidin );
*/
int videoinput_freq_present( videoinput_t *vidin );
+/**
+ * Returns how many inputs are available.
+ */
+int videoinput_get_num_inputs( videoinput_t *vidin );
+
+/**
+ * Returns the current input number.
+ */
+int videoinput_get_input_num( videoinput_t *vidin );
+
+/**
+ * Returns the name of the current input.
+ */
+const char *videoinput_get_input_name( videoinput_t *vidin );
+
+/**
+ * Sets the current input.
+ */
+void videoinput_set_input_num( videoinput_t *vidin, int inputnum );
+
#ifdef __cplusplus
};
#endif

Privacy Policy