# HG changeset patch # User voroshil # Date 1195889285 0 # Node ID 8152446e42b116b661c054813fd398eb15c34d2a # Parent a1e6345207a17c3b9b848e048e318f551a2f6d53 Move requested format at top and shift all oters down This method is better with recent negotiation code: requested formats will be checked first. diff -r a1e6345207a1 -r 8152446e42b1 stream/tvi_dshow.c --- 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;