Hi!

(Sorry for my previous post, I sent it while typing it..)

So the issue is the following:

Creating a video4linux producer like (simplified code):

producer = new Mlt::Producer(*profile, "video4linux2:/dev/video0");
consumer->connect(*producer);
consumer->start();

It works fine. But when I want to stop the capture, there is no way to stop the 
video4linux producer. Deleting the producer and the consumer still leaves the 
video4linux device open.

After a few hours of struggling, I figured out that some stuff was kept in the 
cache. Adding :

mlt_service_cache_purge( MLT_PRODUCER_SERVICE(parent) );

to producer_close (as already done for the qimage producer for example) fixes 
the issue.

It seems correct to me but maybe there was a reason not to do so...

Patch below, regards
jb


diff --git a/src/modules/avformat/producer_avformat.c 
b/src/modules/avformat/producer_avformat.c
index e1f88de..d10e2e4 100644
--- a/src/modules/avformat/producer_avformat.c
+++ b/src/modules/avformat/producer_avformat.c
@@ -2463,6 +2463,7 @@ static void producer_close( mlt_producer parent )
 {
        // Close the parent
        parent->close = NULL;
+       mlt_service_cache_purge( MLT_PRODUCER_SERVICE(parent) );
        mlt_producer_close( parent );
 
        // Free the memory

------------------------------------------------------------------------------
What Every C/C++ and Fortran developer Should Know!
Read this article and learn how Intel has extended the reach of its 
next-generation tools to help Windows* and Linux* C/C++ and Fortran 
developers boost performance applications - including clusters. 
http://p.sf.net/sfu/intel-dev2devmay
_______________________________________________
Mlt-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mlt-devel

Reply via email to