X-Git-Url: http://research.m1stereo.tv/gitweb?a=blobdiff_plain;f=src%2Fframework%2Fmlt_frame.c;h=3b5c556b5521cf82a4ba372b16aa2fedf22990f8;hb=6159bd78fa8e72c784747776a2c4c63d9c461ff5;hp=7e661fed9b9a6582682bda6f6c87f1bbe531d7aa;hpb=978543a20e47302b82bc29007852bff8180031c2;p=melted diff --git a/src/framework/mlt_frame.c b/src/framework/mlt_frame.c index 7e661fe..3b5c556 100644 --- a/src/framework/mlt_frame.c +++ b/src/framework/mlt_frame.c @@ -20,6 +20,7 @@ #include "config.h" #include "mlt_frame.h" +#include "mlt_producer.h" #include #include #include @@ -154,6 +155,7 @@ int mlt_frame_get_image( mlt_frame this, uint8_t **buffer, mlt_image_format *for { mlt_properties properties = mlt_frame_properties( this ); mlt_get_image get_image = mlt_frame_pop_get_image( this ); + mlt_producer producer = mlt_properties_get_data( properties, "test_card_producer", NULL ); if ( get_image != NULL ) { @@ -166,6 +168,26 @@ int mlt_frame_get_image( mlt_frame this, uint8_t **buffer, mlt_image_format *for *width = mlt_properties_get_int( properties, "width" ); *height = mlt_properties_get_int( properties, "height" ); } + else if ( producer != NULL ) + { + mlt_frame test_frame = NULL; + mlt_service_get_frame( mlt_producer_service( producer ), &test_frame, 0 ); + if ( test_frame != NULL ) + { + mlt_frame_get_image( test_frame, buffer, format, width, height, writable ); + mlt_properties_inherit( mlt_frame_properties( this ), mlt_frame_properties( test_frame ) ); + mlt_properties_set_data( properties, "test_card_frame", test_frame, 0, ( mlt_destructor )mlt_frame_close, NULL ); + + mlt_properties_set_data( properties, "image", *buffer, *width * *height * 2, NULL, NULL ); + mlt_properties_set_int( properties, "width", *width ); + mlt_properties_set_int( properties, "height", *height ); + } + else + { + mlt_properties_set_data( properties, "test_card_producer", NULL, 0, NULL, NULL ); + mlt_frame_get_image( this, buffer, format, width, height, writable ); + } + } else { uint8_t *p; @@ -211,7 +233,7 @@ int mlt_frame_get_image( mlt_frame this, uint8_t **buffer, mlt_image_format *for case mlt_image_yuv420p: size = size * 3 / 2; *buffer = malloc( size ); - if ( *buffer ) + if ( *buffer ) memset( *buffer, 255, size ); break; }