Index: stream/tvi_dshow.c
===================================================================
--- stream/tvi_dshow.c	(revision 35922)
+++ stream/tvi_dshow.c	(working copy)
@@ -3217,6 +3217,80 @@
 	    } else
 		return TVI_CONTROL_FALSE;
 	}
+    case TVI_CONTROL_VID_SET_WIDTH_HEIGHT:
+	{
+	    VIDEO_STREAM_CONFIG_CAPS *pCaps;
+	    VIDEOINFOHEADER *Vhdr;
+            int width = ((int*)arg)[0];
+   	    int height = ((int*)arg)[1];
+            int i;
+	    if (priv->state)
+		return TVI_CONTROL_FALSE;
+
+            if(!priv->chains[0]->arpmt)
+                return TVI_CONTROL_FALSE;
+            /* Loop over all detected formats... */
+	    for (i = 0; priv->chains[0]->arpmt[i]; i++) {
+                /* same FourCC as previously specified */
+		if (!check_video_format
+		    (priv->chains[0]->arpmt[i], priv->fcc, width, height))
+                    continue;
+	        pCaps = priv->chains[0]->arStreamCaps[i];
+   	        if (!pCaps)
+		    continue;
+
+                /* requested width fits to min/max range */
+                if (width < pCaps->MinOutputSize.cx
+		    || width > pCaps->MaxOutputSize.cx)
+		    continue;
+
+                /* requested height fits to min/max range */
+	        if (height < pCaps->MinOutputSize.cy
+		    || height > pCaps->MaxOutputSize.cy)
+		    continue;
+
+                /* switch format if found suitable one */
+                priv->chains[0]->nFormatUsed = i;
+                break;
+            }
+	    pCaps = priv->chains[0]->arStreamCaps[priv->chains[0]->nFormatUsed];
+	    if (!pCaps)
+		return TVI_CONTROL_FALSE;
+	    if (width < pCaps->MinOutputSize.cx
+		|| width > pCaps->MaxOutputSize.cx)
+		return TVI_CONTROL_FALSE;
+	    if (height < pCaps->MinOutputSize.cy
+		|| height > pCaps->MaxOutputSize.cy)
+		return TVI_CONTROL_FALSE;
+
+	    if (width % pCaps->OutputGranularityX)
+		return TVI_CONTROL_FALSE;
+	    if (height % pCaps->OutputGranularityY)
+		return TVI_CONTROL_FALSE;
+
+	    if (priv->chains[0]->pmt)
+		DeleteMediaType(priv->chains[0]->pmt);
+	    priv->chains[0]->pmt =
+		CreateMediaType(priv->chains[0]->arpmt[priv->chains[0]->nFormatUsed]);
+	    DisplayMediaType("VID_SET_WIDTH_HEIGHT", priv->chains[0]->pmt);
+
+	    if (!priv->chains[0]->pmt || !priv->chains[0]->pmt->pbFormat)
+		    return TVI_CONTROL_FALSE;
+	    Vhdr = (VIDEOINFOHEADER *) priv->chains[0]->pmt->pbFormat;
+	    Vhdr->bmiHeader.biWidth = width;
+	    if (Vhdr->bmiHeader.biHeight < 0)
+		    Vhdr->bmiHeader.biHeight = -height;
+	    else
+		    Vhdr->bmiHeader.biHeight = height;
+	    priv->chains[0]->pmt->lSampleSize = Vhdr->bmiHeader.biSizeImage =
+		    labs(Vhdr->bmiHeader.biBitCount * Vhdr->bmiHeader.biWidth *
+		    Vhdr->bmiHeader.biHeight) >> 3;
+
+	    priv->width = width;
+	    priv->height = height;
+
+	    return TVI_CONTROL_TRUE;
+	}
     case TVI_CONTROL_VID_SET_WIDTH:
 	{
 	    VIDEO_STREAM_CONFIG_CAPS *pCaps;