Index: stream/tv.c =================================================================== --- stream/tv.c (revision 25972) +++ stream/tv.c (working copy) @@ -36,8 +36,8 @@ #include "frequencies.h" -tv_channels_t *tv_channel_list; -tv_channels_t *tv_channel_current, *tv_channel_last; +static tv_channels_t *tv_channel_list; +static tv_channels_t *tv_channel_current, *tv_channel_last; char *tv_channel_last_real; /* enumerating drivers (like in stream.c) */ @@ -1050,6 +1050,14 @@ return(1); } +char* tv_get_currentchannel_name(tvi_handle_t *tvh) +{ + if (!tvh || !tv_channel_current) + return NULL; + + return tv_channel_current->name; +} + demuxer_desc_t demuxer_desc_tv = { "Tv card demuxer", "tv", Index: stream/tv.h =================================================================== --- stream/tv.h (revision 25972) +++ stream/tv.h (working copy) @@ -124,10 +124,6 @@ struct tv_channels_s *prev; } tv_channels_t; -extern tv_channels_t *tv_channel_list; -extern tv_channels_t *tv_channel_current, *tv_channel_last; -extern char *tv_channel_last_real; - typedef struct { unsigned int scan_timer; int channel_num; @@ -262,6 +258,9 @@ void tv_start_scan(tvi_handle_t *tvh, int start); +// Routine may return NULL +char* tv_get_currentchannel_name(tvi_handle_t *tvh); + #define TV_NORM_PAL 1 #define TV_NORM_NTSC 2 #define TV_NORM_SECAM 3 Index: command.c =================================================================== --- command.c (revision 25972) +++ command.c (working copy) @@ -2716,6 +2716,7 @@ case MP_CMD_TV_STEP_CHANNEL:{ if (mpctx->file_format == DEMUXER_TYPE_TV) { int v = cmd->args[0].v.i; + char* channel_name; if (v > 0) { tv_step_channel((tvi_handle_t *) (mpctx-> demuxer->priv), @@ -2725,9 +2726,10 @@ demuxer->priv), TV_CHANNEL_LOWER); } - if (tv_channel_list) { + channel_name=tv_get_currentchannel_name((tvi_handle_t *)mpctx->demuxer->priv); + if (channel_name) { set_osd_msg(OSD_MSG_TV_CHANNEL, 1, osd_duration, - MSGTR_OSDChannel, tv_channel_current->name); + MSGTR_OSDChannel, channel_name); //vo_osd_changed(OSDTYPE_SUBTITLE); } } @@ -2761,11 +2763,13 @@ case MP_CMD_TV_SET_CHANNEL: if (mpctx->file_format == DEMUXER_TYPE_TV) { + char* channel_name; tv_set_channel((tvi_handle_t *) (mpctx->demuxer->priv), cmd->args[0].v.s); - if (tv_channel_list) { + channel_name=tv_get_currentchannel_name((tvi_handle_t *)mpctx->demuxer->priv); + if (channel_name) { set_osd_msg(OSD_MSG_TV_CHANNEL, 1, osd_duration, - MSGTR_OSDChannel, tv_channel_current->name); + MSGTR_OSDChannel, channel_name); //vo_osd_changed(OSDTYPE_SUBTITLE); } } @@ -2793,10 +2797,12 @@ case MP_CMD_TV_LAST_CHANNEL: if (mpctx->file_format == DEMUXER_TYPE_TV) { + char* channel_name; tv_last_channel((tvi_handle_t *) (mpctx->demuxer->priv)); - if (tv_channel_list) { + channel_name=tv_get_currentchannel_name((tvi_handle_t *)mpctx->demuxer->priv); + if (channel_name) { set_osd_msg(OSD_MSG_TV_CHANNEL, 1, osd_duration, - MSGTR_OSDChannel, tv_channel_current->name); + MSGTR_OSDChannel, channel_name); //vo_osd_changed(OSDTYPE_SUBTITLE); } }