case $1 in
--help ) field=0 ;;
--version ) field=-1 ;;
+ --prefix ) field=-2 ;;
--prefix=* ) prefix="${i#--prefix=}" ;;
--cflags ) field=2 ;;
--libs ) field=3 ;;
then echo "Usage: mlt-config [ --version ] | [ --prefix=dir ] [ [ package ] [ --cflags ] [ --libs ] ]"
elif [ "$field" = "-1" ]
then echo $version
+elif [ "$field" = "-2" ]
+then config=`which mlt-config`
+ dir=`dirname $config`
+ dir=`dirname $dir`
+ echo $dir
elif [ -f "$prefix/share/mlt/packages.dat" ]
then grep "^$package" $prefix/share/mlt/packages.dat | cut -f $field
else echo mlt-config cannot find package $package.
#!/bin/sh
-echo "framework -I$prefix/include/mlt -D_REENTRANT -lmlt" >> ../../packages.dat
+echo "framework -I$prefix/include/mlt -D_REENTRANT -L$prefix/lib -lmlt" >> ../../packages.dat
#!/bin/sh
-echo "miracle -I$prefix/include/mlt -D_REENTRANT -lmiracle" >> ../../packages.dat
+echo "miracle -I$prefix/include/mlt -D_REENTRANT -L$prefix/lib -lmiracle" >> ../../packages.dat
TARGET = ../libmltgtk2.so
OBJS = factory.o \
+ consumer_gtk2.o \
producer_pixbuf.o \
producer_pango.o \
pixops.o \
ASM_OBJS = have_mmx.o \
scale_line_22_yuv_mmx.o
-CFLAGS += `pkg-config gdk-pixbuf-2.0 --cflags` `pkg-config pangoft2 --cflags` -I../..
+CFLAGS += `pkg-config gtk+-2.0 --cflags` `pkg-config gdk-pixbuf-2.0 --cflags` `pkg-config pangoft2 --cflags` -I../..
-LDFLAGS += `pkg-config gdk-pixbuf-2.0 --libs` `pkg-config pangoft2 --libs`
+LDFLAGS += `pkg-config gtk+-2.0 --libs` `pkg-config gdk-pixbuf-2.0 --libs` `pkg-config pangoft2 --libs`
LDFLAGS+=-L../../framework -lmlt
gtkrescale libmltgtk2.so
EOF
+cat << EOF >> ../consumers.dat
+gtk2_preview libmltgtk2.so
+EOF
+
fi
--- /dev/null
+/*
+ * consumer_gtk2.c -- A consumer for GTK2 apps
+ * Copyright (C) 2003-2004 Ushodaya Enterprises Limited
+ * Author: Charles Yates
+ *
+ * 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 "consumer_gtk2.h"
+
+#include <stdlib.h>
+#include <framework/mlt_consumer.h>
+#include <framework/mlt_factory.h>
+#include <gdk/gdk.h>
+#include <gdk/gdkx.h>
+
+mlt_consumer consumer_gtk2_preview_init( GtkWidget *widget )
+{
+ // Create an sdl preview consumer
+ mlt_consumer consumer = NULL;
+
+ // This is a nasty little hack which is required by SDL
+ if ( widget != NULL )
+ {
+ Window xwin = GDK_WINDOW_XWINDOW( widget->window );
+ char windowhack[ 32 ];
+ sprintf( windowhack, "%ld", xwin );
+ setenv( "SDL_WINDOWID", windowhack, 1 );
+ }
+
+ // Create an sdl preview consumer
+ consumer = mlt_factory_consumer( "sdl_preview", NULL );
+
+ // Now assign the lock/unlock callbacks
+ if ( consumer != NULL )
+ {
+ mlt_properties properties = mlt_consumer_properties( consumer );
+ mlt_properties_set_data( properties, "app_lock", gdk_threads_enter, 0, NULL, NULL );
+ mlt_properties_set_data( properties, "app_unlock", gdk_threads_leave, 0, NULL, NULL );
+ }
+
+ return consumer;
+}
--- /dev/null
+/*
+ * consumer_gtk2.h -- A consumer for GTK2 apps
+ * Copyright (C) 2003-2004 Ushodaya Enterprises Limited
+ * Author: Charles Yates
+ *
+ * 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 _CONSUMER_GTK2_PREVIEW_H
+#define _CONSUMER_GTK2_PREVIEW_H
+
+#include <framework/mlt_consumer.h>
+#include <gtk/gtk.h>
+
+extern mlt_consumer consumer_gtk2_preview_init( GtkWidget *widget );
+
+#endif
#include <string.h>
#include <gdk-pixbuf/gdk-pixbuf.h>
+#include "consumer_gtk2.h"
#include "producer_pixbuf.h"
#include "producer_pango.h"
#include "filter_rescale.h"
void *mlt_create_consumer( char *id, void *arg )
{
+ g_type_init( );
+ if ( !strcmp( id, "gtk2_preview" ) )
+ return consumer_gtk2_preview_init( arg );
return NULL;
}
changed = 1;
}
- if ( this->sdl_screen == NULL || changed )
+ if ( this->running && ( this->sdl_screen == NULL || changed ) )
{
// Determine frame's display aspect ratio
float frame_aspect = mlt_frame_get_aspect_ratio( frame ) * this->width / this->height;
// Determine window's new display aspect ratio
float this_aspect = ( float )this->window_width / this->window_height;
+ // Force an overlay recreation
+ if ( this->sdl_overlay != NULL )
+ SDL_FreeYUVOverlay( this->sdl_overlay );
+
+ // open SDL window with video overlay, if possible
+ sdl_lock_display();
+ this->sdl_screen = SDL_SetVideoMode( this->window_width, this->window_height, 0, this->sdl_flags );
+ sdl_unlock_display();
+ if ( consumer_get_dimensions( &this->window_width, &this->window_height ) )
+ this->sdl_screen = SDL_SetVideoMode( this->window_width, this->window_height, 0, this->sdl_flags );
+ SDL_Flip( this->sdl_screen );
+ mlt_properties_set_int( properties, "changed", 0 );
+
// If using hardware scaler
if ( mlt_properties_get( properties, "rescale" ) != NULL &&
!strcmp( mlt_properties_get( properties, "rescale" ), "none" ) )
mlt_properties_set_int( this->properties, "rect_w", this->rect.w );
mlt_properties_set_int( this->properties, "rect_h", this->rect.h );
- // Force an overlay recreation
- if ( this->sdl_overlay != NULL )
- SDL_FreeYUVOverlay( this->sdl_overlay );
-
- // open SDL window with video overlay, if possible
- sdl_lock_display();
- this->sdl_screen = SDL_SetVideoMode( this->window_width, this->window_height, 0, this->sdl_flags );
- sdl_unlock_display();
- if ( consumer_get_dimensions( &this->window_width, &this->window_height ) )
- this->sdl_screen = SDL_SetVideoMode( this->window_width, this->window_height, 0, this->sdl_flags );
- SDL_Flip( this->sdl_screen );
- mlt_properties_set_int( properties, "changed", 0 );
-
if ( this->sdl_screen != NULL )
{
SDL_SetClipRect( this->sdl_screen, &this->rect );
sdl_lock_display();
this->sdl_screen = SDL_SetVideoMode( this->window_width, this->window_height, 0, this->sdl_flags );
SDL_SetClipRect( this->sdl_screen, &this->rect );
+ SDL_Flip( this->sdl_screen );
sdl_unlock_display();
mlt_properties_set_int( properties, "changed", 0 );
}
{
if ( SDL_GetVideoSurface( ) != NULL )
consumer_get_dimensions( &this->window_width, &this->window_height );
- mlt_properties_set_int( mlt_consumer_properties( consumer ), "changed", 1 );
}
SDL_InitSubSystem( SDL_INIT_AUDIO );
this->joined = 1;
mlt_events_listen( mlt_consumer_properties( this->play ), this, "consumer-frame-show", ( mlt_listener )consumer_frame_show_cb );
mlt_events_listen( mlt_consumer_properties( this->still ), this, "consumer-frame-show", ( mlt_listener )consumer_frame_show_cb );
+ mlt_events_listen( mlt_consumer_properties( this->play ), this, "consumer-sdl-event", ( mlt_listener )consumer_sdl_event_cb );
+ mlt_events_listen( mlt_consumer_properties( this->still ), this, "consumer-sdl-event", ( mlt_listener )consumer_sdl_event_cb );
return parent;
}
free( this );
// Determine which speed to use
double use_speed = first ? speed : this->last_speed;
- // Get changed requests to the preview
+ // Get changed requests to the preview (focus changes)
int changed = mlt_properties_get_int( properties, "changed" );
+
+ // Get refresh request for the current frame (effect changes in still mode)
+ int refresh = mlt_properties_get_int( properties, "refresh" );
+
+ // Decrement refresh and clear changed
+ mlt_properties_set_int( properties, "refresh", refresh > 0 ? refresh - 1 : 0 );
mlt_properties_set_int( properties, "changed", 0 );
+ // Set the changed property on this frame for the benefit of still
+ mlt_properties_set_int( mlt_frame_properties( frame ), "refresh", refresh );
+
// Make sure the recipient knows that this frame isn't really rendered
mlt_properties_set_int( mlt_frame_properties( frame ), "rendered", 0 );
+ // If we're not the first frame and both consumers are stopped, then stop ourselves
if ( !first && mlt_consumer_is_stopped( this->play ) && mlt_consumer_is_stopped( this->still ) )
{
this->running = 0;
mlt_frame_close( frame );
}
+ // Allow a little grace time before switching consumers on speed changes
else if ( this->ignore_change -- > 0 && this->active != NULL && !mlt_consumer_is_stopped( this->active ) )
{
mlt_consumer_put_frame( this->active, frame );
- if ( this->active == this->still )
- mlt_properties_set_int( still, "changed", changed );
+ mlt_properties_set_int( still, "changed", changed );
}
+ // If we aren't playing normally, then use the still
else if ( use_speed != 1 )
{
if ( !mlt_consumer_is_stopped( this->play ) )
- {
mlt_consumer_stop( this->play );
- }
if ( mlt_consumer_is_stopped( this->still ) )
{
this->last_speed = use_speed;
mlt_properties_set_int( still, "changed", changed );
mlt_consumer_put_frame( this->still, frame );
}
+ // Otherwise use the normal player
else
{
if ( !mlt_consumer_is_stopped( this->still ) )
- {
mlt_consumer_stop( this->still );
- }
if ( mlt_consumer_is_stopped( this->play ) )
{
this->last_speed = use_speed;
this->ignore_change = 25;
mlt_consumer_start( this->play );
}
+ mlt_properties_set_int( still, "changed", changed );
mlt_consumer_put_frame( this->play, frame );
}
+
+ // Copy the rectangle info from the active consumer
+ if ( this->running )
+ {
+ mlt_properties active = mlt_consumer_properties( this->active );
+ mlt_properties_set_int( properties, "rect_x", mlt_properties_get_int( active, "rect_x" ) );
+ mlt_properties_set_int( properties, "rect_y", mlt_properties_get_int( active, "rect_y" ) );
+ mlt_properties_set_int( properties, "rect_w", mlt_properties_get_int( active, "rect_w" ) );
+ mlt_properties_set_int( properties, "rect_h", mlt_properties_get_int( active, "rect_h" ) );
+ }
+
+ // We are definitely not waiting on the first frame any more
first = 0;
}
}
{
// open SDL window
this->sdl_screen = SDL_SetVideoMode( this->window_width, this->window_height, 16, this->sdl_flags );
- consumer_get_dimensions( &this->window_width, &this->window_height );
+ if ( consumer_get_dimensions( &this->window_width, &this->window_height ) )
+ this->sdl_screen = SDL_SetVideoMode( this->window_width, this->window_height, 16, this->sdl_flags );
changed = 1;
mlt_properties_set_int( properties, "changed", 0 );
}
else
{
- changed = mlt_properties_get_int( properties, "changed" );
+ changed = mlt_properties_get_int( properties, "changed" ) | mlt_properties_get_int( mlt_frame_properties( frame ), "refresh" );
mlt_properties_set_int( properties, "changed", 0 );
}
struct _xmlParserCtxt *xmlcontext;
int well_formed = 0;
char *filename = NULL;
-
+
context->producer_map = mlt_properties_new();
context->destructors = mlt_properties_new();
context->params = mlt_properties_new();
#!/bin/sh
-echo "valerie -I$prefix/include/mlt -D_REENTRANT -lvalerie" >> ../../packages.dat
+echo "valerie -I$prefix/include/mlt -D_REENTRANT -L$prefix/lib -lvalerie" >> ../../packages.dat