X-Git-Url: http://research.m1stereo.tv/gitweb?a=blobdiff_plain;f=src%2Fframework%2Fmlt_frame.c;h=be21562d595f507b6f6ba91d4e8be9e2c23ecf91;hb=e25076bb729fbb4a35b095bc58f3facbcbe82ef5;hp=fc67de8f2a395f18b70cf85e3ae802e4ee3f27a5;hpb=80761e7906f1694821044eefb3164b7f07c776e2;p=melted diff --git a/src/framework/mlt_frame.c b/src/framework/mlt_frame.c index fc67de8..be21562 100644 --- a/src/framework/mlt_frame.c +++ b/src/framework/mlt_frame.c @@ -200,10 +200,16 @@ 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 ); + + *width = *width >> 1 << 1; if ( get_image != NULL ) { - return get_image( this, buffer, format, width, height, writable ); + int error = 0; + mlt_position position = mlt_frame_get_position( this ); + error = get_image( this, buffer, format, width, height, writable ); + mlt_frame_set_position( this, position ); + return error; } else if ( mlt_properties_get_data( properties, "image", NULL ) != NULL ) { @@ -226,8 +232,7 @@ int mlt_frame_get_image( mlt_frame this, uint8_t **buffer, mlt_image_format *for 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" ); + mlt_properties_set_double( properties, "aspect_ratio", mlt_frame_get_aspect_ratio( test_frame ) ); } else { @@ -306,10 +311,13 @@ uint8_t *mlt_frame_get_alpha_mask( mlt_frame this ) int mlt_frame_get_audio( mlt_frame this, int16_t **buffer, mlt_audio_format *format, int *frequency, int *channels, int *samples ) { mlt_properties properties = mlt_frame_properties( this ); + int hide = mlt_properties_get_int( properties, "test_audio" ); - if ( this->get_audio != NULL ) + if ( hide == 0 && this->get_audio != NULL ) { + mlt_position position = mlt_frame_get_position( this ); this->get_audio( this, buffer, format, frequency, channels, samples ); + mlt_frame_set_position( this, position ); } else if ( mlt_properties_get_data( properties, "audio", NULL ) ) { @@ -339,13 +347,14 @@ int mlt_frame_get_audio( mlt_frame this, int16_t **buffer, mlt_audio_format *for return 0; } -unsigned char *mlt_frame_get_waveform( mlt_frame this, double fps, int w, int h ) +unsigned char *mlt_frame_get_waveform( mlt_frame this, int w, int h ) { int16_t *pcm = NULL; mlt_properties properties = mlt_frame_properties( this ); mlt_audio_format format = mlt_audio_pcm; int frequency = 32000; // lower frequency available? int channels = 2; + double fps = mlt_properties_get_double( properties, "fps" ); int samples = mlt_sample_calculator( fps, frequency, mlt_frame_get_position( this ) ); // Get the pcm data @@ -369,10 +378,11 @@ unsigned char *mlt_frame_get_waveform( mlt_frame this, double fps, int w, int h // pcm data has channels interleaved for ( j = 0; j < channels; j++ ) { - // The height of a line is the ratio of the sample multiplied by + // Determine sample's magnitude from 2s complement; + int pcm_magnitude = *pcm < 0 ? ~(*pcm) + 1 : *pcm; + // The height of a line is the ratio of the magnitude multiplied by // half the vertical resolution - int pcm_scaled = ( int )( ( double )( *pcm ) / 32768 * h / 2 ); - int height = pcm_scaled < 0 ? -pcm_scaled : pcm_scaled; + int height = ( int )( ( double )( pcm_magnitude ) / 32768 * h / 2 ); // Determine the starting y coordinate - left channel above center, // right channel below - currently assumes 2 channels int displacement = ( h / 2 ) - ( 1 - j ) * height; @@ -391,6 +401,12 @@ unsigned char *mlt_frame_get_waveform( mlt_frame this, double fps, int w, int h return bitmap; } +mlt_producer mlt_frame_get_original_producer( mlt_frame this ) +{ + if ( this != NULL ) + return mlt_properties_get_data( mlt_frame_properties( this ), "_producer", NULL ); + return NULL; +} void mlt_frame_close( mlt_frame this ) {