dshow: prevent division by zero
dshow: prevent division by zero

# HG changeset patch
# User Edouard Gomez <ed.gomez@free.fr>
# Date 1224021633 -7200
# Node ID 9564c1736b76c96f37fb85476d36496b3d7955bb
# Parent  40d5c2186f7fb31e944b5b542b3366bbc420cc0e
dshow: prevent division by zero

In the DShow capture module, division by zero is possible in
multiple modulo statements when dealing with granularity values
returned by capture filters.

Change the code so that:
 - if granularity is zero, then width/height/samplingrate must be
   a perfect match with requested settings.
 - if granularity is non zero, then use the old condition tests.

This fixes real crashes reported by VLC users on different forums.

See:
http://forum.doom9.org/archive/index.php/t-134655.html
http://forum.videolan.org/viewtopic.php?f=2&t=37056&p=114065&hilit=blackmagic

Tested with both a Decklink HD Extreme card and a Decklink HD Pro card.

Signed-off-by: Jean-Baptiste Kempf <7b85a41a628204b76aba4326273a3ccc74bd009a@videolan.org>

vlc-mirror/vlc,jomanmuk/vlc-2.1,xkfz007/vlc,shyamalschandra/vlc,xkfz007/vlc,vlc-mirror/vlc,vlc-mirror/vlc,jomanmuk/vlc-2.2,vlc-mirror/vlc-2.1,jomanmuk/vlc-2.1,vlc-mirror/vlc,vlc-mirror/vlc-2.1,krichter722/vlc,xkfz007/vlc,shyamalschandra/vlc,jomanmuk/vlc-2.1,shyamalschandra/vlc,krichter722/vlc,shyamalschandra/vlc,jomanmuk/vlc-2.1,jomanmuk/vlc-2.2,krichter722/vlc,xkfz007/vlc,jomanmuk/vlc-2.2,vlc-mirror/vlc,jomanmuk/vlc-2.1,jomanmuk/vlc-2.2,jomanmuk/vlc-2.2,jomanmuk/vlc-2.1,krichter722/vlc,vlc-mirror/vlc-2.1,jomanmuk/vlc-2.2,vlc-mirror/vlc-2.1,vlc-mirror/vlc,vlc-mirror/vlc-2.1,jomanmuk/vlc-2.2,vlc-mirror/vlc-2.1,krichter722/vlc,krichter722/vlc,vlc-mirror/vlc-2.1,xkfz007/vlc,krichter722/vlc,shyamalschandra/vlc,shyamalschandra/vlc,jomanmuk/vlc-2.1,vlc-mirror/vlc,xkfz007/vlc,xkfz007/vlc,shyamalschandra/vlc