ffmpeg must be configured as --enable-shared and installed prior
to compilation of mlt.
- Oddities
-
- MPEG video remains elusive.
-
Known Bugs
- Fixed frame rate.
Audio sync discrepancy with some content.
Not all libavformat supported formats are seekable.
ogg is currently broken.
none
+ resample
+
+ Description
+
+ Adjust an audio stream's sampling rate
+
+ Constructor Argument
+
+ frequency - a numeric value for the new sample rate
+
+ Initialisation Properties
+
+ int in - in point
+ int out - out point
+
+ Mutable Properties
+
+ int frequency - the target sample rate
+
+ Dependencies
+
+ libresample
+
+ Known Bugs
+
+ none
+
+ rescale
+
+ Description
+
+ Scale the producer video frame size to match the consumer.
+
+ Constructor Argument
+
+ interpolation - the rescaling method, one of:
+ nearest (lowest quality, fastest),
+ tiles,
+ bilinear (good quality, moderate speed),
+ hyper (best quality, slowest)
+
+ Initialisation Properties
+
+ int in - in point
+ int out - out point
+
+ Mutable Properties
+
+ string interpolation - see constructor argument above
+
+ If a property "consumer_aspect_ratio" exists on the frame, then
+ rescaler normalises the producer's aspect ratio and maximises the
+ size of the frame, but may not produce the consumer's requested
+ dimension. Therefore, this option works best in conjunction with the
+ resize filter. This behavior can be disabled by another service by
+ either removing the property, setting it to zero, or setting
+ frame property "distort" to 1.
+
+ Dependencies
+
+ libgdk_pixbuf-2.0, libglib-2.0, libgobject-2.0, libgmodule-2.0
+
+ Known Bugs
+
+ none
+
volume
Description
none
- resample
+ watermark
Description
- Adjust an audio stream's sampling rate
+ Add a watermark to the frames.
Constructor Argument
- frequency - a numeric value for the new sample rate
+ resource - the producer to use (ie: a .png)
Initialisation Properties
+ string resource - the producer to use
+ string factory - producer required for the resource ('fezzik')
+ string geometry - composite geometry
+ string distort - control scaling
int in - in point
int out - out point
Mutable Properties
- int frequency - the target sample rate
-
- Dependencies
-
- libresample
-
- Known Bugs
-
none
- rescale
-
- Description
-
- Scale the producer video frame size to match the consumer.
-
- Constructor Argument
-
- interpolation - the rescaling method, one of:
- nearest (lowest quality, fastest),
- tiles,
- bilinear (good quality, moderate speed),
- hyper (best quality, slowest)
-
- Initialisation Properties
-
- int in - in point
- int out - out point
-
- Mutable Properties
-
- string interpolation - see constructor argument above
-
- If a property "consumer_aspect_ratio" exists on the frame, then
- rescaler normalises the producer's aspect ratio and maximises the
- size of the frame, but may not produce the consumer's requested
- dimension. Therefore, this option works best in conjunction with the
- resize filter. This behavior can be disabled by another service by
- either removing the property, setting it to zero, or setting
- frame property "distort" to 1.
-
Dependencies
- libgdk_pixbuf-2.0, libglib-2.0, libgobject-2.0, libgmodule-2.0
+ mlt core modules and optionally, fezzik
Known Bugs
void mlt_frame_close( mlt_frame this )
{
- mlt_deque_close( this->stack_get_image );
- mlt_deque_close( this->stack_frame );
- mlt_properties_close( &this->parent );
- free( this );
+ if ( this != NULL )
+ {
+ mlt_deque_close( this->stack_get_image );
+ mlt_deque_close( this->stack_frame );
+ mlt_properties_close( &this->parent );
+ free( this );
+ }
}
/***** convenience functions *****/
/** Public final methods
*/
-//extern double mlt_producer_convert_position_to_time( mlt_producer this, int64_t frame );
-//extern mlt_position mlt_producer_convert_time_to_position( mlt_producer this, double time );
-
extern int mlt_producer_init( mlt_producer this, void *child );
extern mlt_service mlt_producer_service( mlt_producer this );
extern mlt_properties mlt_producer_properties( mlt_producer this );
mlt_properties_set_position( properties, "out", 0 );
mlt_properties_set_int( properties, "a_track", 0 );
mlt_properties_set_int( properties, "b_track", 1 );
- mlt_properties_set( properties, "resource", "<transition>" );
return 0;
}
return 1;
}
+/** Create a new transition.
+*/
+
+mlt_transition mlt_transition_new( )
+{
+ mlt_transition this = calloc( 1, sizeof( struct mlt_transition_s ) );
+ if ( this != NULL )
+ mlt_transition_init( this, NULL );
+ return this;
+}
+
/** Get the service associated to the transition.
*/
If we have no process method (unlikely), we simply return the a_frame unmolested.
*/
-static mlt_frame transition_process( mlt_transition this, mlt_frame a_frame, mlt_frame b_frame )
+mlt_frame mlt_transition_process( mlt_transition this, mlt_frame a_frame, mlt_frame b_frame )
{
if ( this->process == NULL )
return a_frame;
if ( position >= in && position <= out )
{
// Process the transition
- *frame = transition_process( this, this->a_frame, this->b_frame );
+ *frame = mlt_transition_process( this, this->a_frame, this->b_frame );
this->a_held = 0;
}
else
*/
extern int mlt_transition_init( mlt_transition this, void *child );
+extern mlt_transition mlt_transition_new( );
extern mlt_service mlt_transition_service( mlt_transition this );
extern mlt_properties mlt_transition_properties( mlt_transition this );
extern int mlt_transition_connect( mlt_transition this, mlt_service producer, int a_track, int b_track );
extern int mlt_transition_get_b_track( mlt_transition this );
extern mlt_position mlt_transition_get_in( mlt_transition this );
extern mlt_position mlt_transition_get_out( mlt_transition this );
+extern mlt_frame mlt_transition_process( mlt_transition this, mlt_frame a_frame, mlt_frame b_frame );
extern void mlt_transition_close( mlt_transition this );
#endif
OBJS = factory.o \
producer_ppm.o \
+ filter_brightness.o \
filter_deinterlace.o \
filter_greyscale.o \
filter_gamma.o \
filter_obscure.o \
filter_resize.o \
filter_volume.o \
+ filter_watermark.o \
transition_composite.o \
transition_luma.o \
- transition_mix.o \
- filter_brightness.o
+ transition_mix.o
CFLAGS = -O3 -I../../ -Wall -g -D_FILE_OFFSET_BITS=64 -pthread
EOF
cat << EOF >> ../filters.dat
+brightness libmltcore.so
deinterlace libmltcore.so
gamma libmltcore.so
greyscale libmltcore.so
+obscure libmltcore.so
resize libmltcore.so
volume libmltcore.so
-obscure libmltcore.so
-brightness libmltcore.so
+watermark libmltcore.so
EOF
cat << EOF >> ../transitions.dat
#include <string.h>
#include "producer_ppm.h"
+#include "filter_brightness.h"
#include "filter_deinterlace.h"
#include "filter_gamma.h"
#include "filter_greyscale.h"
#include "filter_obscure.h"
#include "filter_resize.h"
#include "filter_volume.h"
+#include "filter_watermark.h"
#include "transition_composite.h"
#include "transition_luma.h"
#include "transition_mix.h"
-#include "filter_brightness.h"
void *mlt_create_producer( char *id, void *arg )
{
void *mlt_create_filter( char *id, void *arg )
{
+ if ( !strcmp( id, "brightness" ) )
+ return filter_brightness_init( arg );
if ( !strcmp( id, "deinterlace" ) )
return filter_deinterlace_init( arg );
if ( !strcmp( id, "gamma" ) )
return filter_resize_init( arg );
if ( !strcmp( id, "volume" ) )
return filter_volume_init( arg );
- if ( !strcmp( id, "brightness" ) )
- return filter_brightness_init( arg );
+ if ( !strcmp( id, "watermark" ) )
+ return filter_watermark_init( arg );
return NULL;
}
mlt_filter this = mlt_deque_pop_back( deque );
// Get the image from the frame
- if ( mlt_frame_get_image( frame, image, format, width, height, 1 ) == 0 )
+ int error = mlt_frame_get_image( frame, image, format, width, height, 1 );
+
+ // Get the image from the frame
+ if ( error == 0 && *format == mlt_image_yuv422 )
{
if ( this != NULL )
{
}
}
- return 0;
+ return error;
}
/** Filter processing.
#include <string.h>
#include <stdlib.h>
-static int get_value( mlt_properties properties, char *preferred, char *fallback )
-{
- int value = mlt_properties_get_int( properties, preferred );
- if ( value == 0 )
- value = mlt_properties_get_int( properties, fallback );
- return value;
-}
-
/** Do it :-).
*/
if ( mlt_filter_init( this, this ) == 0 )
{
this->process = filter_process;
- if ( arg != NULL )
- mlt_properties_set( mlt_filter_properties( this ), "scale", arg );
- else
- mlt_properties_set( mlt_filter_properties( this ), "scale", "off" );
+ mlt_properties_set( mlt_filter_properties( this ), "scale", arg == NULL ? "off" : arg );
}
return this;
}
--- /dev/null
+/*
+ * filter_watermark.c -- watermark filter
+ * Copyright (C) 2003-2004 Ushodaya Enterprises Limited
+ * Author: Charles Yates <charles.yates@pandora.be>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#include "filter_watermark.h"
+
+#include <framework/mlt_factory.h>
+#include <framework/mlt_frame.h>
+#include <framework/mlt_producer.h>
+#include <framework/mlt_transition.h>
+
+#include <stdio.h>
+#include <stdlib.h>
+
+/** Do it :-).
+*/
+
+static int filter_get_image( mlt_frame this, uint8_t **image, mlt_image_format *format, int *width, int *height, int writable )
+{
+ int error = 0;
+ mlt_properties frame_properties = mlt_frame_properties( this );
+ mlt_filter filter = mlt_properties_get_data( frame_properties, "watermark", NULL );
+ mlt_properties properties = mlt_filter_properties( filter );
+ mlt_producer producer = mlt_properties_get_data( properties, "producer", NULL );
+ mlt_transition composite = mlt_properties_get_data( properties, "composite", NULL );
+
+ if ( composite == NULL )
+ {
+ char *geometry = mlt_properties_get( properties, "geometry" );
+ composite = mlt_factory_transition( "composite", geometry == NULL ? "85%,5%:10%x10%" : geometry );
+ if ( composite != NULL )
+ {
+ mlt_properties composite_properties = mlt_transition_properties( composite );
+ char *distort = mlt_properties_get( properties, "distort" );
+ if ( distort != NULL )
+ mlt_properties_set( composite_properties, "distort", distort );
+ mlt_properties_set_data( properties, "composite", composite, 0, ( mlt_destructor )mlt_transition_close, NULL );
+ }
+ }
+
+ if ( producer == NULL )
+ {
+ char *resource = mlt_properties_get( properties, "resource" );
+ char *factory = mlt_properties_get( properties, "factory" );
+ producer = mlt_factory_producer( factory, resource );
+ if ( producer != NULL )
+ {
+ mlt_properties producer_properties = mlt_producer_properties( producer );
+ mlt_properties_set( producer_properties, "eof", "loop" );
+ mlt_properties_set_data( properties, "producer", producer, 0, ( mlt_destructor )mlt_producer_close, NULL );
+ }
+ }
+
+ if ( composite != NULL && producer != NULL )
+ {
+ mlt_service service = mlt_producer_service( producer );
+ mlt_frame b_frame = NULL;
+
+ if ( mlt_service_get_frame( service, &b_frame, 0 ) == 0 )
+ mlt_transition_process( composite, this, b_frame );
+
+ error = mlt_frame_get_image( this, image, format, width, height, 1 );
+
+ mlt_frame_close( b_frame );
+ }
+ else
+ {
+ error = mlt_frame_get_image( this, image, format, width, height, 1 );
+ }
+
+ return error;
+}
+
+/** Filter processing.
+*/
+
+static mlt_frame filter_process( mlt_filter this, mlt_frame frame )
+{
+ mlt_properties properties = mlt_frame_properties( frame );
+ mlt_properties_set_data( properties, "watermark", this, 0, NULL, NULL );
+ mlt_frame_push_get_image( frame, filter_get_image );
+ return frame;
+}
+
+/** Constructor for the filter.
+*/
+
+mlt_filter filter_watermark_init( void *arg )
+{
+ mlt_filter this = mlt_filter_new( );
+ if ( this != NULL )
+ {
+ mlt_properties properties = mlt_filter_properties( this );
+ this->process = filter_process;
+ mlt_properties_set( properties, "factory", "fezzik" );
+ if ( arg != NULL )
+ mlt_properties_set( properties, "resource", arg );
+ }
+ return this;
+}
+
--- /dev/null
+/*
+ * filter_watermark.h -- watermark filter
+ * Copyright (C) 2003-2004 Ushodaya Enterprises Limited
+ * Author: Charles Yates <charles.yates@pandora.be>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef _FILTER_WATERMARK_H_
+#define _FILTER_WATERMARK_H_
+
+#include <framework/mlt_filter.h>
+
+extern mlt_filter filter_watermark_init( void *arg );
+
+#endif
mlt_filter filter_ffmpeg_dub_init( char *file )
{
// Create the filter object
- mlt_filter this = calloc( sizeof( struct mlt_filter_s ), 1 );
+ mlt_filter this = mlt_filter_new( );
// Initialise it
- mlt_filter_init( this, NULL );
-
- // Overide the filter process method
- this->process = filter_process;
+ if ( this != NULL )
+ {
+ // Obtain the properties
+ mlt_properties properties = mlt_filter_properties( this );
- // Obtain the properties
- mlt_properties properties = mlt_filter_properties( this );
+ // Create an ffmpeg producer
+ // TODO: THIS SHOULD NOT BE HERE....
+ mlt_producer producer = mlt_factory_producer( "ffmpeg", file );
- // Create an ffmpeg producer
- mlt_producer producer = mlt_factory_producer( "ffmpeg", file );
+ // Overide the filter process method
+ this->process = filter_process;
- // Pass the producer
- mlt_properties_set_data( properties, "producer", producer, 0, ( mlt_destructor )mlt_producer_close, NULL );
+ // Pass the producer
+ mlt_properties_set_data( properties, "producer", producer, 0, ( mlt_destructor )mlt_producer_close, NULL );
- // Initialise the audio frame position
- mlt_properties_set_position( properties, "dub_position", 0 );
+ // Initialise the audio frame position
+ mlt_properties_set_position( properties, "dub_position", 0 );
+ }
return this;
}
mlt_filter filter_rescale_init( char *arg )
{
- mlt_filter this = calloc( sizeof( struct mlt_filter_s ), 1 );
- if ( mlt_filter_init( this, this ) == 0 )
+ mlt_filter this = mlt_filter_new( );
+ if ( this != NULL )
{
this->process = filter_process;
- if ( arg != NULL )
- mlt_properties_set( mlt_filter_properties( this ), "interpolation", arg );
- else
- mlt_properties_set( mlt_filter_properties( this ), "interpolation", "bilinear" );
+ mlt_properties_set( mlt_filter_properties( this ), "interpolation", arg == NULL ? "bilinear" : arg );
}
return this;
}
mlt_filter filter_resample_init( char *arg )
{
- mlt_filter this = calloc( sizeof( struct mlt_filter_s ), 1 );
- if ( this != NULL && mlt_filter_init( this, NULL ) == 0 )
+ mlt_filter this = mlt_filter_new( );
+ if ( this != NULL )
{
int error;
SRC_STATE *state = src_new( RESAMPLE_TYPE, 2 /* channels */, &error );