dshow: handle events in graph

Handling DirectShow events prevents infinite loops when there is an error in
the graph, such as a device being disconnected. This makes it possible for
dshow to return an error to the caller and run the cleanup code.

Based on patch by Don Moir <donmoir@comcast.net>.
