Mercurial > mplayer.hg
comparison libmpdemux/tv.c @ 16469:8c1c8d10c163
cycle through tv channels (patch by Andrew Calkin < calkina at geexbox.org >)
author | aurel |
---|---|
date | Mon, 12 Sep 2005 22:48:14 +0000 |
parents | 6b86089c2edd |
children | 8b5a4d2dcc2b |
comparison
equal
deleted
inserted
replaced
16468:0c22fbbbc2c7 | 16469:8c1c8d10c163 |
---|---|
736 } | 736 } |
737 | 737 |
738 int tv_step_channel(tvi_handle_t *tvh, int direction) { | 738 int tv_step_channel(tvi_handle_t *tvh, int direction) { |
739 if (tv_channel_list) { | 739 if (tv_channel_list) { |
740 if (direction == TV_CHANNEL_HIGHER) { | 740 if (direction == TV_CHANNEL_HIGHER) { |
741 if (tv_channel_current->next) { | 741 tv_channel_last = tv_channel_current; |
742 tv_channel_last = tv_channel_current; | 742 if (tv_channel_current->next) |
743 tv_channel_current = tv_channel_current->next; | 743 tv_channel_current = tv_channel_current->next; |
744 else | |
745 tv_channel_current = tv_channel_list; | |
744 tv_set_freq(tvh, (unsigned long)(((float)tv_channel_current->freq/1000)*16)); | 746 tv_set_freq(tvh, (unsigned long)(((float)tv_channel_current->freq/1000)*16)); |
745 mp_msg(MSGT_TV, MSGL_INFO, "Selected channel: %s - %s (freq: %.3f)\n", | 747 mp_msg(MSGT_TV, MSGL_INFO, "Selected channel: %s - %s (freq: %.3f)\n", |
746 tv_channel_current->number, tv_channel_current->name, (float)tv_channel_current->freq/1000); | 748 tv_channel_current->number, tv_channel_current->name, (float)tv_channel_current->freq/1000); |
747 } | |
748 } | 749 } |
749 if (direction == TV_CHANNEL_LOWER) { | 750 if (direction == TV_CHANNEL_LOWER) { |
750 if (tv_channel_current->prev) { | 751 tv_channel_last = tv_channel_current; |
751 tv_channel_last = tv_channel_current; | 752 if (tv_channel_current->prev) |
752 tv_channel_current = tv_channel_current->prev; | 753 tv_channel_current = tv_channel_current->prev; |
754 else | |
755 while (tv_channel_current->next) | |
756 tv_channel_current = tv_channel_current->next; | |
753 tv_set_freq(tvh, (unsigned long)(((float)tv_channel_current->freq/1000)*16)); | 757 tv_set_freq(tvh, (unsigned long)(((float)tv_channel_current->freq/1000)*16)); |
754 mp_msg(MSGT_TV, MSGL_INFO, "Selected channel: %s - %s (freq: %.3f)\n", | 758 mp_msg(MSGT_TV, MSGL_INFO, "Selected channel: %s - %s (freq: %.3f)\n", |
755 tv_channel_current->number, tv_channel_current->name, (float)tv_channel_current->freq/1000); | 759 tv_channel_current->number, tv_channel_current->name, (float)tv_channel_current->freq/1000); |
756 } | |
757 } | 760 } |
758 } else tv_step_channel_real(tvh, direction); | 761 } else tv_step_channel_real(tvh, direction); |
759 return(1); | 762 return(1); |
760 } | 763 } |
761 | 764 |