summaryrefslogtreecommitdiffstats
path: root/libmpdemux
diff options
context:
space:
mode:
authoraurel <aurel@b3059339-0415-0410-9bf9-f77b7e298cf2>2005-09-12 22:48:14 +0000
committeraurel <aurel@b3059339-0415-0410-9bf9-f77b7e298cf2>2005-09-12 22:48:14 +0000
commitf8617ee059c415771e220428f0e616feb01e0b22 (patch)
treeeaa3ae058647070764e5e265d2f56baee405b46f /libmpdemux
parent2737167ecfbb67fe26c7e3787d8c494e1043796b (diff)
downloadmpv-f8617ee059c415771e220428f0e616feb01e0b22.tar.bz2
mpv-f8617ee059c415771e220428f0e616feb01e0b22.tar.xz
cycle through tv channels (patch by Andrew Calkin < calkina at geexbox.org >)
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@16470 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libmpdemux')
-rw-r--r--libmpdemux/tv.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/libmpdemux/tv.c b/libmpdemux/tv.c
index f6dca8b0ba..35213ce58d 100644
--- a/libmpdemux/tv.c
+++ b/libmpdemux/tv.c
@@ -738,22 +738,25 @@ int tv_step_channel_real(tvi_handle_t *tvh, int direction)
int tv_step_channel(tvi_handle_t *tvh, int direction) {
if (tv_channel_list) {
if (direction == TV_CHANNEL_HIGHER) {
- if (tv_channel_current->next) {
- tv_channel_last = tv_channel_current;
+ tv_channel_last = tv_channel_current;
+ if (tv_channel_current->next)
tv_channel_current = tv_channel_current->next;
+ else
+ tv_channel_current = tv_channel_list;
tv_set_freq(tvh, (unsigned long)(((float)tv_channel_current->freq/1000)*16));
mp_msg(MSGT_TV, MSGL_INFO, "Selected channel: %s - %s (freq: %.3f)\n",
tv_channel_current->number, tv_channel_current->name, (float)tv_channel_current->freq/1000);
- }
}
if (direction == TV_CHANNEL_LOWER) {
- if (tv_channel_current->prev) {
- tv_channel_last = tv_channel_current;
+ tv_channel_last = tv_channel_current;
+ if (tv_channel_current->prev)
tv_channel_current = tv_channel_current->prev;
+ else
+ while (tv_channel_current->next)
+ tv_channel_current = tv_channel_current->next;
tv_set_freq(tvh, (unsigned long)(((float)tv_channel_current->freq/1000)*16));
mp_msg(MSGT_TV, MSGL_INFO, "Selected channel: %s - %s (freq: %.3f)\n",
tv_channel_current->number, tv_channel_current->name, (float)tv_channel_current->freq/1000);
- }
}
} else tv_step_channel_real(tvh, direction);
return(1);