X-Git-Url: http://research.m1stereo.tv/gitweb?a=blobdiff_plain;f=src%2Fframework%2Fmlt_frame.c;h=f0092ed90e564287a2e17f7f0f3dec4019610ebd;hb=be092fb725a3ef83741bb72460e11aac95989e3c;hp=4d582328b6beb7ed2d6b6ce0cb88a1a2da91d26e;hpb=c1333ab3917e63f8bc4684aa4cee0a1984a61c04;p=melted diff --git a/src/framework/mlt_frame.c b/src/framework/mlt_frame.c index 4d58232..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. @@ -219,8 +219,8 @@ int mlt_frame_get_image( mlt_frame this, uint8_t **buffer, mlt_image_format *for if ( test_frame != NULL ) { mlt_properties test_properties = mlt_frame_properties( test_frame ); - mlt_properties_set( test_properties, "rescale.interp", "nearest" ); mlt_properties_set_double( test_properties, "consumer_aspect_ratio", mlt_properties_get_double( properties, "consumer_aspect_ratio" ) ); + 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 ); @@ -237,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; @@ -309,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 { @@ -324,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 ); @@ -729,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;