aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorvektor <devnull@localhost>2005-09-08 02:35:29 (GMT)
committervektor <devnull@localhost>2005-09-08 02:35:29 (GMT)
commit08758928037555c905a9455bd7d4f78181946d8c (patch)
treee2080639a79e810e5322b4aca679b94a377cb490
parent30ef2537d4ea5a13fcebab485d46354f9f5e95ef (diff)
* tvtime/src/videoinput.h: More workarounds for the cx88 driver. Add a
PAL-I audio mode since the driver cannot autodetect this. * tvtime/src/videoinput.c: Support PAL-I. * tvtime/src/station.c: Fixes to allow "i" as an audio mode in the stationlist.xml file. * tvtime/src/commands.c: Update the DK commands to also toggle PAL-I. * tvtime/ChangeLog: Note this change. * tvtime/NEWS: Explain the situation.
-rw-r--r--ChangeLog2
-rw-r--r--NEWS4
-rw-r--r--src/commands.c81
-rw-r--r--src/station.c10
-rw-r--r--src/videoinput.c25
-rw-r--r--src/videoinput.h13
6 files changed, 90 insertions, 45 deletions
diff --git a/ChangeLog b/ChangeLog
index bde83b6..f4bebf5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,6 @@
1.0 -
+ * vektor: Add a PAL-I setting to the BG/DK/I mess. This is required
+ to work around limitations of the cx88 driver.
* vektor: Update the Channel config file parameter as the channel
changes, rather than once on shutdown. Feature requested by
Andrew Oikle.
diff --git a/NEWS b/NEWS
index 40b1c86..877be01 100644
--- a/NEWS
+++ b/NEWS
@@ -6,6 +6,10 @@ For news and updates on tvtime, please visit our website at:
News for 1.0
+ * The cx88 driver cannot detect the PAL audio mode (BG/DK/I),
+ and attempts to reverse engineer the Windows driver have failed.
+ tvtime now allows users to select between BG/DK/I mode in the
+ UI to help work around this driver limitation.
* By default, tvtime now assumes that pixels are square. This
avoids problems with many misconfigured X servers.
diff --git a/src/commands.c b/src/commands.c
index 87b7b42..0d54200 100644
--- a/src/commands.c
+++ b/src/commands.c
@@ -377,17 +377,15 @@ static void reset_stations_menu( menu_t *menu, int ntsc, int pal, int secam,
}
if( pal && v4l2 ) {
- if( default_paldk ) {
- snprintf( string, sizeof( string ), !paldk ?
- TVTIME_ICON_GENERALTOGGLEON " %s" :
- TVTIME_ICON_GENERALTOGGLEOFF " %s",
- _("Use PAL-BG audio decoding") );
- } else {
- snprintf( string, sizeof( string ), paldk ?
- TVTIME_ICON_GENERALTOGGLEON " %s" :
- TVTIME_ICON_GENERALTOGGLEOFF " %s",
- _("Use PAL-DK audio decoding") );
+ const char *amode = "PAL-BG";
+ if( paldk == VIDEOINPUT_PAL_I_AUDIO ) {
+ amode = "PAL-I";
+ } else if( paldk == VIDEOINPUT_PAL_DK_AUDIO ) {
+ amode = "PAL-DK";
}
+ snprintf( string, sizeof( string ),
+ TVTIME_ICON_VIDEOINPUT " %s (%s)",
+ _("Switch audio standard"), amode );
menu_set_text( menu, cur, string );
menu_set_enter_command( menu, cur, TVTIME_TOGGLE_CHANNEL_PAL_DK, "" );
cur++;
@@ -549,7 +547,9 @@ static void reinit_tuner( commands_t *cmd )
!strcasecmp( cmd->newfreqtable, "us-cable100" )),
station_get_current_active( cmd->stationmgr ), cmd->checkfreq,
cmd->scan_channels,
- videoinput_is_v4l2( cmd->vidin ), station_get_default_audio_norm( cmd->stationmgr ), station_get_current_audio_norm( cmd->stationmgr ) );
+ videoinput_is_v4l2( cmd->vidin ),
+ station_get_default_audio_norm( cmd->stationmgr ),
+ station_get_current_audio_norm( cmd->stationmgr ) );
commands_refresh_menu( cmd );
}
cmd->frame_counter = 0;
@@ -613,11 +613,16 @@ static void reset_pal_input_menu( menu_t *menu, videoinput_t *vidin, station_mgr
cur++;
if( videoinput_is_v4l2( vidin ) ) {
- int dk_default = station_get_default_audio_norm( stationmgr );
- snprintf( string, sizeof( string ), dk_default ?
- TVTIME_ICON_GENERALTOGGLEON " %s" :
- TVTIME_ICON_GENERALTOGGLEOFF " %s",
- _("Default to PAL-DK audio decoding") );
+ const char *curnorm = "PAL-BG";
+ int defnorm = station_get_default_audio_norm( stationmgr );
+ if( defnorm == VIDEOINPUT_PAL_I_AUDIO ) {
+ curnorm = "PAL-I";
+ } else if( defnorm == VIDEOINPUT_PAL_DK_AUDIO ) {
+ curnorm = "PAL-DK";
+ }
+ snprintf( string, sizeof( string ),
+ TVTIME_ICON_TVPGICON " %s (%s)",
+ _("Change default audio standard"), curnorm );
menu_set_text( menu, cur, string );
menu_set_enter_command( menu, cur, TVTIME_TOGGLE_PAL_DK_AUDIO, "" );
cur++;
@@ -1242,7 +1247,9 @@ commands_t *commands_new( config_t *cfg, videoinput_t *vidin,
!strcasecmp( cmd->newfreqtable, "us-cable100" )),
station_get_current_active( cmd->stationmgr ),
cmd->checkfreq, cmd->scan_channels,
- videoinput_is_v4l2( cmd->vidin ), station_get_default_audio_norm( cmd->stationmgr ), station_get_current_audio_norm( cmd->stationmgr ) );
+ videoinput_is_v4l2( cmd->vidin ),
+ station_get_default_audio_norm( cmd->stationmgr ),
+ station_get_current_audio_norm( cmd->stationmgr ) );
}
menu = menu_new( "frequencies" );
@@ -2227,18 +2234,21 @@ void commands_handle( commands_t *cmd, int tvtime_cmd, const char *arg )
case TVTIME_TOGGLE_CHANNEL_PAL_DK:
if( cmd->vidin ) {
- int is_dk = station_get_current_audio_norm( cmd->stationmgr );
- station_set_current_audio_norm( cmd->stationmgr, !is_dk );
+ int new_mode = (station_get_current_audio_norm( cmd->stationmgr ) + 1) % 3;
+ station_set_current_audio_norm( cmd->stationmgr, new_mode );
videoinput_set_pal_audio_mode( cmd->vidin,
station_get_current_audio_norm( cmd->stationmgr ) );
if( cmd->osd ) {
char message[ 128 ];
- if( is_dk ) {
+ if( new_mode == VIDEOINPUT_PAL_I_AUDIO ) {
snprintf( message, sizeof( message ),
- _("Using PAL-BG audio decoding for this channel.") );
- } else {
+ _("Using PAL-I audio decoding for this channel.") );
+ } else if( new_mode == VIDEOINPUT_PAL_DK_AUDIO ) {
snprintf( message, sizeof( message ),
_("Using PAL-DK audio decoding for this channel.") );
+ } else {
+ snprintf( message, sizeof( message ),
+ _("Using PAL-BG audio decoding for this channel.") );
}
reset_stations_menu( commands_get_menu( cmd, "stations" ),
(videoinput_get_norm( cmd->vidin ) == VIDEOINPUT_NTSC ||
@@ -2249,7 +2259,9 @@ void commands_handle( commands_t *cmd, int tvtime_cmd, const char *arg )
!strcasecmp( cmd->newfreqtable, "us-cable100" )),
station_get_current_active( cmd->stationmgr ), cmd->checkfreq,
cmd->scan_channels,
- videoinput_is_v4l2( cmd->vidin ), station_get_default_audio_norm( cmd->stationmgr ), station_get_current_audio_norm( cmd->stationmgr ) );
+ videoinput_is_v4l2( cmd->vidin ),
+ station_get_default_audio_norm( cmd->stationmgr ),
+ station_get_current_audio_norm( cmd->stationmgr ) );
commands_refresh_menu( cmd );
tvtime_osd_show_message( cmd->osd, message );
}
@@ -2260,12 +2272,15 @@ void commands_handle( commands_t *cmd, int tvtime_cmd, const char *arg )
if( cmd->vidin ) {
int dk_default = station_get_default_audio_norm( cmd->stationmgr );
char message[ 128 ];
- dk_default = !dk_default;
+ dk_default = (dk_default + 1) % 3;
station_set_default_audio_norm( cmd->stationmgr, dk_default );
videoinput_set_pal_audio_mode( cmd->vidin,
station_get_current_audio_norm( cmd->stationmgr ) );
if( cmd->osd ) {
- if( dk_default ) {
+ if( dk_default == VIDEOINPUT_PAL_I_AUDIO ) {
+ snprintf( message, sizeof( message ),
+ _("Defaulting to PAL-I audio decoding.") );
+ } else if( dk_default == VIDEOINPUT_PAL_DK_AUDIO ) {
snprintf( message, sizeof( message ),
_("Defaulting to PAL-DK audio decoding.") );
} else {
@@ -2313,7 +2328,9 @@ void commands_handle( commands_t *cmd, int tvtime_cmd, const char *arg )
!strcasecmp( cmd->newfreqtable, "us-cable100" )),
station_get_current_active( cmd->stationmgr ), cmd->checkfreq,
cmd->scan_channels,
- videoinput_is_v4l2( cmd->vidin ), station_get_default_audio_norm( cmd->stationmgr ), station_get_current_audio_norm( cmd->stationmgr ) );
+ videoinput_is_v4l2( cmd->vidin ),
+ station_get_default_audio_norm( cmd->stationmgr ),
+ station_get_current_audio_norm( cmd->stationmgr ) );
commands_refresh_menu( cmd );
station_writeconfig( cmd->stationmgr );
}
@@ -2572,7 +2589,9 @@ void commands_handle( commands_t *cmd, int tvtime_cmd, const char *arg )
!strcasecmp( cmd->newfreqtable, "us-cable100" )),
station_get_current_active( cmd->stationmgr ), cmd->checkfreq,
cmd->scan_channels,
- videoinput_is_v4l2( cmd->vidin ), station_get_default_audio_norm( cmd->stationmgr ), station_get_current_audio_norm( cmd->stationmgr ) );
+ videoinput_is_v4l2( cmd->vidin ),
+ station_get_default_audio_norm( cmd->stationmgr ),
+ station_get_current_audio_norm( cmd->stationmgr ) );
commands_refresh_menu( cmd );
if( cmd->scan_channels ) {
@@ -2642,7 +2661,9 @@ void commands_handle( commands_t *cmd, int tvtime_cmd, const char *arg )
!strcasecmp( cmd->newfreqtable, "us-cable100" )),
station_get_current_active( cmd->stationmgr ), cmd->checkfreq,
cmd->scan_channels,
- videoinput_is_v4l2( cmd->vidin ), station_get_default_audio_norm( cmd->stationmgr ), station_get_current_audio_norm( cmd->stationmgr ) );
+ videoinput_is_v4l2( cmd->vidin ),
+ station_get_default_audio_norm( cmd->stationmgr ),
+ station_get_current_audio_norm( cmd->stationmgr ) );
commands_refresh_menu( cmd );
}
@@ -2750,7 +2771,9 @@ void commands_handle( commands_t *cmd, int tvtime_cmd, const char *arg )
!strcasecmp( cmd->newfreqtable, "us-cable100" )),
station_get_current_active( cmd->stationmgr ), cmd->checkfreq,
cmd->scan_channels,
- videoinput_is_v4l2( cmd->vidin ), station_get_default_audio_norm( cmd->stationmgr ), station_get_current_audio_norm( cmd->stationmgr ) );
+ videoinput_is_v4l2( cmd->vidin ),
+ station_get_default_audio_norm( cmd->stationmgr ),
+ station_get_current_audio_norm( cmd->stationmgr ) );
if( cmd->checkfreq ) {
tvtime_osd_show_message( cmd->osd,
_("Signal detection enabled.") );
diff --git a/src/station.c b/src/station.c
index a47c2a8..3083bb8 100644
--- a/src/station.c
+++ b/src/station.c
@@ -623,7 +623,9 @@ void station_toggle_us_cable_mode( station_mgr_t *mgr )
void station_set_default_audio_norm( station_mgr_t *mgr, int dk )
{
- if( dk ) {
+ if( dk == 2 ) {
+ sprintf( mgr->audio, "i" );
+ } else if( dk ) {
sprintf( mgr->audio, "dk" );
} else {
sprintf( mgr->audio, "bg" );
@@ -632,6 +634,7 @@ void station_set_default_audio_norm( station_mgr_t *mgr, int dk )
int station_get_default_audio_norm( station_mgr_t *mgr )
{
+ if ( !strcasecmp( mgr->audio, "i" ) ) return 2;
return !strcasecmp( mgr->audio, "dk" );
}
@@ -805,6 +808,7 @@ int station_get_current_audio_norm( station_mgr_t *mgr )
str = mgr->audio;
}
+ if( !strcasecmp( str, "i" ) ) return 2;
return !strcasecmp( str, "dk" );
}
@@ -813,7 +817,9 @@ void station_set_current_audio_norm( station_mgr_t *mgr, int dk )
if( mgr->current ) {
if( dk < 0 ) {
sprintf( mgr->current->audio, "auto" );
- } else if( dk ) {
+ } else if( dk == 2 ) {
+ sprintf( mgr->current->audio, "i" );
+ } else if( dk == 1 ) {
sprintf( mgr->current->audio, "dk" );
} else {
sprintf( mgr->current->audio, "bg" );
diff --git a/src/videoinput.c b/src/videoinput.c
index c46ae2e..fe2c56b 100644
--- a/src/videoinput.c
+++ b/src/videoinput.c
@@ -191,7 +191,7 @@ struct videoinput_s
int maxwidth;
int norm;
int volume;
- int dkmode;
+ int amode;
int isbttv;
int isv4l2;
@@ -452,7 +452,7 @@ videoinput_t *videoinput_new( const char *v4l_device, int capwidth,
vidin->verbose = verbose;
vidin->norm = norm;
vidin->volume = volume;
- vidin->dkmode = 0;
+ vidin->amode = 0;
vidin->height = videoinput_get_norm_height( norm );
vidin->cur_tuner_state = TUNER_STATE_NO_SIGNAL;
@@ -883,9 +883,8 @@ videoinput_t *videoinput_new( const char *v4l_device, int capwidth,
vidin->grab_buf[ i ].height = vidin->height;
}
- vidin->map = (uint8_t *) mmap( 0, vidin->gb_buffers.size,
- PROT_READ|PROT_WRITE,
- MAP_SHARED, vidin->grab_fd, 0 );
+ vidin->map = mmap( 0, vidin->gb_buffers.size, PROT_READ|PROT_WRITE,
+ MAP_SHARED, vidin->grab_fd, 0 );
if( vidin->map != MAP_FAILED ) {
vidin->have_mmap = 1;
videoinput_free_all_frames( vidin );
@@ -1520,8 +1519,12 @@ void videoinput_set_input_num( videoinput_t *vidin, int inputnum )
strerror( errno ) );
} else {
std = videoinput_get_v4l2_norm( vidin->norm );
- if( std == V4L2_STD_PAL && vidin->dkmode ) {
- std = V4L2_STD_PAL_DK;
+ if( std == V4L2_STD_PAL ) {
+ if( vidin->amode == VIDEOINPUT_PAL_DK_AUDIO ) {
+ std = V4L2_STD_PAL_DK;
+ } else if( vidin->amode == VIDEOINPUT_PAL_I_AUDIO ) {
+ std = V4L2_STD_PAL_I;
+ }
}
if( ioctl( vidin->grab_fd, VIDIOC_S_STD, &std ) < 0 ) {
fprintf( stderr, "videoinput: Driver refuses to set norm: %s\n",
@@ -1658,10 +1661,10 @@ int videoinput_get_audio_mode( videoinput_t *vidin )
}
}
-void videoinput_set_pal_audio_mode( videoinput_t *vidin, int dkmode )
+void videoinput_set_pal_audio_mode( videoinput_t *vidin, int amode )
{
- if( dkmode != vidin->dkmode && vidin->norm == VIDEOINPUT_PAL ) {
- vidin->dkmode = dkmode;
+ if( amode != vidin->amode && vidin->norm == VIDEOINPUT_PAL ) {
+ vidin->amode = amode;
videoinput_set_input_num( vidin, videoinput_get_input_num( vidin ) );
}
}
@@ -1669,7 +1672,7 @@ void videoinput_set_pal_audio_mode( videoinput_t *vidin, int dkmode )
int videoinput_get_pal_audio_mode( videoinput_t *vidin )
{
if( !vidin ) return 0;
- return vidin->dkmode;
+ return vidin->amode;
}
int videoinput_has_tuner( videoinput_t *vidin )
diff --git a/src/videoinput.h b/src/videoinput.h
index b639b85..a2c0c1a 100644
--- a/src/videoinput.h
+++ b/src/videoinput.h
@@ -72,6 +72,13 @@ typedef struct videoinput_s videoinput_t;
#define VIDEOINPUT_LANG2 8
/**
+ * Possible PAL audio modes, for the cx88 driver that cannot autodetect.
+ */
+#define VIDEOINPUT_PAL_BG_AUDIO 0
+#define VIDEOINPUT_PAL_DK_AUDIO 1
+#define VIDEOINPUT_PAL_I_AUDIO 2
+
+/**
* Returns a text version of the norm.
*/
const char *videoinput_get_norm_name( int norm );
@@ -255,12 +262,12 @@ void videoinput_toggle_pal_secam( videoinput_t *vidin );
void videoinput_switch_pal_secam( videoinput_t *vidin, int norm );
/**
- * Whether or not to use PAL_DK mode. Only applies to V4L2.
+ * Selects the PAL audio mode. Only applies to the cx88 driver.
*/
-void videoinput_set_pal_audio_mode( videoinput_t *vidin, int dkmode );
+void videoinput_set_pal_audio_mode( videoinput_t *vidin, int amode );
/**
- * Get pal_dk mode current value.
+ * Gets the current PAL audio mode.
*/
int videoinput_get_pal_audio_mode( videoinput_t *vidin );

Privacy Policy