mlt_properties_set_int( properties, "width", 720 );
mlt_properties_set_int( properties, "height", 576 );
mlt_properties_set_int( properties, "progressive", 0 );
+ mlt_properties_set_double( properties, "aspect_ratio", 128.0 / 117.0 );
}
else
{
mlt_properties_set_int( properties, "width", 720 );
mlt_properties_set_int( properties, "height", 480 );
mlt_properties_set_int( properties, "progressive", 0 );
+ mlt_properties_set_double( properties, "aspect_ratio", 72.0 / 79.0 );
}
- // Default aspect ratio
- mlt_properties_set_double( properties, "aspect_ratio", 4.0 / 3.0 );
-
// Default rescaler for all consumers
mlt_properties_set( properties, "rescale", "bilinear" );
else
mlt_service_close( &this->parent );
}
-
mlt_properties_set_int( properties, "height", 576 );
mlt_properties_set_int( properties, "normalised_width", 720 );
mlt_properties_set_int( properties, "normalised_height", 576 );
+ mlt_properties_set_double( properties, "aspect_ratio", 72.0/79.0 );
}
else
{
mlt_properties_set_int( properties, "height", 480 );
mlt_properties_set_int( properties, "normalised_width", 720 );
mlt_properties_set_int( properties, "normalised_height", 480 );
+ mlt_properties_set_double( properties, "aspect_ratio", 128.0/117.0 );
}
- mlt_properties_set_double( properties, "aspect_ratio", 4.0 / 3.0 );
mlt_properties_set_data( properties, "audio", NULL, 0, NULL, NULL );
mlt_properties_set_data( properties, "alpha", NULL, 0, NULL, NULL );
{
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_double( test_properties, "consumer_scale", mlt_properties_get_double( properties, "consumer_scale" ) );
mlt_properties_set( test_properties, "rescale.interp", "nearest" );
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 );
return samples;
}
-
mlt_properties_set_position( properties, "in", 0 );
mlt_properties_set_position( properties, "out", 14999 );
mlt_properties_set_position( properties, "length", 15000 );
- mlt_properties_set_double( properties, "aspect_ratio", 4.0 / 3.0 );
+ mlt_properties_set_double( properties, "aspect_ratio", 128.0 / 117.0 );
mlt_properties_set( properties, "eof", "pause" );
mlt_properties_set( properties, "resource", "<producer>" );
// No codec, no show...
if ( codec != NULL )
{
- double aspect_ratio = 0;
+ double aspect_ratio = 1;
double source_fps = 0;
// Set aspect ratio
- if ( codec_context->sample_aspect_ratio.num == 0 )
- aspect_ratio = 0;
- else
- aspect_ratio = av_q2d( codec_context->sample_aspect_ratio ) * codec_context->width / codec_context->height;
+ if ( codec_context->sample_aspect_ratio.num > 0 )
+ aspect_ratio = av_q2d( codec_context->sample_aspect_ratio );
- // XXX: This assumes square pixels!
- if (aspect_ratio <= 0.0)
- aspect_ratio = ( double )codec_context->width / ( double )codec_context->height;
-
mlt_properties_set_double( properties, "aspect_ratio", aspect_ratio );
- //fprintf( stderr, "AVFORMAT: sample aspect %f computed display aspect %f\n", av_q2d( codec_context->sample_aspect_ratio ), aspect_ratio );
+ //fprintf( stderr, "AVFORMAT: sample aspect %f %dx%d\n", av_q2d( codec_context->sample_aspect_ratio ), codec_context->width, codec_context->height );
// Determine the fps
source_fps = ( double )codec_context->frame_rate / codec_context->frame_rate_base;
// We'll use fps if it's available
if ( source_fps > 0 && source_fps < 30 )
mlt_properties_set_double( properties, "source_fps", source_fps );
+
+ // Set the width and height
+ mlt_properties_set_int( frame_properties, "width", codec_context->width );
+ mlt_properties_set_int( frame_properties, "height", codec_context->height );
mlt_frame_push_get_image( frame, producer_get_image );
mlt_properties_set_data( frame_properties, "avformat_producer", this, 0, NULL, NULL );
-
}
else
{
// Normalise the input and out display aspect
int normalised_width = mlt_properties_get_int( properties, "normalised_width" );
int normalised_height = mlt_properties_get_int( properties, "normalised_height" );
- double input_ar = mlt_frame_get_aspect_ratio( this );
- double output_ar = mlt_properties_get_double( properties, "consumer_aspect_ratio" );
+ int real_width = mlt_properties_get_int( properties, "real_width" );
+ int real_height = mlt_properties_get_int( properties, "real_height" );
+ if ( real_width == 0 )
+ real_width = mlt_properties_get_int( properties, "width" );
+ if ( real_height == 0 )
+ real_height = mlt_properties_get_int( properties, "height" );
+ double input_ar = mlt_frame_get_aspect_ratio( this ) * real_width / real_height;
+ double output_ar = mlt_properties_get_double( properties, "consumer_aspect_ratio" ) * owidth / oheight;
// Optimised for the input_ar > output_ar case (e.g. widescreen on standard)
- int scaled_width = normalised_width;
- int scaled_height = output_ar / input_ar * normalised_height;
+ int scaled_width = input_ar / output_ar * normalised_width + 0.5;
+ int scaled_height = normalised_height;
- // Now ensure that our images fit in the normalised frame
- if ( scaled_height > normalised_height )
+ // Now ensure that our images fit in the output frame
+ if ( scaled_width > normalised_width )
{
- scaled_width = input_ar / output_ar * normalised_width;
- scaled_height = normalised_height;
+ scaled_width = normalised_width;
+ scaled_height = output_ar / input_ar * normalised_height + 0.5;
}
// Now calculate the actual image size that we want
}
return this;
}
-
mlt_properties_set_int( properties, "height", height );
mlt_properties_set_int( properties, "has_image", 1 );
mlt_properties_set_int( properties, "progressive", 1 );
- mlt_properties_set_double( properties, "aspect_ratio", ( double )width / height );
+ mlt_properties_set_double( properties, "aspect_ratio", 1 );
// Push the image callback
mlt_frame_push_get_image( *frame, producer_get_image );
mlt_producer_close( parent );
free( this );
}
-
*/
#include "transition_composite.h"
-#include <framework/mlt_frame.h>
+#include <framework/mlt.h>
#include <stdio.h>
#include <stdlib.h>
return value;
}
+/** A linear threshold determination function.
+*/
+
+static inline int32_t linearstep( int32_t edge1, int32_t edge2, int32_t a )
+{
+ if ( a < edge1 )
+ return 0;
+
+ if ( a >= edge2 )
+ return 0x10000;
+
+ return ( ( a - edge1 ) << 16 ) / ( edge2 - edge1 );
+}
+
+/** A smoother, non-linear threshold determination function.
+*/
+
+static inline int32_t smoothstep( int32_t edge1, int32_t edge2, uint32_t a )
+{
+ if ( a < edge1 )
+ return 0;
+
+ if ( a >= edge2 )
+ return 0x10000;
+
+ a = ( ( a - edge1 ) << 16 ) / ( edge2 - edge1 );
+
+ return ( ( ( a * a ) >> 16 ) * ( ( 3 << 16 ) - ( 2 * a ) ) ) >> 16;
+}
+
+/** Load the luma map from PGM stream.
+*/
+
+static void luma_read_pgm( FILE *f, uint16_t **map, int *width, int *height )
+{
+ uint8_t *data = NULL;
+ while (1)
+ {
+ char line[128];
+ char comment[128];
+ int i = 2;
+ int maxval;
+ int bpp;
+ uint16_t *p;
+
+ line[127] = '\0';
+
+ // get the magic code
+ if ( fgets( line, 127, f ) == NULL )
+ break;
+
+ // skip comments
+ while ( sscanf( line, " #%s", comment ) > 0 )
+ if ( fgets( line, 127, f ) == NULL )
+ break;
+
+ if ( line[0] != 'P' || line[1] != '5' )
+ break;
+
+ // skip white space and see if a new line must be fetched
+ for ( i = 2; i < 127 && line[i] != '\0' && isspace( line[i] ); i++ );
+ if ( ( line[i] == '\0' || line[i] == '#' ) && fgets( line, 127, f ) == NULL )
+ break;
+
+ // skip comments
+ while ( sscanf( line, " #%s", comment ) > 0 )
+ if ( fgets( line, 127, f ) == NULL )
+ break;
+
+ // get the dimensions
+ if ( line[0] == 'P' )
+ i = sscanf( line, "P5 %d %d %d", width, height, &maxval );
+ else
+ i = sscanf( line, "%d %d %d", width, height, &maxval );
+
+ // get the height value, if not yet
+ if ( i < 2 )
+ {
+ if ( fgets( line, 127, f ) == NULL )
+ break;
+
+ // skip comments
+ while ( sscanf( line, " #%s", comment ) > 0 )
+ if ( fgets( line, 127, f ) == NULL )
+ break;
+
+ i = sscanf( line, "%d", height );
+ if ( i == 0 )
+ break;
+ else
+ i = 2;
+ }
+
+ // get the maximum gray value, if not yet
+ if ( i < 3 )
+ {
+ if ( fgets( line, 127, f ) == NULL )
+ break;
+
+ // skip comments
+ while ( sscanf( line, " #%s", comment ) > 0 )
+ if ( fgets( line, 127, f ) == NULL )
+ break;
+
+ i = sscanf( line, "%d", &maxval );
+ if ( i == 0 )
+ break;
+ }
+
+ // determine if this is one or two bytes per pixel
+ bpp = maxval > 255 ? 2 : 1;
+
+ // allocate temporary storage for the raw data
+ data = mlt_pool_alloc( *width * *height * bpp );
+ if ( data == NULL )
+ break;
+
+ // read the raw data
+ if ( fread( data, *width * *height * bpp, 1, f ) != 1 )
+ break;
+
+ // allocate the luma bitmap
+ *map = p = (uint16_t*)mlt_pool_alloc( *width * *height * sizeof( uint16_t ) );
+ if ( *map == NULL )
+ break;
+
+ // proces the raw data into the luma bitmap
+ for ( i = 0; i < *width * *height * bpp; i += bpp )
+ {
+ if ( bpp == 1 )
+ *p++ = data[ i ] << 8;
+ else
+ *p++ = ( data[ i ] << 8 ) + data[ i+1 ];
+ }
+
+ break;
+ }
+
+ if ( data != NULL )
+ mlt_pool_release( data );
+}
+
+/** Generate a luma map from any YUV image.
+*/
+
+static void luma_read_yuv422( uint8_t *image, uint16_t **map, int width, int height )
+{
+ int i;
+
+ // allocate the luma bitmap
+ uint16_t *p = *map = ( uint16_t* )mlt_pool_alloc( width * height * sizeof( uint16_t ) );
+ if ( *map == NULL )
+ return;
+
+ // proces the image data into the luma bitmap
+ for ( i = 0; i < width * height * 2; i += 2 )
+ *p++ = ( image[ i ] - 16 ) * 299; // 299 = 65535 / 219
+}
+
/** Composite function.
*/
-static int composite_yuv( uint8_t *p_dest, int width_dest, int height_dest, int bpp, uint8_t *p_src, int width_src, int height_src, uint8_t *p_alpha, struct geometry_s geometry, int field )
+static int composite_yuv( uint8_t *p_dest, int width_dest, int height_dest, int bpp, uint8_t *p_src, int width_src, int height_src, uint8_t *p_alpha, struct geometry_s geometry, int field, uint16_t *p_luma, int32_t softness )
{
int ret = 0;
int i, j;
if ( p_alpha )
p_alpha += x_src + y_src * stride_src / bpp;
+ // offset pointer into luma channel based upon cropping
+ if ( p_luma )
+ p_luma += x_src + y_src * stride_src / bpp;
+
// Assuming lower field first
// Special care is taken to make sure the b_frame is aligned to the correct field.
// field 0 = lower field and y should be odd (y is 0-based).
uint8_t *p = p_src;
uint8_t *q = p_dest;
uint8_t *o = p_dest;
+ uint16_t *l = p_luma;
uint8_t *z = p_alpha;
uint8_t a;
+ int32_t current_weight;
int32_t value;
int step = ( field > -1 ) ? 2 : 1;
p = p_src;
q = p_dest;
o = q;
+ l = p_luma;
z = p_alpha;
for ( j = 0; j < width_src; j ++ )
{
a = ( z == NULL ) ? 255 : *z ++;
- value = ( weight * ( a + 1 ) ) >> 8;
+ current_weight = ( l == NULL ) ? weight : linearstep( l[ j ], l[ j ] + softness, weight );
+ value = ( current_weight * ( a + 1 ) ) >> 8;
*o ++ = ( *p++ * value + *q++ * ( ( 1 << 16 ) - value ) ) >> 16;
*o ++ = ( *p++ * value + *q++ * ( ( 1 << 16 ) - value ) ) >> 16;
}
p_dest += stride_dest;
if ( p_alpha )
p_alpha += alpha_stride;
+ if ( p_luma )
+ p_luma += alpha_stride;
}
return ret;
}
+static uint16_t* get_luma( mlt_properties properties, int width, int height )
+{
+ // The cached luma map information
+ int luma_width = mlt_properties_get_int( properties, "_luma.width" );
+ int luma_height = mlt_properties_get_int( properties, "_luma.height" );
+ uint16_t *luma_bitmap = mlt_properties_get_data( properties, "_luma.bitmap", NULL );
+
+ // If the filename property changed, reload the map
+ char *resource = mlt_properties_get( properties, "luma" );
+
+ if ( luma_bitmap == NULL && resource != NULL )
+ {
+ char *extension = extension = strrchr( resource, '.' );
+
+ // See if it is a PGM
+ if ( extension != NULL && strcmp( extension, ".pgm" ) == 0 )
+ {
+ // Open PGM
+ FILE *f = fopen( resource, "r" );
+ if ( f != NULL )
+ {
+ // Load from PGM
+ luma_read_pgm( f, &luma_bitmap, &luma_width, &luma_height );
+ fclose( f );
+
+ // Set the transition properties
+ mlt_properties_set_int( properties, "_luma.width", luma_width );
+ mlt_properties_set_int( properties, "_luma.height", luma_height );
+ mlt_properties_set_data( properties, "_luma.bitmap", luma_bitmap, luma_width * luma_height * 2, mlt_pool_release, NULL );
+ }
+ }
+ else
+ {
+ // Get the factory producer service
+ char *factory = mlt_properties_get( properties, "factory" );
+
+ // Create the producer
+ mlt_producer producer = mlt_factory_producer( factory, resource );
+
+ // If we have one
+ if ( producer != NULL )
+ {
+ // Get the producer properties
+ mlt_properties producer_properties = mlt_producer_properties( producer );
+
+ // Ensure that we loop
+ mlt_properties_set( producer_properties, "eof", "loop" );
+
+ // Now pass all producer. properties on the transition down
+ mlt_properties_pass( producer_properties, properties, "luma." );
+
+ // We will get the alpha frame from the producer
+ mlt_frame luma_frame = NULL;
+
+ // Get the luma frame
+ if ( mlt_service_get_frame( mlt_producer_service( producer ), &luma_frame, 0 ) == 0 )
+ {
+ uint8_t *luma_image;
+ mlt_image_format luma_format = mlt_image_yuv422;
+
+ // Request a luma image the size of transition image request
+ luma_width = width;
+ luma_height = height;
+
+ // Get image from the luma producer
+ mlt_properties_set( mlt_frame_properties( luma_frame ), "distort", "true" );
+ mlt_frame_get_image( luma_frame, &luma_image, &luma_format, &luma_width, &luma_height, 0 );
+
+ // Generate the luma map
+ if ( luma_image != NULL && luma_format == mlt_image_yuv422 )
+ {
+ luma_read_yuv422( luma_image, &luma_bitmap, luma_width, luma_height );
+
+ // Set the transition properties
+ mlt_properties_set_int( properties, "_luma.width", luma_width );
+ mlt_properties_set_int( properties, "_luma.height", luma_height );
+ mlt_properties_set_data( properties, "_luma.bitmap", luma_bitmap, luma_width * luma_height * 2, mlt_pool_release, NULL );
+ }
+
+ // Cleanup the luma frame
+ mlt_frame_close( luma_frame );
+ }
+
+ // Cleanup the luma producer
+ mlt_producer_close( producer );
+ }
+ }
+ }
+ return luma_bitmap;
+}
/** Get the properly sized image from b_frame.
*/
int real_height = get_value( b_props, "real_height", "height" );
double input_ar = mlt_frame_get_aspect_ratio( b_frame );
double output_ar = mlt_properties_get_double( b_props, "consumer_aspect_ratio" );
- int scaled_width = real_width;
+ int scaled_width = input_ar / output_ar * real_width;
int scaled_height = real_height;
- double output_sar = ( double ) geometry->nw / geometry->nh / output_ar;
-
- // If the output is fat pixels (NTSC) then stretch our input horizontally
- // derived from: output_sar / input_sar * real_width
- scaled_width = output_sar * real_height * input_ar;
// Now ensure that our images fit in the normalised frame
if ( scaled_width > normalised_width )
// Do the calculation
struct geometry_s *start = composite_calculate( &result, this, a_frame, position );
+
+ // Optimisation - no compositing required
+ if ( result.mix == 0 )
+ return 0;
// Since we are the consumer of the b_frame, we must pass along these
// consumer properties from the a_frame
mlt_properties_set_double( b_props, "consumer_aspect_ratio", mlt_properties_get_double( a_props, "consumer_aspect_ratio" ) );
- mlt_properties_set_double( b_props, "consumer_scale", mlt_properties_get_double( a_props, "consumer_scale" ) );
// Get the image from the b frame
uint8_t *image_b = NULL;
mlt_properties_get_int( a_props, "consumer_progressive" ) ||
mlt_properties_get_int( properties, "progressive" );
int field;
+
+ int32_t luma_softness = mlt_properties_get_double( properties, "softness" ) * ( 1 << 16 );
+ uint16_t *luma_bitmap = get_luma( properties, width_b, height_b );
for ( field = 0; field < ( progressive ? 1 : 2 ); field++ )
{
alignment_calculate( &result );
// Composite the b_frame on the a_frame
- composite_yuv( dest, *width, *height, bpp, src, width_b, height_b, alpha, result, progressive ? -1 : field );
+ composite_yuv( dest, *width, *height, bpp, src, width_b, height_b, alpha, result, progressive ? -1 : field, luma_bitmap, luma_softness );
}
}
}
{
this->process = composite_process;
mlt_properties_set( mlt_transition_properties( this ), "start", arg != NULL ? arg : "85%,5%:10%x10%" );
+
+ // Default factory
+ mlt_properties_set( mlt_transition_properties( this ), "factory", "fezzik" );
}
return this;
}
-
luma_height = *height;
// Get image from the luma producer
+ mlt_properties_set( mlt_frame_properties( luma_frame ), "distort", "true" );
mlt_frame_get_image( luma_frame, &luma_image, &luma_format, &luma_width, &luma_height, 0 );
// Generate the luma map
// Parse the header for meta info
dv_parse_header( this->dv_decoder, dv_data );
- mlt_properties_set_double( properties, "aspect_ratio", dv_format_wide( this->dv_decoder ) ? 16.0/9.0 : 4.0/3.0 );
+ mlt_properties_set_double( properties, "aspect_ratio",
+ dv_format_wide( this->dv_decoder ) ? ( this->is_pal ? 512/351 : 96/79 ) : ( this->is_pal ? 128/117 : 72/79 ) );
}
mlt_pool_release( dv_data );
// Parse the header for meta info
dv_parse_header( this->dv_decoder, data );
mlt_properties_set_int( properties, "progressive", dv_is_progressive( this->dv_decoder ) );
- mlt_properties_set_double( properties, "aspect_ratio", dv_format_wide( this->dv_decoder ) ? 16.0/9.0 : 4.0/3.0 );
+ mlt_properties_set_double( properties, "aspect_ratio",
+ dv_format_wide( this->dv_decoder ) ? ( this->is_pal ? 512.0/351.0 : 96.0/79.0 ) : ( this->is_pal ? 128.0/117.0 : 72.0/79.0 ) );
// Hmm - register audio callback
( *frame )->get_audio = producer_get_audio;
// Free the memory
free( this );
}
-
// Set producer-specific frame properties
mlt_properties_set_int( properties, "progressive", 1 );
- mlt_properties_set_double( properties, "aspect_ratio", mlt_properties_get_double( properties, "real_width" ) / mlt_properties_get_double( properties, "real_height" ) );
+ mlt_properties_set_double( properties, "aspect_ratio", 1 );
// Set alpha call back
( *frame )->get_alpha_mask = producer_get_alpha_mask;
return pixbuf;
}
-
mlt_properties properties = mlt_producer_properties( producer );
char *filename = mlt_properties_get( properties, "resource" );
+ // Read xml string
+ if ( strstr( filename, "<svg" ) )
+ {
+ // Generate a temporary file for the svg
+ char fullname[ 1024 ] = "/tmp/mlt.XXXXXX";
+ int fd = mkstemp( fullname );
+
+ if ( fd > -1 )
+ {
+ // Write the svg into the temp file
+ ssize_t remaining_bytes;
+ char *xml = filename;
+
+ // Strip leading crap
+ while ( xml[0] != '<' )
+ xml++;
+
+ remaining_bytes = strlen( xml );
+ while ( remaining_bytes > 0 )
+ remaining_bytes -= write( fd, xml + strlen( xml ) - remaining_bytes, remaining_bytes );
+ close( fd );
+
+ this->filenames = realloc( this->filenames, sizeof( char * ) * ( this->count + 1 ) );
+ this->filenames[ this->count ++ ] = strdup( fullname );
+
+ mlt_properties_set_position( properties, "out", 250 );
+
+ // Teehe - when the producer closes, delete the temp file and the space allo
+ mlt_properties_set_data( properties, "__temporary_file__", this->filenames[ this->count - 1 ], 0, ( mlt_destructor )unlink, NULL );
+ }
+ }
// Obtain filenames
- if ( strchr( filename, '%' ) != NULL )
+ else if ( strchr( filename, '%' ) != NULL )
{
// handle picture sequences
int i = 0;
free( de );
free( dir_name );
}
- else if ( strstr( filename, "<svg" ) )
- {
- // Generate a temporary file for the svg
- char fullname[ 1024 ] = "/tmp/mlt.XXXXXX";
- int fd = mkstemp( fullname );
-
- if ( fd > -1 )
- {
- // Write the svg into the temp file
- ssize_t remaining_bytes = strlen( filename );
- while ( remaining_bytes > 0 )
- remaining_bytes -= write( fd, filename + strlen( filename ) - remaining_bytes, remaining_bytes );
- close( fd );
-
- this->filenames = realloc( this->filenames, sizeof( char * ) * ( this->count + 1 ) );
- this->filenames[ this->count ++ ] = strdup( fullname );
-
- mlt_properties_set_position( properties, "out", 250 );
-
- // Teehe - when the producer closes, delete the temp file and the space allo
- mlt_properties_set_data( properties, "__temporary_file__", this->filenames[ this->count - 1 ], 0, ( mlt_destructor )unlink, NULL );
- }
- }
else
{
this->filenames = realloc( this->filenames, sizeof( char * ) * ( this->count + 1 ) );
// Set producer-specific frame properties
mlt_properties_set_int( properties, "progressive", 1 );
- mlt_properties_set_double( properties, "aspect_ratio", mlt_properties_get_double( properties, "real_width" )/mlt_properties_get_double( properties, "real_height" ) );
+ mlt_properties_set_double( properties, "aspect_ratio", 1 );
// Set alpha call back
( *frame )->get_alpha_mask = producer_get_alpha_mask;
free( this->filenames );
free( this );
}
-
this->width = mlt_properties_get_int( this->properties, "width" );
this->height = mlt_properties_get_int( this->properties, "height" );
}
-
+
// Default window size
- this->window_width = (int)( (float)this->height * this->aspect_ratio ) + 1;
+ this->window_width = (int)( (float)this->height * 4.0/3.0 + 0.5);
this->window_height = this->height;
// Set the sdl flags
// Set skip
mlt_properties_set_position( mlt_frame_properties( frame ), "playtime", playtime );
- mlt_properties_set_double( mlt_frame_properties( frame ), "consumer_scale", ( double )height / mlt_properties_get_double( properties, "height" ) );
// Push this frame to the back of the queue
mlt_deque_push_back( this->queue, frame );
if ( this->sdl_screen == NULL || changed )
{
- double aspect_ratio = mlt_frame_get_aspect_ratio( frame );
- float display_aspect_ratio = (float)width / (float)height;
+ double aspect_ratio = ( float )this->aspect_ratio * this->width / this->height;
+ float display_aspect_ratio = ( float )width / height;
SDL_Rect rect;
-
- if ( mlt_properties_get_double( properties, "aspect_ratio" ) )
- aspect_ratio = mlt_properties_get_double( properties, "aspect_ratio" );
+ if ( mlt_properties_get( properties, "rescale" ) != NULL &&
+ !strcmp( mlt_properties_get( properties, "rescale" ), "none" ) )
+ aspect_ratio = mlt_frame_get_aspect_ratio( frame ) * mlt_properties_get_int(mlt_frame_properties(frame),"width") / mlt_properties_get_int(mlt_frame_properties(frame),"height");
if ( aspect_ratio == 1 )
{
else if ( this->window_width < this->window_height * aspect_ratio )
{
rect.w = this->window_width;
- rect.h = this->window_width / aspect_ratio;
+ rect.h = this->window_width / aspect_ratio + 1;
}
else
{
- rect.w = this->window_height * aspect_ratio;
+ rect.w = this->window_height * aspect_ratio + 1;
rect.h = this->window_height;
}
// Finally clean up this
free( this );
}
-
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-// TODO: destroy unreferenced producers
+// TODO: destroy unreferenced producers (they are currently destroyed
+// when the returned producer is closed).
+// TODO: try using XmlReader interface to avoid global context issues in sax.
#include "producer_westley.h"
#include <framework/mlt.h>
if ( properties == NULL )
return;
- // Instatiate the producer
- if ( mlt_properties_get( properties, "resource" ) != NULL )
+ // Instantiate the producer
+ if ( mlt_properties_get( properties, "mlt_service" ) != NULL )
+ {
+ service = MLT_SERVICE( mlt_factory_producer( "fezzik", mlt_properties_get( properties, "mlt_service" ) ) );
+ }
+ if ( service == NULL && mlt_properties_get( properties, "resource" ) != NULL )
{
char *root = mlt_properties_get( context->producer_map, "_root" );
char *resource = mlt_properties_get( properties, "resource" );
service = MLT_SERVICE( mlt_factory_producer( "fezzik", full_resource ) );
free( full_resource );
}
- if ( service == NULL && mlt_properties_get( properties, "mlt_service" ) != NULL )
- {
- service = MLT_SERVICE( mlt_factory_producer( "fezzik", mlt_properties_get( properties, "mlt_service" ) ) );
- }
track_service( context->destructors, service, (mlt_destructor) mlt_producer_close );
sax->startElement = on_start_element;
sax->endElement = on_end_element;
sax->characters = on_characters;
+ sax->cdataBlock = on_characters;
// I REALLY DON'T GET THIS - HOW THE HELL CAN YOU REFERENCE A WESTLEY IN A WESTLEY???
xmlInitParser();
mlt_properties_close( context->producer_map );
//free( context );
free( sax );
- xmlCleanupParser();
+ //xmlCleanupParser();
xmlMemoryDump( );
return MLT_PRODUCER( service );
}
-