On Tue, Jun 14, 2011 at 12:32 AM, j-b-m <[email protected]> wrote:
> On Sunday 22 May 2011 18:39:08 j-b-m 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) );
>
> This issue came back in a different way since the refactoring of 
> producer_open,
> in this commit:
>
> http://mltframework.org/gitweb/mlt.git?p=mltframework.org/mlt.git;a=commit;h=a0c82f0eb433e5b756e8239ebb684abc81b796d9
>
> When connecting the producer to an sdl_preview consumer, it works fine,
> deleting the producer and consumer closes the video4linux device.
>
> However, when connecting the producer to an avformat consumer, deleting
> producer and consumer leaves the device open, "producer_avformat_close" is
> never called. Something must remain in cache or is not deleted. The only way
> to close the video4linux device is to close MLT's factory.

I am trying to reproduce the problem by making the following changes:
diff --git a/src/melt/melt.c b/src/melt/melt.c
index 0d7e918..dcf81b1 100644
--- a/src/melt/melt.c
+++ b/src/melt/melt.c
@@ -847,6 +847,8 @@ query_all:
        // Close the factory
        mlt_profile_close( profile );

+       sleep(300);
+
 exit_factory:
                
        mlt_factory_close( );
diff --git a/src/modules/avformat/producer_avformat.c
b/src/modules/avformat/producer_avformat.c
index f14ce18..9ab94da 100644
--- a/src/modules/avformat/producer_avformat.c
+++ b/src/modules/avformat/producer_avformat.c
@@ -2532,7 +2532,7 @@ static int producer_get_frame( mlt_producer
producer, mlt_frame_ptr frame, int i

 static void producer_avformat_close( producer_avformat self )
 {
-       mlt_log_debug( NULL, "producer_avformat_close\n" );
+       mlt_log_verbose( NULL, "producer_avformat_close\n" );

        // Cleanup av contexts
        av_free( self->av_frame );

--

Then, I run
melt -verbose -profile quarter_ntsc
video4linux2:/dev/video0?width:320\&height:240\&frame_rate:15
-consumer avformat:test.mpg

When I press 'q', I always see producer_avformat_close. Does that
reproduce the problem for you?

-- 
+-DRD-+

------------------------------------------------------------------------------
EditLive Enterprise is the world's most technically advanced content
authoring tool. Experience the power of Track Changes, Inline Image
Editing and ensure content is compliant with Accessibility Checking.
http://p.sf.net/sfu/ephox-dev2dev
_______________________________________________
Mlt-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mlt-devel

Reply via email to