# HG changeset patch # User voroshil # Date 1195374270 0 # Node ID 1f0eb7aa32061a4390c7203aff3b317933806590 # Parent 96c96edb3d2f6f19e8ee7657608871d0eb626f77 Ignore video formats which are supported by device but not supported by dshow driver. diff -r 96c96edb3d2f -r 1f0eb7aa3206 stream/tvi_dshow.c --- 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;