[FFmpeg-devel] [PATCH 2/2] dshow: handle events in graph

Don Moir donmoir at comcast.net
Wed Dec 5 22:31:59 CET 2012

----- Original Message ----- 
From: "Ramiro Polla" <ramiro.polla at gmail.com>
To: "FFmpeg development discussions and patches" <ffmpeg-devel at ffmpeg.org>
Sent: Tuesday, December 04, 2012 1:23 AM
Subject: [FFmpeg-devel] [PATCH 2/2] dshow: handle events in graph

> Hi,
> Thanks to Don Moir for pointing out the problem and providing a fix.
> Don, could you please test that this patch fixes the problem for you?
> Ramiro
Ramiro, your patch sort of works but had a couple bugs.

o - fixes return value in dshow_read_header. Your patch for this had a couple misplaced ')' in it.

o - re-added ctx->eof. After the device has failed, this is a check to stop trying to read any more packets in dshow_read_packet. 
Without this check and someone calls av_read_frame after it has already failed will result in a hang.

o - dshow_check_event_queue did not free the event when eof was detected. I modified it to take the ctx struct instead of media 
event so that ctx->eof could be set.

o - added CoUninitialize to dshow_read_close. Every call to CoInitialize should have a matching CoUnititalize. Changed the position 
of CoInitialize in dshow_read_header so we always know to call CoUnintialize without flagging it.

With event handling added to dshow.c and fix for ret value in dshow_read_header I can't get any abnormal behavior like hangs. 
Without the changes I can get to fail in at least 3 different ways.

I will be working in the area of camera support for awhile and will continue to test. So if any kind of modifications to dshow 
support or device listing is wanted, now would be a good time for them.

Ramiro, please review the attached modified dshow.c


-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: dshow.c
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20121205/894aa70d/attachment.c>

More information about the ffmpeg-devel mailing list