]> git.sesse.net Git - mlt/commitdiff
Fix full closure of avformat on explicit close.
authorDan Dennedy <dan@dennedy.org>
Sun, 22 May 2011 18:30:32 +0000 (11:30 -0700)
committerDan Dennedy <dan@dennedy.org>
Sun, 22 May 2011 18:30:32 +0000 (11:30 -0700)
JBM wrote:
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.

src/modules/avformat/producer_avformat.c

index c659dc79faab736800f7a3a35848dd1231ffe87e..6886a5a200c2414525622043fe8285aee9c1da49 100644 (file)
@@ -2461,6 +2461,9 @@ static void producer_avformat_close( producer_avformat self )
 
 static void producer_close( mlt_producer parent )
 {
+       // Remove this instance from the cache
+       mlt_service_cache_purge( MLT_PRODUCER_SERVICE(parent) );
+
        // Close the parent
        parent->close = NULL;
        mlt_producer_close( parent );