X-Git-Url: http://research.m1stereo.tv/gitweb?a=blobdiff_plain;f=src%2Fframework%2Fmlt_frame.c;h=f0092ed90e564287a2e17f7f0f3dec4019610ebd;hb=be092fb725a3ef83741bb72460e11aac95989e3c;hp=ce820b9a0e74c3df928c52153240c0bfafcd2c54;hpb=3531bc485623608b5ecc6e780710251d32d6161c;p=melted diff --git a/src/framework/mlt_frame.c b/src/framework/mlt_frame.c index ce820b9..f0092ed 100644 --- a/src/framework/mlt_frame.c +++ b/src/framework/mlt_frame.c @@ -80,7 +80,7 @@ mlt_frame mlt_frame_init( ) mlt_properties mlt_frame_properties( mlt_frame this ) { - return &this->parent; + return this != NULL ? &this->parent : NULL; } /** Check if we have a way to derive something other than a test card. @@ -220,12 +220,14 @@ int mlt_frame_get_image( mlt_frame this, uint8_t **buffer, mlt_image_format *for { mlt_properties test_properties = mlt_frame_properties( test_frame ); mlt_properties_set_double( test_properties, "consumer_aspect_ratio", mlt_properties_get_double( properties, "consumer_aspect_ratio" ) ); - mlt_properties_set( test_properties, "rescale.interp", "nearest" ); + mlt_properties_set( test_properties, "rescale.interp", mlt_properties_get( properties, "rescale.interp" ) ); mlt_frame_get_image( test_frame, buffer, format, width, height, writable ); 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 ); + mlt_properties_set( properties, "rescale.interp", "none" ); + mlt_properties_set( properties, "scale", "off" ); } else { @@ -235,8 +237,8 @@ int mlt_frame_get_image( mlt_frame this, uint8_t **buffer, mlt_image_format *for } else { - uint8_t *p; - uint8_t *q; + register uint8_t *p; + register uint8_t *q; int size = 0; *width = *width == 0 ? 720 : *width; @@ -307,7 +309,14 @@ int mlt_frame_get_audio( mlt_frame this, int16_t **buffer, mlt_audio_format *for if ( this->get_audio != NULL ) { - return this->get_audio( this, buffer, format, frequency, channels, samples ); + this->get_audio( this, buffer, format, frequency, channels, samples ); + } + else if ( mlt_properties_get_data( properties, "audio", NULL ) ) + { + *buffer = mlt_properties_get_data( properties, "audio", NULL ); + *frequency = mlt_properties_get_int( properties, "audio_frequency" ); + *channels = mlt_properties_get_int( properties, "audio_channels" ); + *samples = mlt_properties_get_int( properties, "audio_samples" ); } else { @@ -322,12 +331,17 @@ int mlt_frame_get_audio( mlt_frame this, int16_t **buffer, mlt_audio_format *for mlt_properties_set_data( properties, "audio", *buffer, size, ( mlt_destructor )mlt_pool_release, NULL ); mlt_properties_set_int( properties, "test_audio", 1 ); } + + mlt_properties_set_int( properties, "audio_frequency", *frequency ); + mlt_properties_set_int( properties, "audio_channels", *channels ); + mlt_properties_set_int( properties, "audio_samples", *samples ); + return 0; } void mlt_frame_close( mlt_frame this ) { - if ( this != NULL ) + if ( this != NULL && mlt_properties_dec_ref( mlt_frame_properties( this ) ) <= 0 ) { mlt_deque_close( this->stack_image ); mlt_deque_close( this->stack_audio ); @@ -494,6 +508,8 @@ void mlt_resize_yuv422( uint8_t *output, int owidth, int oheight, uint8_t *input int active_width = 2 * iwidth; int inactive_width = out_x_range - in_x_range; + uint8_t *p = NULL; + uint8_t *end = NULL; // Loop for the entirety of our output height. while ( iheight -- ) @@ -510,8 +526,13 @@ void mlt_resize_yuv422( uint8_t *output, int owidth, int oheight, uint8_t *input } // We're in the input range for this row. - memcpy( out_ptr, in_middle + in_line, active_width ); - out_ptr += active_width; + p = in_middle + in_line; + end = out_ptr + active_width; + while ( out_ptr != end ) + { + *out_ptr ++ = *p ++; + *out_ptr ++ = *p ++; + } // Fill the outer part with black elements = inactive_width; @@ -720,7 +741,7 @@ int mlt_sample_calculator( float fps, int frequency, int64_t position ) { int samples = 0; - if ( fps > 29 && fps <= 30 ) + if ( ( int )( fps * 100 ) == 2997 ) { samples = frequency / 30;