# HG changeset patch # User aurel # Date 1126565294 0 # Node ID 8c1c8d10c163a7d00dd01930d7ad3e9b148d8891 # Parent 0c22fbbbc2c73e198fa936e3af49a1787ceab0e1 cycle through tv channels (patch by Andrew Calkin < calkina at geexbox.org >) diff -r 0c22fbbbc2c7 -r 8c1c8d10c163 libmpdemux/tv.c --- a/libmpdemux/tv.c Mon Sep 12 21:08:04 2005 +0000 +++ b/libmpdemux/tv.c Mon Sep 12 22:48:14 2005 +0000 @@ -738,22 +738,25 @@ 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);