changeset 19089:a4b50a45007c

simplification in dvb_step_channel
author nicodvb
date Fri, 14 Jul 2006 22:37:54 +0000
parents 1c2939bf2b2b
children 32facb266b1a
files libmpdemux/dvbin.c
diffstat 1 files changed, 1 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- a/libmpdemux/dvbin.c	Fri Jul 14 22:29:37 2006 +0000
+++ b/libmpdemux/dvbin.c	Fri Jul 14 22:37:54 2006 +0000
@@ -601,21 +601,7 @@
 		return 0;
 	}
 
-
-	if(dir == DVB_CHANNEL_HIGHER)
-	{
-		if(list->current == list->NUM_CHANNELS-1)
-			new_current=0;
-		else
-			new_current = list->current + 1;
-	}
-	else
-	{
-		if(list->current == 0)
-			new_current=list->NUM_CHANNELS-1;
-		else
-			new_current = list->current - 1;
-	}
+	new_current = (list->NUM_CHANNELS + list->current + (dir == DVB_CHANNEL_HIGHER ? 1 : -1)) % list->NUM_CHANNELS;
 
 	return dvb_set_channel(priv, priv->card, new_current);
 }