changeset 25061:1f0eb7aa3206

Ignore video formats which are supported by device but not supported by dshow driver.
author voroshil
date Sun, 18 Nov 2007 08:24:30 +0000
parents 96c96edb3d2f
children 25ee4d06a2df
files stream/tvi_dshow.c
diffstat 1 files changed, 15 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/stream/tvi_dshow.c	Sun Nov 18 06:16:37 2007 +0000
+++ b/stream/tvi_dshow.c	Sun Nov 18 08:24:30 2007 +0000
@@ -2021,18 +2021,29 @@
 
 	pBuf = (void **) malloc((count + 1) * sizeof(void *));
 	if (pBuf) {
+	    int dst = 0;
 	    memset(pBuf, 0, (count + 1) * sizeof(void *));
 
 	    for (i = 0; i < count; i++) {
-		pBuf[i] = malloc(size);
-
-		if (!pBuf[i])
+		pBuf[dst] = malloc(size);
+
+		if (!pBuf[dst])
 		    break;
 
 		hr = OLE_CALL_ARGS(pStreamConfig, GetStreamCaps, i,
-			       &(arpmt[i]), pBuf[i]);
+			       &(arpmt[dst]), pBuf[dst]);
 		if (FAILED(hr))
 		    break;
+		if(!memcmp(&(arpmt[dst]->majortype), &MEDIATYPE_Video, 16) && !subtype2imgfmt(&(arpmt[dst]->subtype)))
+		{
+		    DisplayMediaType("Skipping unsupported video format", arpmt[dst]);
+		    DeleteMediaType(arpmt[dst]);
+		    free(pBuf[dst]);
+		    arpmt[dst]=NULL;
+		    pBuf[dst]=NULL;
+		    continue;
+		}
+		dst++;
 	    }
 	    if (i == count) {
 		*parpmtMedia = arpmt;