changeset 25126:8152446e42b1

Move requested format at top and shift all oters down This method is better with recent negotiation code: requested formats will be checked first.
author voroshil
date Sat, 24 Nov 2007 07:28:05 +0000
parents a1e6345207a1
children 6e039dd0b5d8
files stream/tvi_dshow.c
diffstat 1 files changed, 12 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/stream/tvi_dshow.c	Sat Nov 24 06:01:18 2007 +0000
+++ b/stream/tvi_dshow.c	Sat Nov 24 07:28:05 2007 +0000
@@ -3141,8 +3141,8 @@
 /* need rewrite */
     case TVI_CONTROL_VID_SET_FORMAT:
 	{
-	    int fcc, i;
-	    void* tmp;
+	    int fcc, i,j;
+	    void* tmp,*tmp2;
 	    int result = TVI_CONTROL_TRUE;
 
 	    if (priv->state)
@@ -3185,13 +3185,16 @@
 		result = TVI_CONTROL_FALSE;
 	    }
 
-	    tmp = priv->chains[0]->arpmt[0];
-	    priv->chains[0]->arpmt[0] = priv->chains[0]->arpmt[i];
-	    priv->chains[0]->arpmt[i] = tmp;
-
-	    tmp = priv->chains[0]->arStreamCaps[0];
-	    priv->chains[0]->arStreamCaps[0] = priv->chains[0]->arStreamCaps[i];
-	    priv->chains[0]->arStreamCaps[i] = tmp;
+
+            tmp=priv->chains[0]->arpmt[i];
+            tmp2=priv->chains[0]->arStreamCaps[i];
+            for(j=i; j>0; j--)
+            {
+                priv->chains[0]->arpmt[j] = priv->chains[0]->arpmt[j-1];
+                priv->chains[0]->arStreamCaps[j] = priv->chains[0]->arStreamCaps[j-1];
+            }
+            priv->chains[0]->arpmt[0] = tmp;
+            priv->chains[0]->arStreamCaps[0] = tmp2;
 
 	    priv->chains[0]->nFormatUsed = 0;