+Index: tvtime-1.0.2/src/tvtimeosd.c
+===================================================================
+--- tvtime-1.0.2.orig/src/tvtimeosd.c
++++ tvtime-1.0.2/src/tvtimeosd.c
+@@ -34,6 +34,8 @@
+ #include "tvtimeosd.h"
+ #include "pulldown.h"
+
++#define OSD_MAX 16
++
+ typedef struct string_object_s
+ {
+ osd_string_t *string;
+@@ -116,6 +118,9 @@ struct tvtime_osd_s
+ char hold_message[ 255 ];
+ char hold_message2[ 255 ];
+
++ char arguments[ OSD_MAX ][ 128 ];
++ int commands[ OSD_MAX ];
++
+ int film_mode;
+ int info_available;
+ int pulldown_mode;
+@@ -859,6 +864,24 @@ void tvtime_osd_list_set_text( tvtime_os
+ osd_list_set_text( osd->list, line, text );
+ }
+
++void tvtime_osd_list_set_enter_command( tvtime_osd_t *osd, int line, int command,
++ const char *argument )
++{
++ osd->commands[ line ] = command;
++ snprintf( osd->arguments[ line ], sizeof( osd->arguments[ 0 ] ),
++ "%s", argument );
++}
++
++int tvtime_osd_list_get_enter_command( tvtime_osd_t *osd, int line )
++{
++ return osd->commands[ line ];
++}
++
++const char *tvtime_osd_list_get_enter_argument( tvtime_osd_t *osd, int line )
++{
++ return osd->arguments[ line ];
++}
++
+ void tvtime_osd_list_set_lines( tvtime_osd_t *osd, int numlines )
+ {
+ osd_list_set_lines( osd->list, numlines );
+Index: tvtime-1.0.2/src/tvtimeosd.h
+===================================================================
+--- tvtime-1.0.2.orig/src/tvtimeosd.h
++++ tvtime-1.0.2/src/tvtimeosd.h
+@@ -92,6 +92,10 @@ int tvtime_osd_list_get_numlines( tvtime
+ int tvtime_osd_list_get_line_pos( tvtime_osd_t *osd, int y );
+ void tvtime_osd_list_set_hilight( tvtime_osd_t *osd, int pos );
+ void tvtime_osd_list_set_text( tvtime_osd_t *osd, int line, const char *text );
++void tvtime_osd_list_set_enter_command( tvtime_osd_t *osd, int line, int command,
++ const char *argument );
++int tvtime_osd_list_get_enter_command( tvtime_osd_t *osd, int line );
++const char *tvtime_osd_list_get_enter_argument( tvtime_osd_t *osd, int line );
+ void tvtime_osd_list_set_lines( tvtime_osd_t *osd, int numlines );
+ void tvtime_osd_list_get_bounding_box( tvtime_osd_t *osd, int *x, int *y,
+ int *width, int *height );
+Index: tvtime-1.0.2/src/commands.c
+===================================================================
+--- tvtime-1.0.2.orig/src/commands.c
++++ tvtime-1.0.2/src/commands.c
+@@ -42,6 +42,7 @@
+ #include "epg.h"
+
+ #define NUM_FAVORITES 9
++#define MAX_STATIONS ( ( num_stations > 15 ) ? 15 : num_stations )
+ #define MAX_USER_MENUS 64
+
+ /* Maximum number of steps to increment sleeptimer. */
+@@ -51,6 +52,7 @@ enum menu_type
+ {
+ MENU_REDIRECT,
+ MENU_FAVORITES,
++ MENU_STATIONS,
+ MENU_USER
+ };
+
+@@ -65,6 +67,7 @@ static menu_names_t menu_table[] = {
+ { "picture", MENU_REDIRECT, "picture-tuner" },
+ { "input", MENU_REDIRECT, "input-ntsc" },
+ { "favorites", MENU_FAVORITES, 0 },
++ { "channel-list", MENU_STATIONS, 0 },
+ };
+
+ static int tvtime_num_builtin_menus( void )
+@@ -169,6 +172,9 @@ struct commands_s {
+ int numfavorites;
+ int favorites[ NUM_FAVORITES ];
+
++ int channel_list;
++ int channel_list_active;
++
+ int epg;
+ int epg_nowandnext; // We are showing page [epg_nowandnext] of the epg
+ int epg_channel;
+@@ -1145,12 +1151,16 @@ commands_t *commands_new( config_t *cfg,
+ cmd->numfavorites = 0;
+ memset( cmd->favorites, 0, sizeof( cmd->favorites ) );
+
++ cmd->channel_list = 0;
++ cmd->channel_list_active = 0;
++
+ cmd->epg = 0;
+ cmd->epg_nowandnext = 0;
+ cmd->epg_channel = 0;
+
+ cmd->menuactive = 0;
+ cmd->curmenu = MENU_FAVORITES;
++ cmd->curmenu = MENU_STATIONS;
+ cmd->curmenupos = 0;
+ cmd->curmenusize = 0;
+ cmd->curusermenu = 0;
+@@ -1865,6 +1875,9 @@ static void menu_off( commands_t *cmd )
+ tvtime_osd_list_hold( cmd->osd, 0 );
+ tvtime_osd_show_list( cmd->osd, 0, 0 );
+ cmd->menuactive = 0;
++ if( cmd->channel_list_active ) {
++ cmd->channel_list_active = 0;
++ }
+ }
+
+ static void menu_enter( commands_t *cmd )
+@@ -1879,6 +1892,15 @@ static void menu_enter( commands_t *cmd
+ }
+ }
+ menu_off( cmd );
++ } else if( cmd->curmenu == MENU_STATIONS ) {
++ int command = tvtime_osd_list_get_enter_command( cmd->osd, cmd->curmenupos + 1 );
++ const char *argument = tvtime_osd_list_get_enter_argument( cmd->osd, cmd->curmenupos + 1 );
++ if( atoi( argument ) == station_get_current_pos( cmd->stationmgr ) + 1 ) return;
++
++ /* I check for MENU_ENTER just to avoid a malicious infinite loop. */
++ if( command != TVTIME_MENU_ENTER ) {
++ commands_handle( cmd, command, argument );
++ }
+ } else if( cmd->curmenu == MENU_USER ) {
+ int command = menu_get_enter_command( cmd->curusermenu, cmd->curmenupos + 1 );
+ const char *argument = menu_get_enter_argument( cmd->curusermenu, cmd->curmenupos + 1 );
+@@ -1892,7 +1914,7 @@ static void menu_enter( commands_t *cmd
+
+ static void menu_back( commands_t *cmd )
+ {
+- if( cmd->curmenu == MENU_FAVORITES ) {
++ if( ( cmd->curmenu == MENU_FAVORITES ) || ( cmd->curmenu == MENU_STATIONS ) ) {
+ commands_handle( cmd, TVTIME_SHOW_MENU, "stations" );
+ } else if( cmd->curmenu == MENU_USER ) {
+ int command = menu_get_back_command( cmd->curusermenu );
+@@ -1915,7 +1937,8 @@ static void display_current_menu( comman
+ tvtime_osd_list_set_text( cmd->osd, 0, _("Favorites") );
+ for( i = 0; i < cmd->numfavorites; i++ ) {
+ char text[ 32 ];
+- snprintf( text, sizeof (text), "%d", cmd->favorites[ i ] );
++ snprintf( text, sizeof (text), "[%d] %s", cmd->favorites[ i ],
++ station_get_name( cmd->stationmgr, ( cmd->favorites[ i ] - 1 ) ) );
+ tvtime_osd_list_set_text( cmd->osd, i + 1, text );
+ }
+ snprintf( string, sizeof( string ), TVTIME_ICON_PLUSBUTTON " %s",
+@@ -1937,6 +1960,39 @@ static void display_current_menu( comman
+ tvtime_osd_list_hold( cmd->osd, 1 );
+ }
+
++static int display_channel_list( commands_t *cmd, tvtime_osd_t* osd, int channel )
++{
++ const int num_stations = station_get_num_stations( cmd->stationmgr );
++ int i;
++
++ tvtime_osd_list_set_lines( cmd->osd, MAX_STATIONS + 1 );
++ tvtime_osd_list_set_text( cmd->osd, 0, _("Channel list \0") );
++
++ for( i = 0; i < MAX_STATIONS; i++ ) {
++ const char *pos = station_get_channel( cmd->stationmgr, i + channel - 1 );
++ char string[ 128 ];
++
++ if ( channel > num_stations ) {
++ channel = 1;
++ } else if ( channel < 1 ) {
++ channel = num_stations;
++ }
++
++ snprintf( string, sizeof( string ), "[%s] %s",
++ station_get_channel( cmd->stationmgr, i + channel - 1 ),
++ station_get_name( cmd->stationmgr, i + channel - 1 ) );
++ tvtime_osd_list_set_text( cmd->osd, i + 1, string );
++ tvtime_osd_list_set_enter_command( cmd->osd, i + 1, TVTIME_SET_STATION, pos );
++ }
++ cmd->curmenusize = MAX_STATIONS;
++
++ tvtime_osd_list_set_hilight( cmd->osd, cmd->curmenupos + 1 );
++ tvtime_osd_show_list( cmd->osd, 1, 0 );
++ tvtime_osd_list_hold( cmd->osd, 1 );
++
++ return channel;
++}
++
+ menu_t *commands_get_menu( commands_t *cmd, const char *menuname )
+ {
+ int i;
+@@ -1966,6 +2022,7 @@ menu_t *commands_get_menu( commands_t *c
+
+ static int set_menu( commands_t *cmd, const char *menuname )
+ {
++ const int num_stations = station_get_num_stations( cmd->stationmgr );
+ int i;
+
+ if( !menuname || !*menuname ) {
+@@ -1981,7 +2038,15 @@ static int set_menu( commands_t *cmd, co
+ return set_menu( cmd, menu_table[ i ].dest );
+ } else {
+ cmd->curmenu = menu_table[ i ].menutype;
+- cmd->curmenupos = 0;
++ if( cmd->curmenu == MENU_STATIONS ) {
++ if( station_get_current_pos( cmd->stationmgr ) < MAX_STATIONS ) {
++ cmd->curmenupos = station_get_current_pos( cmd->stationmgr );
++ } else {
++ cmd->curmenupos = MAX_STATIONS - 1;
++ }
++ } else {
++ cmd->curmenupos = 0;
++ }
+ return 1;
+ }
+ }
+@@ -2104,20 +2169,46 @@ void commands_handle( commands_t *cmd, i
+ if( tvtime_cmd == TVTIME_NOCOMMAND ) return;
+
+ if( cmd->menuactive && tvtime_is_menu_command( tvtime_cmd ) ) {
++ const int num_stations = station_get_num_stations( cmd->stationmgr );
++ const char *argument = tvtime_osd_list_get_enter_argument( cmd->osd, cmd->curmenupos + 1 );
+ int x, y, line;
+ switch( tvtime_cmd ) {
+ case TVTIME_MENU_EXIT:
+ menu_off( cmd );
+ break;
+ case TVTIME_MENU_UP:
+- cmd->curmenupos = (cmd->curmenupos + cmd->curmenusize - 1) % (cmd->curmenusize);
+- if( cmd->curusermenu ) menu_set_cursor( cmd->curusermenu, cmd->curmenupos );
+- display_current_menu( cmd );
++ if( cmd->channel_list_active && ( cmd->curmenupos == 0 ) ) {
++ if( !strcasecmp( argument, station_get_channel( cmd->stationmgr, 0 ) ) ) {
++ cmd->curmenupos = MAX_STATIONS - 1;
++ do {
++ cmd->channel_list = display_channel_list( cmd, cmd->osd, cmd->channel_list - 1 );
++ argument = tvtime_osd_list_get_enter_argument( cmd->osd, cmd->curmenupos + 1 );
++ } while( strcasecmp( argument, station_get_channel( cmd->stationmgr, num_stations - 1 ) ) );
++ } else {
++ cmd->channel_list = display_channel_list( cmd, cmd->osd, cmd->channel_list - 1 );
++ }
++ } else {
++ cmd->curmenupos = (cmd->curmenupos + cmd->curmenusize - 1) % (cmd->curmenusize);
++ if( cmd->curusermenu ) menu_set_cursor( cmd->curusermenu, cmd->curmenupos );
++ display_current_menu( cmd );
++ }
+ break;
+ case TVTIME_MENU_DOWN:
+- cmd->curmenupos = (cmd->curmenupos + 1) % (cmd->curmenusize);
+- if( cmd->curusermenu ) menu_set_cursor( cmd->curusermenu, cmd->curmenupos );
+- display_current_menu( cmd );
++ if( cmd->channel_list_active && ( cmd->curmenupos == MAX_STATIONS - 1 ) ) {
++ if( !strcasecmp( argument, station_get_channel( cmd->stationmgr, num_stations - 1 ) ) ) {
++ cmd->curmenupos = 0;
++ do {
++ cmd->channel_list = display_channel_list( cmd, cmd->osd, cmd->channel_list + 1 );
++ argument = tvtime_osd_list_get_enter_argument( cmd->osd, cmd->curmenupos + 1 );
++ } while( strcasecmp( argument, station_get_channel( cmd->stationmgr, 0 ) ) );
++ } else {
++ cmd->channel_list = display_channel_list( cmd, cmd->osd, cmd->channel_list + 1 );
++ }
++ } else {
++ cmd->curmenupos = (cmd->curmenupos + 1) % (cmd->curmenusize);
++ if( cmd->curusermenu ) menu_set_cursor( cmd->curusermenu, cmd->curmenupos );
++ display_current_menu( cmd );
++ }
+ break;
+ case TVTIME_MENU_BACK: menu_back( cmd ); break;
+ case TVTIME_MENU_ENTER: menu_enter( cmd ); break;
+@@ -2128,6 +2219,9 @@ void commands_handle( commands_t *cmd, i
+ menu_off( cmd );
+ }
+ break;
++ case TVTIME_CHANNEL_LIST:
++ menu_off( cmd );
++ break;
+ case TVTIME_MOUSE_MOVE:
+ sscanf( arg, "%d %d", &x, &y );
+ if( cmd->halfsize ) y *= 2;
+@@ -2213,6 +2307,24 @@ void commands_handle( commands_t *cmd, i
+ }
+ break;
+
++ case TVTIME_CHANNEL_LIST:
++ if( cmd->vidin && videoinput_has_tuner( cmd->vidin ) ) {
++ if( cmd->osd ) {
++ if( set_menu( cmd, "channel-list" ) ) {
++ cmd->channel_list_active = 1;
++ const int num_stations = station_get_num_stations( cmd->stationmgr );
++ if( station_get_current_pos( cmd->stationmgr ) < MAX_STATIONS ) {
++ cmd->channel_list = display_channel_list( cmd, cmd->osd,
++ atoi( station_get_channel( cmd->stationmgr, 0 ) ) );
++ } else {
++ cmd->channel_list = display_channel_list( cmd, cmd->osd,
++ station_get_current_pos( cmd->stationmgr ) - MAX_STATIONS + 2 );
++ }
++ }
++ }
++ }
++ break;
++
+ case TVTIME_SHOW_EPG:
+ if( cmd->vidin && videoinput_has_tuner( cmd->vidin ) ) {
+ if( cmd->osd ) {
+@@ -2897,8 +3009,10 @@ void commands_handle( commands_t *cmd, i
+ /* Decode the input char from commands. */
+ if( cmd->digit_counter == 0 ) memset( cmd->next_chan_buffer, 0, 5 );
+ cmd->next_chan_buffer[ cmd->digit_counter ] = arg[ 0 ];
+- cmd->digit_counter++;
+- cmd->frame_counter = cmd->delay;
++ if( first_digit( atoi( cmd->next_chan_buffer ) ) != 0 ) {
++ cmd->digit_counter++;
++ cmd->frame_counter = cmd->delay;
++ }
+
+ /**
+ * Send an enter command if we type more
+@@ -3365,21 +3479,46 @@ void commands_handle( commands_t *cmd, i
+
+ case TVTIME_ENTER:
+ if( cmd->next_chan_buffer[ 0 ] ) {
+- if( cmd->renumbering ) {
+- station_remap( cmd->stationmgr, atoi( cmd->next_chan_buffer ) );
+- station_writeconfig( cmd->stationmgr );
+- cmd->renumbering = 0;
+- if( cmd->osd ) tvtime_osd_set_hold_message( cmd->osd, "", 0 );
+- }
+- if( station_set( cmd->stationmgr, atoi( cmd->next_chan_buffer ) ) ) {
+- cmd->change_channel = 1;
+- } else {
+- snprintf( cmd->next_chan_buffer, sizeof( cmd->next_chan_buffer ),
+- "%d", station_get_current_id( cmd->stationmgr ) );
+- if( cmd->osd ) {
+- tvtime_osd_set_channel_number( cmd->osd, cmd->next_chan_buffer );
++ if( cmd->channel_list_active ) {
++ const char *argument = tvtime_osd_list_get_enter_argument( cmd->osd, cmd->curmenupos + 1 );
++ if( atoi( cmd->next_chan_buffer ) <= station_get_num_stations( cmd->stationmgr ) ) {
++ do {
++ if( atoi( cmd->next_chan_buffer ) < atoi( station_get_channel( cmd->stationmgr, atoi( argument ) - 1 ) ) ) {
++ commands_handle( cmd, TVTIME_MENU_UP, "" );
++ } else {
++ commands_handle( cmd, TVTIME_MENU_DOWN, "" );
++ }
++ argument = tvtime_osd_list_get_enter_argument( cmd->osd, cmd->curmenupos + 1 );
++ } while( strcasecmp( argument, station_get_channel( cmd->stationmgr, atoi( cmd->next_chan_buffer ) - 1 ) ) );
++ if( cmd->osd ) {
++ tvtime_osd_set_channel_number( cmd->osd, cmd->next_chan_buffer );
++ tvtime_osd_show_info( cmd->osd );
++ }
++ } else if( cmd->osd ) {
++ tvtime_osd_set_channel_number( cmd->osd, argument );
+ tvtime_osd_show_info( cmd->osd );
+ }
++ } else {
++ if( cmd->renumbering ) {
++ if( atoi( cmd->next_chan_buffer ) <= station_get_num_stations( cmd->stationmgr ) ) {
++ if( first_digit( atoi( cmd->next_chan_buffer ) ) != 0 ) {
++ station_remap( cmd->stationmgr, atoi( cmd->next_chan_buffer ) );
++ station_writeconfig( cmd->stationmgr );
++ cmd->renumbering = 0;
++ }
++ }
++ if( cmd->osd ) tvtime_osd_set_hold_message( cmd->osd, "", 0 );
++ }
++ if( station_set( cmd->stationmgr, atoi( cmd->next_chan_buffer ) ) ) {
++ cmd->change_channel = 1;
++ } else {
++ snprintf( cmd->next_chan_buffer, sizeof( cmd->next_chan_buffer ),
++ "%d", station_get_current_id( cmd->stationmgr ) );
++ if( cmd->osd ) {
++ tvtime_osd_set_channel_number( cmd->osd, cmd->next_chan_buffer );
++ tvtime_osd_show_info( cmd->osd );
++ }
++ }
+ }
+ } else {
+ if( cmd->renumbering ) {
+@@ -3501,12 +3640,24 @@ void commands_next_frame( commands_t *cm
+ if( cmd->osd ) tvtime_osd_set_hold_message( cmd->osd, "", 0 );
+ cmd->renumbering = 0;
+ }
++ if( cmd->channel_list_active ) {
++ snprintf( cmd->next_chan_buffer, sizeof( cmd->next_chan_buffer ),
++ "%d", station_get_current_id( cmd->stationmgr ) );
++ if( cmd->osd ) {
++ tvtime_osd_set_channel_number( cmd->osd, cmd->next_chan_buffer );
++ tvtime_osd_set_channel_name( cmd->osd, station_get_current_channel_name( cmd->stationmgr ) );
++ }
++ }
+ }
+
+ if( cmd->frame_counter > 0 && !(cmd->frame_counter % 5)) {
+ char input_text[6];
+
+- strcpy( input_text, cmd->next_chan_buffer );
++ if( first_digit( atoi( cmd->next_chan_buffer ) ) != 0 ) {
++ strcpy( input_text, cmd->next_chan_buffer );
++ } else {
++ strcpy( input_text, "" );
++ }
+ if( !(cmd->frame_counter % 10) ) {
+ strcat( input_text, "_" );
+ } else {
+@@ -3514,6 +3665,11 @@ void commands_next_frame( commands_t *cm
+ }
+ if( cmd->osd ) {
+ tvtime_osd_set_channel_number( cmd->osd, input_text );
++ if( cmd->channel_list_active ) {
++ tvtime_osd_set_channel_name( cmd->osd, "" );
++ tvtime_osd_show_program_info( cmd->osd, 0, 0, 0 );
++ tvtime_osd_set_info_available( cmd->osd, 0 );
++ }
+ tvtime_osd_show_info( cmd->osd );
+ }
+ }
+Index: tvtime-1.0.2/docs/man/de/tvtime-command.1
+===================================================================
+--- tvtime-1.0.2.orig/docs/man/de/tvtime-command.1
++++ tvtime-1.0.2/docs/man/de/tvtime-command.1
+@@ -86,6 +86,10 @@ zwischen zwei Sendern hin\- und herzuspr
+ auseinanderliegen.
+
+ .TP
++.B CHANNEL_LIST
++Dieser Befehl wird verwendet, um die Kanalliste.
++
++.TP
+ .B CHANNEL_RENUMBER
+ Verschiebt den aktuellen Kanal auf einen anderen Senderspeicher. Diese
+ Funktion tauscht den Speicherplatz des gerade aktiven Kanals mit dem, dessen
+Index: tvtime-1.0.2/docs/man/en/tvtime-command.1
+===================================================================
+--- tvtime-1.0.2.orig/docs/man/en/tvtime-command.1
++++ tvtime-1.0.2/docs/man/en/tvtime-command.1
+@@ -82,6 +82,10 @@ Changes to the last channel you were at.
+ forth between two programs on distant channels.
+
+ .TP
++.B CHANNEL_LIST
++This command is used to bring up channel list.
++
++.TP
+ .B CHANNEL_RENUMBER
+ Renumbers the current channel. This will swap the current channel with
+ the number you type in. Use this to configure your station list to suit
+Index: tvtime-1.0.2/docs/man/es/tvtime-command.1
+===================================================================
+--- tvtime-1.0.2.orig/docs/man/es/tvtime-command.1
++++ tvtime-1.0.2/docs/man/es/tvtime-command.1
+@@ -88,6 +88,10 @@ Cambia al canal que estabas viendo antes
+ para hacer zapping entre dos programas que están en canales distantes.
+
+ .TP
++.B CHANNEL_LIST
++Este comando se utiliza para mostrar la lista de canales.
++
++.TP
+ .B CHANNEL_RENUMBER
+ Renumera el canal actual. Intercambiará el canal actual con el número
+ que escribas. Úsalo para configurar tu lista de canales para acomodarla
+Index: tvtime-1.0.2/docs/man/de/tvtime.1
+===================================================================
+--- tvtime-1.0.2.orig/docs/man/de/tvtime.1
++++ tvtime-1.0.2/docs/man/de/tvtime.1
+@@ -72,6 +72,9 @@ Beenden
+ .I F1 oder Tab
+ Men anzeigen
+ .TP
++.I u
++Zeige Kanalliste
++.TP
+ .I hoch/runter
+ Sender whlen
+ .TP
+Index: tvtime-1.0.2/docs/man/en/tvtime.1
+===================================================================
+--- tvtime-1.0.2.orig/docs/man/en/tvtime.1
++++ tvtime-1.0.2/docs/man/en/tvtime.1
+@@ -69,6 +69,9 @@ Quit
+ .I F1 or tab
+ Show menu
+ .TP
++.I u
++Show channel list
++.TP
+ .I up/down
+ Change channels
+ .TP
+Index: tvtime-1.0.2/docs/man/es/tvtime.1
+===================================================================
+--- tvtime-1.0.2.orig/docs/man/es/tvtime.1
++++ tvtime-1.0.2/docs/man/es/tvtime.1
+@@ -75,6 +75,9 @@ Salir
+ .I F1 o tabulador
+ Mostrar men
+ .TP
++.I u
++Mostrar lista de canales
++.TP
+ .I up/down
+ Cambiar canal
+ .TP
--- tvtime-1.0.2.orig/debian/patches/tvtime-1.0.2-closed_caption.patch
+++ tvtime-1.0.2/debian/patches/tvtime-1.0.2-closed_caption.patch
@@ -0,0 +1,22 @@
+## Description: Import patch from tvtime sourceforge tracker related to CC double-byte chars.
+## Origin: upstream, http://sourceforge.net/tracker/?func=detail&aid=1564644&group_id=64301&atid=506989
+## Bug-Ubuntu:
+## Bug-Debian:
+## Author: Nick Duffek
+## Forwarded: not-needed
+Index: tvtime-1.0.2/src/vbidata.c
+===================================================================
+--- tvtime-1.0.2.orig/src/vbidata.c 2014-04-28 06:28:51.728907156 +0000
++++ tvtime-1.0.2/src/vbidata.c 2014-04-28 06:28:51.724907156 +0000
+@@ -603,7 +603,10 @@
+ return 0;
+ }
+
+- if( vbi->vs && vbi->enabled && b1 >= 0x10 && b1 <= 0x1F && b2 >= 0x20 && b2 <= 0x7F ) {
++ if( vbi->vs && vbi->enabled && b1 >= 0x10 && b1 <= 0x1F && b2 >= 0x20 && b2 <= 0x7F
++ /* Double-byte characters are distinguishable from control codes by
++ having bit 6 clear and bit 4 set. */
++ && (b2 & 0x50) != 0x10 ) {
+ int code;
+ if( (b2 & 64) ) {
+ /* Preamble Code */
--- tvtime-1.0.2.orig/debian/patches/tvtime-1.0.2-command.patch
+++ tvtime-1.0.2/debian/patches/tvtime-1.0.2-command.patch
@@ -0,0 +1,23 @@
+## Description: Fix crash on "tvtime-command set_input_width 720"
+## Origin: upstream, http://tvtime.cvs.sourceforge.net/viewvc/tvtime/tvtime/src/commands.c?r1=1.290&r2=1.291&view=patch
+## Bug-Ubuntu: http://launchpad.net/bugs/947850
+## Bug-Debian:
+## Author: Mikael Magnusson
+## Forwarded: not-needed
+Index: tvtime-1.0.2/src/commands.c
+===================================================================
+--- tvtime-1.0.2.orig/src/commands.c 2012-03-06 10:06:33.705435710 +0000
++++ tvtime-1.0.2/src/commands.c 2012-03-06 10:32:57.229388640 +0000
+@@ -2402,12 +2402,10 @@
+ case TVTIME_SET_INPUT_WIDTH:
+ cmd->newinputwidth = atoi( arg );
+ if( cmd->osd ) {
+- const char *curname = menu_get_name( cmd->curusermenu );
+ menu_t *sharpmenu = commands_get_menu( cmd, "hres" );
+ char message[ 128 ];
+ int maxw = cmd->vidin? videoinput_get_maxwidth( cmd->vidin ) : 0;
+ reset_inputwidth_menu( sharpmenu, cmd->newinputwidth, maxw );
+- curname = menu_get_name( cmd->curusermenu );
+ commands_refresh_menu( cmd );
+ snprintf( message, sizeof( message ),
+ _("Horizontal resolution will be %d pixels on restart."),
--- tvtime-1.0.2.orig/debian/patches/tvtime-1.0.2-cpuid.patch
+++ tvtime-1.0.2/debian/patches/tvtime-1.0.2-cpuid.patch
@@ -0,0 +1,55 @@
+## Description: Update for cpuaccel.c from http://stapelspeicher.org/tvtime/patches/ (originally from libmpeg2).
+## Origin: upstream, http://stapelspeicher.org/tvtime/patches/tvtime-cpuid.patch
+## Bug-Ubuntu:
+## Bug-Debian:
+## Author: Mikael Magnusson
+## Forwarded: not-needed
+Index: tvtime-1.0.2/src/cpu_accel.c
+===================================================================
+--- tvtime-1.0.2.orig/src/cpu_accel.c 2012-03-06 12:25:30.479258191 +0000
++++ tvtime-1.0.2/src/cpu_accel.c 2012-03-06 12:29:10.303251655 +0000
+@@ -35,7 +35,7 @@
+ int AMD;
+ uint32_t caps;
+
+-#ifndef PIC
++#if defined(__x86_64__) || (!defined(PIC) && !defined(__PIC__))
+ #define cpuid(op,eax,ebx,ecx,edx) \
+ __asm__ ("cpuid" \
+ : "=a" (eax), \
+@@ -44,7 +44,7 @@
+ "=d" (edx) \
+ : "a" (op) \
+ : "cc")
+-#else /* PIC version : save ebx */
++#else /* PIC version : save ebx (not needed on x86_64) */
+ #define cpuid(op,eax,ebx,ecx,edx) \
+ __asm__ ("pushl %%ebx\n\t" \
+ "cpuid\n\t" \
+@@ -58,17 +58,17 @@
+ : "cc")
+ #endif
+
+-#ifdef ARCH_386
+- __asm__ ("pushfl\n\t"
+- "pushfl\n\t"
+- "popl %0\n\t"
++#ifndef __x86_64__ /* x86_64 supports the cpuid op */
++ __asm__ ("pushf\n\t"
++ "pushf\n\t"
++ "pop %0\n\t"
+ "movl %0,%1\n\t"
+ "xorl $0x200000,%0\n\t"
+- "pushl %0\n\t"
+- "popfl\n\t"
+- "pushfl\n\t"
+- "popl %0\n\t"
+- "popfl"
++ "push %0\n\t"
++ "popf\n\t"
++ "pushf\n\t"
++ "pop %0\n\t"
++ "popf"
+ : "=r" (eax),
+ "=r" (ebx)
+ :
--- tvtime-1.0.2.orig/debian/patches/tvtime-1.0.2-cursor.patch
+++ tvtime-1.0.2/debian/patches/tvtime-1.0.2-cursor.patch
@@ -0,0 +1,34 @@
+## Description: Fix nocursor using uninitialized pixmap data.
+## Origin: upstream, http://tvtime.cvs.sourceforge.net/viewvc/tvtime/tvtime/src/xcommon.c?r1=1.69&r2=1.70&view=patch
+## Bug-Ubuntu:
+## Bug-Debian:
+## Author: Mikael Magnusson
+## Forwarded: not-needed
+Index: tvtime-1.0.2/src/xcommon.c
+===================================================================
+--- tvtime-1.0.2.orig/src/xcommon.c 2012-03-06 10:36:58.325381470 +0000
++++ tvtime-1.0.2/src/xcommon.c 2012-03-06 10:47:05.901363409 +0000
+@@ -827,7 +827,7 @@
+ XEvent xev;
+ XSizeHints hint;
+ XClassHint classhint;
+- XColor curs_col;
++ XColor curs_col = { 0 };
+ XSetWindowAttributes xswa;
+ const char *hello = "tvtime";
+ unsigned long mask;
+@@ -1081,13 +1081,7 @@
+ XMaskEvent( display, StructureNotifyMask, &xev );
+
+ /* Create a 1 pixel cursor to use in full screen mode */
+- curs_pix = XCreatePixmap( display, output_window, 1, 1, 1 );
+- curs_col.pixel = 0;
+- curs_col.red = 0;
+- curs_col.green = 0;
+- curs_col.blue = 0;
+- curs_col.flags = 0;
+- curs_col.pad = 0;
++ curs_pix = XCreateBitmapFromData( display, output_window, (const char []){0}, 1, 1 );
+ nocursor = XCreatePixmapCursor( display, curs_pix, curs_pix, &curs_col, &curs_col, 1, 1 );
+ XDefineCursor( display, output_window, nocursor );
+ XSetIconName( display, wm_window, "tvtime" );
--- tvtime-1.0.2.orig/debian/patches/tvtime-1.0.2-device.patch
+++ tvtime-1.0.2/debian/patches/tvtime-1.0.2-device.patch
@@ -0,0 +1,1119 @@
+Description: Add feature to auto detect video and vbi device(s).
+Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/tvtime/+bug/153801
+Author: POJAR GEORGE
+===================================================================
+Index: tvtime-1.0.2/src/get_media_devices.c
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ tvtime-1.0.2/src/get_media_devices.c 2014-04-28 06:30:36.596904039 +0000
+@@ -0,0 +1,605 @@
++/**
++ * Copyright © 2011 by Mauro Carvalho Chehab
++ *
++ * The get_media_devices is free software; you can redistribute it and/or
++ * modify it under the terms of the GNU Lesser General Public
++ * License as published by the Free Software Foundation; either
++ * version 2.1 of the License, or ( at your option ) any later version.
++ *
++ * The libv4l2util Library is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ * Lesser General Public License for more details.
++ *
++ * You should have received a copy of the GNU Lesser General Public
++ * License along with the libv4l2util Library; if not, write to the Free
++ * Software Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA
++ * 02110-1335 USA.
++ */
++
++#include
++#include
++#include
++#include
++#include
++#include
++#include |