[FFmpeg-devel] [PATCH][GSoC] dshow add support for saving and loading of capture devices

Roger Pack rogerdpack2 at gmail.com
Wed Apr 22 16:44:20 CEST 2015


On 4/22/15, Máté Sebők <smfinc.org at gmail.com> wrote:
> Indeed, sorry i've forgotten to change the Eclipse' EOL to unix-- now
> fixed.
>
> Error handler fixed.

Thank you it's very close.
A few more nits and we'll be there.

You have
+        if (ofile_stream)
+            IStream_Release(ofile_stream);

in there twice.  In reality even a "normal flow" goes through the
error block, so you'll only want/need to release it in the error block
(it's being released twice currently).  As is it seg faults...

Also in this block:

        hr = OleSaveToStream(pers_stream, ofile_stream);
        if (hr != S_OK) {
            av_log(avctx, AV_LOG_ERROR, "Could not save capture filter \n");
            goto error;
        }
       IPersistStream_Release(pers_stream);

if it calls that "goto error" it will end up never releasing the
IpersistStream object.  So basically for the pers_stream you're going
to want to have two of them (like you did with the other) and release
them both in the error block.  I'll admit the concept of a cleanup
block kind of confused me at first...but it's how the code was
initially written so I've kept using it, and it works out OK.

Besides that LGTM.
-roger-

> Parameter names changed to audio(/video)_device_load(/save) as I think the
> to_file and from_file is evident and is specified in the help.
>
> About the "fake" input:  by loading a device filter from file, in the
> dshow_open_device() it loads the device object from file instead of
> searching it by name. So as long as the dshow_open_device() get called it
> will load the device -- however to get called it is required to have a not
> NULL input name .. aka any fake text would do the trick (eg: -i video=" " )
> If you have better suggestion for the description, please tell me.
> Here is the fixed patch.


More information about the ffmpeg-devel mailing list