>From f73ba13d76425b8aa6949b52b221f19396848e2e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Tobias=20G=C3=BCntner?= <fatbull@web.de>
Date: Tue, 16 Aug 2011 21:13:33 +0000
Subject: [PATCH 1/3] Merge if conditions

---
 modules/demux/ps.c |   19 ++++++++++---------
 1 files changed, 10 insertions(+), 9 deletions(-)

diff --git a/modules/demux/ps.c b/modules/demux/ps.c
index 51361bf..dd4f729 100644
--- a/modules/demux/ps.c
+++ b/modules/demux/ps.c
@@ -260,20 +260,21 @@ static void FindLength( demux_t *p_demux )
         if( i_current_pos >= 0 ) stream_Seek( p_demux->s, i_current_pos );
     }
 
+    /* Find the longest track */
     for( int i = 0; i < PS_TK_COUNT; i++ )
     {
         ps_track_t *tk = &p_sys->tk[i];
-        if( tk->i_first_pts >= 0 && tk->i_last_pts > 0 )
-            if( tk->i_last_pts > tk->i_first_pts )
+        if( tk->i_first_pts >= 0 && tk->i_last_pts > 0 &&
+            tk->i_last_pts > tk->i_first_pts )
+        {
+            int64_t i_length = (int64_t)tk->i_last_pts - tk->i_first_pts;
+            if( i_length > p_sys->i_length )
             {
-                int64_t i_length = (int64_t)tk->i_last_pts - tk->i_first_pts;
-                if( i_length > p_sys->i_length )
-                {
-                    p_sys->i_length = i_length;
-                    p_sys->i_time_track = i;
-                    msg_Dbg( p_demux, "we found a length of: %"PRId64, p_sys->i_length );
-                }
+                p_sys->i_length = i_length;
+                p_sys->i_time_track = i;
+                msg_Dbg( p_demux, "we found a length of: %"PRId64, p_sys->i_length );
             }
+        }
     }
 }
 
-- 
1.7.0.4

