Audio sync discrepancy with some content.
Not all libavformat supported formats are seekable.
ogg is currently broken.
- Multiple mp3 uses in a single instance causes crash (patch
- available on request - submitted to ffmpeg mailing list).
mpeg seeking is inaccurate - doesn't seek to i-frames so you may
get junk for a few frames.
none
+ obscure
+
+ Description
+
+ Obscuring filter.
+
+ Constructor Argument
+
+ none
+
+ Initialisation Properties
+
+ string start - in the format X,Y:WxH[:PWxPY]
+ string end - in the format X,Y:WxH[:PWxPY]
+ int in - in point
+ int out - out point
+
+ Read Only Properties
+
+ none
+
+ Dependencies
+
+ none
+
+ Known Bugs
+
+ none
+
resize
Description
`pwd`/src/miracle:\
`pwd`/src/modules/bluefish:\
`pwd`/../bluefish/lib:\
-`pwd`/../mpeg_sdk_demo/bin:\
-`pwd`/../dv_sdk
+`pwd`/../mpeg_sdk_release/bin:\
+`pwd`/../dv_sdk_release
export PATH=\
`pwd`/src/albino:\
mlt_properties_init( properties, this );
// Set default properties on the frame
- mlt_properties_set_position( properties, "position", 0.0 );
+ mlt_properties_set_position( properties, "_position", 0.0 );
mlt_properties_set_data( properties, "image", NULL, 0, NULL, NULL );
mlt_properties_set_int( properties, "width", 720 );
mlt_properties_set_int( properties, "height", 576 );
mlt_position mlt_frame_get_position( mlt_frame this )
{
- return mlt_properties_get_position( mlt_frame_properties( this ), "position" );
+ return mlt_properties_get_position( mlt_frame_properties( this ), "_position" );
}
/** Set the position of this frame.
int mlt_frame_set_position( mlt_frame this, mlt_position value )
{
- return mlt_properties_set_position( mlt_frame_properties( this ), "position", value );
+ return mlt_properties_set_position( mlt_frame_properties( this ), "_position", value );
}
/** Stack a get_image callback.
double d = 0, s = 0;
mlt_frame_get_audio( this, &p_dest, format, &frequency_dest, &channels_dest, &samples_dest );
- //fprintf( stderr, "frame dest samples %d channels %d position %lld\n", samples_dest, channels_dest, mlt_properties_get_position( mlt_frame_properties( this ), "position" ) );
+ //fprintf( stderr, "frame dest samples %d channels %d position %lld\n", samples_dest, channels_dest, mlt_properties_get_position( mlt_frame_properties( this ), "_position" ) );
mlt_frame_get_audio( that, &p_src, format, &frequency_src, &channels_src, &samples_src );
//fprintf( stderr, "frame src samples %d channels %d\n", samples_src, channels_src );
src = p_src;
// Indicate speed of this producer
mlt_properties producer_properties = mlt_producer_properties( parent );
- double speed = mlt_properties_get_double( producer_properties, "speed" );
+ double speed = mlt_properties_get_double( producer_properties, "_speed" );
mlt_properties properties = mlt_frame_properties( *frame );
- mlt_properties_set_double( properties, "speed", speed );
+ mlt_properties_set_double( properties, "_speed", speed );
}
else
{
// Set the default properties
mlt_properties_set( properties, "mlt_type", "mlt_producer" );
- mlt_properties_set_position( properties, "position", 0.0 );
- mlt_properties_set_double( properties, "frame", 0 );
+ mlt_properties_set_position( properties, "_position", 0.0 );
+ mlt_properties_set_double( properties, "_frame", 0 );
mlt_properties_set_double( properties, "fps", 25.0 );
- mlt_properties_set_double( properties, "speed", 1.0 );
+ mlt_properties_set_double( properties, "_speed", 1.0 );
mlt_properties_set_position( properties, "in", 0 );
mlt_properties_set_position( properties, "out", 1799999 );
mlt_properties_set_position( properties, "length", 1800000 );
position = mlt_producer_get_playtime( this ) - 1;
// Set the position
- mlt_properties_set_position( mlt_producer_properties( this ), "position", position );
+ mlt_properties_set_position( mlt_producer_properties( this ), "_position", position );
// Calculate the absolute frame
- mlt_properties_set_position( mlt_producer_properties( this ), "frame", mlt_producer_get_in( this ) + position );
+ mlt_properties_set_position( mlt_producer_properties( this ), "_frame", mlt_producer_get_in( this ) + position );
return 0;
}
mlt_position mlt_producer_position( mlt_producer this )
{
- return mlt_properties_get_position( mlt_producer_properties( this ), "position" );
+ return mlt_properties_get_position( mlt_producer_properties( this ), "_position" );
}
/** Get the current position (relative to start of producer).
mlt_position mlt_producer_frame( mlt_producer this )
{
- return mlt_properties_get_position( mlt_producer_properties( this ), "frame" );
+ return mlt_properties_get_position( mlt_producer_properties( this ), "_frame" );
}
/** Set the playing speed.
int mlt_producer_set_speed( mlt_producer this, double speed )
{
- return mlt_properties_set_double( mlt_producer_properties( this ), "speed", speed );
+ return mlt_properties_set_double( mlt_producer_properties( this ), "_speed", speed );
}
/** Get the playing speed.
double mlt_producer_get_speed( mlt_producer this )
{
- return mlt_properties_get_double( mlt_producer_properties( this ), "speed" );
+ return mlt_properties_get_double( mlt_producer_properties( this ), "_speed" );
}
/** Get the frames per second.
mlt_properties properties = mlt_frame_properties( *frame );
mlt_properties_set_double( properties, "fps", mlt_producer_get_fps( this ) );
double speed = mlt_producer_get_speed( this );
- mlt_properties_set_double( properties, "speed", speed );
+ mlt_properties_set_double( properties, "_speed", speed );
return 0;
}
mlt_position in = mlt_properties_get_position( properties, "in" );
mlt_position out = mlt_properties_get_position( properties, "out" );
- // Fetch a and b frames together...
if ( ( index == a_track || index == b_track ) && !( this->a_held || this->b_held ) )
{
mlt_service_get_frame( this->producer, &this->a_frame, a_track );
miracle_unit_status_communicate( this );
}
+static mlt_producer create_producer( char *file )
+{
+ mlt_producer result = NULL;
+
+ // 1st Line preferences
+ if ( strstr( file, ".inigo" ) )
+ result = mlt_factory_producer( "inigo_file", file );
+ else if ( strstr( file, ".westley" ) )
+ result = mlt_factory_producer( "westley", file );
+ else if ( strstr( file, ".mpg" ) )
+ result = mlt_factory_producer( "mcmpeg", file );
+ else if ( strstr( file, ".mpeg" ) )
+ result = mlt_factory_producer( "mcmpeg", file );
+ else if ( strstr( file, ".dv" ) )
+ result = mlt_factory_producer( "mcdv", file );
+ else if ( strstr( file, ".dif" ) )
+ result = mlt_factory_producer( "mcdv", file );
+ else if ( strstr( file, ".jpg" ) )
+ result = mlt_factory_producer( "pixbuf", file );
+ else if ( strstr( file, ".JPG" ) )
+ result = mlt_factory_producer( "pixbuf", file );
+ else if ( strstr( file, ".jpeg" ) )
+ result = mlt_factory_producer( "pixbuf", file );
+ else if ( strstr( file, ".png" ) )
+ result = mlt_factory_producer( "pixbuf", file );
+ else if ( strstr( file, ".tga" ) )
+ result = mlt_factory_producer( "pixbuf", file );
+ else if ( strstr( file, ".txt" ) )
+ result = mlt_factory_producer( "pango", file );
+ else if ( strstr( file, ".ogg" ) )
+ result = mlt_factory_producer( "vorbis", file );
+
+ // 2nd Line fallbacks
+ if ( result == NULL && strstr( file, ".dv" ) )
+ result = mlt_factory_producer( "libdv", file );
+ else if ( result == NULL && strstr( file, ".dif" ) )
+ result = mlt_factory_producer( "libdv", file );
+
+ // 3rd line fallbacks
+ if ( result == NULL )
+ result = mlt_factory_producer( "avformat", file );
+
+ // 4th line fallbacks
+ if ( result == NULL )
+ result = mlt_factory_producer( "ffmpeg", file );
+
+ return result;
+}
+
/** Create or locate a producer for the file specified.
*/
-static mlt_producer create_producer( miracle_unit unit, char *file )
+static mlt_producer locate_producer( miracle_unit unit, char *file )
{
// Get the unit properties
mlt_properties properties = unit->producers;
if ( result == NULL )
{
- // 1st Line preferences
- if ( strstr( file, ".inigo" ) )
- result = mlt_factory_producer( "inigo_file", file );
- else if ( strstr( file, ".westley" ) )
- result = mlt_factory_producer( "westley", file );
- else if ( strstr( file, ".mpg" ) )
- result = mlt_factory_producer( "mcmpeg", file );
- else if ( strstr( file, ".mpeg" ) )
- result = mlt_factory_producer( "mcmpeg", file );
- else if ( strstr( file, ".dv" ) )
- result = mlt_factory_producer( "mcdv", file );
- else if ( strstr( file, ".dif" ) )
- result = mlt_factory_producer( "mcdv", file );
- else if ( strstr( file, ".jpg" ) )
- result = mlt_factory_producer( "pixbuf", file );
- else if ( strstr( file, ".JPG" ) )
- result = mlt_factory_producer( "pixbuf", file );
- else if ( strstr( file, ".jpeg" ) )
- result = mlt_factory_producer( "pixbuf", file );
- else if ( strstr( file, ".png" ) )
- result = mlt_factory_producer( "pixbuf", file );
- else if ( strstr( file, ".tga" ) )
- result = mlt_factory_producer( "pixbuf", file );
- else if ( strstr( file, ".txt" ) )
- result = mlt_factory_producer( "pango", file );
- else if ( strstr( file, ".ogg" ) )
- result = mlt_factory_producer( "vorbis", file );
-
- // 2nd Line fallbacks
- if ( result == NULL && strstr( file, ".dv" ) )
- result = mlt_factory_producer( "libdv", file );
- else if ( result == NULL && strstr( file, ".dif" ) )
- result = mlt_factory_producer( "libdv", file );
-
- // 3rd line fallbacks
- if ( result == NULL )
- result = mlt_factory_producer( "avformat", file );
-
- // 4th line fallbacks
- if ( result == NULL )
- result = mlt_factory_producer( "ffmpeg", file );
+ // Create the producer
+ result = create_producer( file );
// Now store the result
- mlt_properties_set_data( properties, file, result, 0, ( mlt_destructor )mlt_producer_close, NULL );
+ if ( result != NULL )
+ mlt_properties_set_data( properties, file, result, 0, ( mlt_destructor )mlt_producer_close, NULL );
}
return result;
valerie_error_code miracle_unit_load( miracle_unit unit, char *clip, int64_t in, int64_t out, int flush )
{
- // Have to clear the unit first
- clear_unit( unit );
-
// Now try to create an producer
- mlt_producer instance = create_producer( unit, clip );
+ mlt_producer instance = create_producer( clip );
if ( instance != NULL )
{
+ clear_unit( unit );
mlt_properties properties = unit->properties;
+ mlt_properties_set_data( unit->producers, clip, instance, 0, ( mlt_destructor )mlt_producer_close, NULL );
mlt_playlist playlist = mlt_properties_get_data( properties, "playlist", NULL );
mlt_playlist_append_io( playlist, instance, in, out );
miracle_log( LOG_DEBUG, "loaded clip %s", clip );
valerie_error_code miracle_unit_insert( miracle_unit unit, char *clip, int index, int64_t in, int64_t out )
{
- mlt_producer instance = create_producer( unit, clip );
+ mlt_producer instance = locate_producer( unit, clip );
if ( instance != NULL )
{
valerie_error_code miracle_unit_append( miracle_unit unit, char *clip, int64_t in, int64_t out )
{
- mlt_producer instance = create_producer( unit, clip );
+ mlt_producer instance = locate_producer( unit, clip );
if ( instance != NULL )
{
// 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 );
-
- // Set the speed to normal
- mlt_properties_set_double( properties, "speed", 1 );
}
free( dv_data );
while ( bytes > ( sizeof( this->audio_buffer) - this->audio_avail ) )
pthread_cond_wait( &this->audio_cond, &this->audio_mutex );
mlt_properties properties = mlt_frame_properties( frame );
- if ( mlt_properties_get_double( properties, "speed" ) == 1 )
+ if ( mlt_properties_get_double( properties, "_speed" ) == 1 )
memcpy( &this->audio_buffer[ this->audio_avail ], pcm, bytes );
else
memset( &this->audio_buffer[ this->audio_avail ], 0, bytes );
// Get the additional properties
double aspect_ratio = mlt_properties_get_double( producer_properties, "aspect_ratio" );
- double speed = mlt_properties_get_double( producer_properties, "speed" );
+ double speed = mlt_producer_get_speed( producer );
// Set them on the frame
mlt_properties_set_double( properties, "aspect_ratio", aspect_ratio );
- mlt_properties_set_double( properties, "speed", speed );
+ mlt_properties_set_double( properties, "_speed", speed );
// Set the out point on the producer
if ( this->end_of_video && this->end_of_audio )
(*buffer)[ i ] = lrint( 32768.0 * sample );
}
}
- else
- fprintf( stderr, "resample_get_audio: %s\n", src_strerror( i ) );
+ //else
+ //fprintf( stderr, "resample_get_audio: %s\n", src_strerror( i ) );
return 0;
}
}
else
{
- fprintf( stderr, "filter_resample_init: %s\n", src_strerror( error ) );
+ //fprintf( stderr, "filter_resample_init: %s\n", src_strerror( error ) );
}
}
return this;
while ( bytes > ( sizeof( this->audio_buffer) - this->audio_avail ) )
pthread_cond_wait( &this->audio_cond, &this->audio_mutex );
mlt_properties properties = mlt_frame_properties( frame );
- if ( mlt_properties_get_double( properties, "speed" ) == 1 )
+ if ( mlt_properties_get_double( properties, "_speed" ) == 1 )
memcpy( &this->audio_buffer[ this->audio_avail ], pcm, bytes );
else
memset( &this->audio_buffer[ this->audio_avail ], 0, bytes );
// Enumerate the properties
for ( i = 0; i < mlt_properties_count( properties ); i++ )
{
- if ( mlt_properties_get_value( properties, i ) != NULL &&
- strcmp( mlt_properties_get_name( properties, i ), "westley" ) != 0 )
+ char *name = mlt_properties_get_name( properties, i );
+ if ( name != NULL &&
+ name[ 0 ] != '_' &&
+ mlt_properties_get_value( properties, i ) != NULL &&
+ strcmp( name, "westley" ) != 0 )
{
#if 0
p = xmlNewChild( node, NULL, "prop", NULL );
static void on_start_tractor( deserialise_context context, const xmlChar *name, const xmlChar **atts)
{
mlt_service service = mlt_tractor_service( mlt_tractor_init() );
+ mlt_properties properties = mlt_service_properties( service );
track_service( context->destructors, service, (mlt_destructor) mlt_tractor_close );
+ mlt_properties_set_position( properties, "length", 0 );
+
for ( ; atts != NULL && *atts != NULL; atts += 2 )
mlt_properties_set( mlt_service_properties( service ), (char*) atts[0], (char*) atts[1] );
+ if ( mlt_properties_get_position( properties, "length" ) < mlt_properties_get_position( properties, "out" ) )
+ {
+ mlt_position length = mlt_properties_get_position( properties, "out" ) + 1;
+ mlt_properties_set_position( properties, "length", length );
+ }
+
context_push_service( context, service );
}
track_service( context->destructors, service, (mlt_destructor) mlt_playlist_close );
+ mlt_properties_set_position( properties, "length", 0 );
+
for ( ; atts != NULL && *atts != NULL; atts += 2 )
mlt_properties_set( properties, (char*) atts[0], (char*) atts[1] );
if ( mlt_properties_get( properties, "id" ) != NULL )
mlt_properties_set_data( context->producer_map, mlt_properties_get( properties, "id" ), service, 0, NULL, NULL );
+ if ( mlt_properties_get_position( properties, "length" ) < mlt_properties_get_position( properties, "out" ) )
+ {
+ mlt_position length = mlt_properties_get_position( properties, "out" ) + 1;
+ mlt_properties_set_position( properties, "length", length );
+ }
+
context_push_service( context, service );
}
}
// Append a blank to the playlist
- mlt_playlist_blank( MLT_PLAYLIST( service ), length );
+ mlt_playlist_blank( MLT_PLAYLIST( service ), length - 1 );
// Push the playlist back onto the stack
context_push_service( context, service );
if ( !init )
{
xmlInitParser();
- init = 1;
+ //init = 1;
}
xmlSAXUserParseFile( sax, context, filename );
- free( sax );
// Need the complete producer list for various reasons
properties = context->destructors;
free( context->stack_service );
mlt_properties_close( context->producer_map );
- free( context );
+ //free( context );
+ free( sax );
+ xmlCleanupParser();
+ xmlMemoryDump( );
+
return MLT_PRODUCER( service );
}