aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorvektor <devnull@localhost>2005-09-08 01:15:13 (GMT)
committervektor <devnull@localhost>2005-09-08 01:15:13 (GMT)
commit56ffc42c4455ff2aadf41735ac14ee5b23cfdff3 (patch)
tree1a42ad29553c072b5d00be4d6e5fc42af6d664ab
parent173615d6564c9128c718945c94919b10c5372480 (diff)
* tvtime/src/tvtimeosd.h: Extend the hold message API to allow for
an additional message line. Fix bugs where we weren't showing the hold message when we should have. * tvtime/src/tvtimeosd.c: Implementation. * tvtime/src/commands.c: Just pass 0 for the second string everywhere. * tvtime/src/tvtime.c: When the capture card cannot be opened, include the errno string in the UI.
-rw-r--r--src/commands.c14
-rw-r--r--src/tvtime.c10
-rw-r--r--src/tvtimeosd.c32
-rw-r--r--src/tvtimeosd.h2
4 files changed, 39 insertions, 19 deletions
diff --git a/src/commands.c b/src/commands.c
index 77bc812..87b7b42 100644
--- a/src/commands.c
+++ b/src/commands.c
@@ -2539,7 +2539,7 @@ void commands_handle( commands_t *cmd, int tvtime_cmd, const char *arg )
snprintf( message, sizeof( message ),
_("Remapping %d. Enter new channel number."),
station_get_current_id( cmd->stationmgr ) );
- tvtime_osd_set_hold_message( cmd->osd, message );
+ tvtime_osd_set_hold_message( cmd->osd, message, 0 );
}
}
break;
@@ -2558,7 +2558,7 @@ void commands_handle( commands_t *cmd, int tvtime_cmd, const char *arg )
memset( cmd->next_chan_buffer, 0, 5 );
cmd->digit_counter = 0;
cmd->frame_counter = 0;
- if( cmd->osd ) tvtime_osd_set_hold_message( cmd->osd, "" );
+ if( cmd->osd ) tvtime_osd_set_hold_message( cmd->osd, "", 0 );
cmd->renumbering = 0;
}
@@ -2577,10 +2577,10 @@ void commands_handle( commands_t *cmd, int tvtime_cmd, const char *arg )
if( cmd->scan_channels ) {
tvtime_osd_set_hold_message( cmd->osd,
- _("Scanning for channels being broadcast.") );
+ _("Scanning for channels being broadcast."), 0 );
} else {
/* Nuke the hold message, and make sure we show nothing (hack). */
- tvtime_osd_set_hold_message( cmd->osd, "" );
+ tvtime_osd_set_hold_message( cmd->osd, "", 0 );
tvtime_osd_show_message( cmd->osd, " " );
}
tvtime_osd_show_info( cmd->osd );
@@ -3259,7 +3259,7 @@ void commands_handle( commands_t *cmd, int tvtime_cmd, const char *arg )
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, "" );
+ 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;
@@ -3274,7 +3274,7 @@ void commands_handle( commands_t *cmd, int tvtime_cmd, const char *arg )
} else {
if( cmd->renumbering ) {
cmd->renumbering = 0;
- if( cmd->osd ) tvtime_osd_set_hold_message( cmd->osd, "" );
+ if( cmd->osd ) tvtime_osd_set_hold_message( cmd->osd, "", 0 );
}
snprintf( cmd->next_chan_buffer, sizeof( cmd->next_chan_buffer ),
"%d", station_get_current_id( cmd->stationmgr ) );
@@ -3388,7 +3388,7 @@ void commands_next_frame( commands_t *cmd )
memset( cmd->next_chan_buffer, 0, 5 );
cmd->digit_counter = 0;
if( cmd->renumbering ) {
- if( cmd->osd ) tvtime_osd_set_hold_message( cmd->osd, "" );
+ if( cmd->osd ) tvtime_osd_set_hold_message( cmd->osd, "", 0 );
cmd->renumbering = 0;
}
}
diff --git a/src/tvtime.c b/src/tvtime.c
index 0dc3ed5..2c70041 100644
--- a/src/tvtime.c
+++ b/src/tvtime.c
@@ -1193,6 +1193,7 @@ int tvtime_main( rtctimer_t *rtctimer, int read_stdin, int realtime,
int kbd_pos = 0;
int kbd_available;
char *error_string = 0;
+ char *error_string2 = 0;
double pixel_aspect;
char number[ 6 ];
tvtime_t *tvtime;
@@ -1327,6 +1328,9 @@ int tvtime_main( rtctimer_t *rtctimer, int read_stdin, int realtime,
config_get_v4l_device( ct ) ) < 0 ) {
error_string = 0;
}
+ if( asprintf( &error_string2, "%s", strerror( errno ) ) < 0 ) {
+ error_string2 = 0;
+ }
} else if( videoinput_get_numframes( vidin ) < 2 ) {
lfprintf( stderr, _("\n"
" Your capture card driver, %s, does not seem\n"
@@ -1458,8 +1462,7 @@ int tvtime_main( rtctimer_t *rtctimer, int read_stdin, int realtime,
}
if( vidin ) {
tvtime_osd_set_input( osd, videoinput_get_input_name( vidin ) );
- tvtime_osd_set_norm
- ( osd,
+ tvtime_osd_set_norm( osd,
videoinput_get_norm_name( videoinput_get_norm( vidin ) ) );
} else {
tvtime_osd_set_input( osd, _("No video source") );
@@ -1467,8 +1470,9 @@ int tvtime_main( rtctimer_t *rtctimer, int read_stdin, int realtime,
}
if( error_string ) {
- tvtime_osd_set_hold_message( osd, error_string );
+ tvtime_osd_set_hold_message( osd, error_string2, error_string );
tvtime_osd_hold( osd, 1 );
+ tvtime_osd_show_info( osd );
free( error_string );
error_string = 0;
}
diff --git a/src/tvtimeosd.c b/src/tvtimeosd.c
index 13af2f5..d5fb4aa 100644
--- a/src/tvtimeosd.c
+++ b/src/tvtimeosd.c
@@ -114,6 +114,7 @@ struct tvtime_osd_s
char show_info[ 128 ];
char hold_message[ 255 ];
+ char hold_message2[ 255 ];
int film_mode;
int info_available;
@@ -168,6 +169,7 @@ tvtime_osd_t *tvtime_osd_new( int width, int height, double pixel_aspect,
}
strcpy( osd->hold_message, "" );
+ strcpy( osd->hold_message2, "" );
osd->film_mode = -1;
osd->pulldown_mode = 0;
osd->mutestate = 0;
@@ -525,8 +527,10 @@ void tvtime_osd_clear( tvtime_osd_t *osd )
{
int i;
- for( i = 0; i < OSD_MAX_STRING_OBJECTS; i++ ) {
- osd_string_set_timeout( osd->strings[ i ].string, 0 );
+ if (!osd->hold) {
+ for( i = 0; i < OSD_MAX_STRING_OBJECTS; i++ ) {
+ osd_string_set_timeout( osd->strings[ i ].string, 0 );
+ }
}
if( osd->film_logo ) osd_animation_set_timeout( osd->film_logo, 0 );
if( osd->info_icon ) osd_animation_set_timeout( osd->info_icon, 0 );
@@ -613,9 +617,14 @@ void tvtime_osd_signal_present( tvtime_osd_t *osd, int signal )
osd_string_set_timeout( osd->strings[ OSD_SIGNAL_INFO ].string, signal ? 0 : 100 );
}
-void tvtime_osd_set_hold_message( tvtime_osd_t* osd, const char *str )
+void tvtime_osd_set_hold_message( tvtime_osd_t *osd, const char *text, const char *text2 )
{
- snprintf( osd->hold_message, sizeof( osd->hold_message ), "%s", str );
+ snprintf( osd->hold_message, sizeof( osd->hold_message ), "%s", text );
+ if( text2 ) {
+ snprintf( osd->hold_message2, sizeof( osd->hold_message2 ), "%s", text2 );
+ } else {
+ *osd->hold_message2 = 0;
+ }
}
void tvtime_osd_set_network_name( tvtime_osd_t* osd, const char *str )
@@ -691,7 +700,12 @@ void tvtime_osd_show_info( tvtime_osd_t *osd )
if( *(osd->hold_message) ) {
snprintf( text, sizeof( text ), "%s", osd->hold_message );
osd_string_show_text( osd->strings[ OSD_MESSAGE1_BAR ].string, text, osd->delay );
- osd_string_set_timeout( osd->strings[ OSD_MESSAGE2_BAR ].string, 0 );
+ if( *(osd->hold_message2) ) {
+ snprintf( text, sizeof( text ), "%s", osd->hold_message2 );
+ osd_string_show_text( osd->strings[ OSD_MESSAGE2_BAR ].string, text, osd->delay );
+ } else {
+ osd_string_set_timeout( osd->strings[ OSD_MESSAGE2_BAR ].string, 0 );
+ }
osd_string_set_timeout( osd->strings[ OSD_DATA_VALUE ].string, 0 );
osd_rect_set_timeout( osd->databar, 0 );
osd_rect_set_timeout( osd->databarbg, 0 );
@@ -871,8 +885,10 @@ void tvtime_osd_advance_frame( tvtime_osd_t *osd )
gettimeofday( &tv, 0 );
}
- for( i = 0; i < OSD_MAX_STRING_OBJECTS; i++ ) {
- osd_string_advance_frame( osd->strings[ i ].string );
+ if (!osd->hold) {
+ for( i = 0; i < OSD_MAX_STRING_OBJECTS; i++ ) {
+ osd_string_advance_frame( osd->strings[ i ].string );
+ }
}
if( osd->film_logo ) osd_animation_advance_frame( osd->film_logo );
@@ -891,7 +907,7 @@ void tvtime_osd_composite_packed422_scanline( tvtime_osd_t *osd,
int i;
for( i = 0; i < OSD_MAX_STRING_OBJECTS; i++ ) {
- if( osd_string_visible( osd->strings[ i ].string ) ) {
+ if( osd->hold || osd_string_visible( osd->strings[ i ].string ) ) {
int start = osd->strings[ i ].ypos;
int end = start + osd_string_get_height( osd->strings[ i ].string );
diff --git a/src/tvtimeosd.h b/src/tvtimeosd.h
index e237d05..0459d49 100644
--- a/src/tvtimeosd.h
+++ b/src/tvtimeosd.h
@@ -68,7 +68,7 @@ void tvtime_osd_set_audio_mode( tvtime_osd_t *osd, const char *audiomode );
void tvtime_osd_set_input( tvtime_osd_t *osd, const char *text );
void tvtime_osd_set_channel_number( tvtime_osd_t *osd, const char *text );
void tvtime_osd_set_channel_name( tvtime_osd_t *osd, const char *text );
-void tvtime_osd_set_hold_message( tvtime_osd_t *osd, const char *text );
+void tvtime_osd_set_hold_message( tvtime_osd_t *osd, const char *text, const char *text2 );
void tvtime_osd_set_deinterlace_method( tvtime_osd_t *osd, const char *method );
void tvtime_osd_set_film_mode( tvtime_osd_t *osd, int mode );
void tvtime_osd_set_info_available( tvtime_osd_t *osd, int mode );

Privacy Policy