From: lilo_booter Date: Sun, 24 Oct 2004 14:18:29 +0000 (+0000) Subject: Minor config fixes and gtk2 consumer added X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=c919073e754576f5fd705d912b0f54e7c0f26267;p=mlt Minor config fixes and gtk2 consumer added git-svn-id: https://mlt.svn.sourceforge.net/svnroot/mlt/trunk/mlt@488 d19143bc-622f-0410-bfdd-b5b2a6649095 --- diff --git a/mlt-config-template b/mlt-config-template index ec0db9f8..5559bf73 100644 --- a/mlt-config-template +++ b/mlt-config-template @@ -6,6 +6,7 @@ do case $1 in --help ) field=0 ;; --version ) field=-1 ;; + --prefix ) field=-2 ;; --prefix=* ) prefix="${i#--prefix=}" ;; --cflags ) field=2 ;; --libs ) field=3 ;; @@ -19,6 +20,11 @@ if [ "$field" = "0" ] 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. diff --git a/src/framework/configure b/src/framework/configure index 3a765aad..569f86bb 100755 --- a/src/framework/configure +++ b/src/framework/configure @@ -1,2 +1,2 @@ #!/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 diff --git a/src/miracle/configure b/src/miracle/configure index f845807c..9c8f962f 100755 --- a/src/miracle/configure +++ b/src/miracle/configure @@ -1,2 +1,2 @@ #!/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 diff --git a/src/modules/gtk2/Makefile b/src/modules/gtk2/Makefile index 32d3eda0..3edd9389 100644 --- a/src/modules/gtk2/Makefile +++ b/src/modules/gtk2/Makefile @@ -3,6 +3,7 @@ include ../../../config.mak TARGET = ../libmltgtk2.so OBJS = factory.o \ + consumer_gtk2.o \ producer_pixbuf.o \ producer_pango.o \ pixops.o \ @@ -11,9 +12,9 @@ OBJS = factory.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 diff --git a/src/modules/gtk2/configure b/src/modules/gtk2/configure index 8979d129..58000a96 100755 --- a/src/modules/gtk2/configure +++ b/src/modules/gtk2/configure @@ -12,5 +12,9 @@ cat << EOF >> ../filters.dat gtkrescale libmltgtk2.so EOF +cat << EOF >> ../consumers.dat +gtk2_preview libmltgtk2.so +EOF + fi diff --git a/src/modules/gtk2/consumer_gtk2.c b/src/modules/gtk2/consumer_gtk2.c new file mode 100644 index 00000000..4da317ca --- /dev/null +++ b/src/modules/gtk2/consumer_gtk2.c @@ -0,0 +1,55 @@ +/* + * 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 +#include +#include +#include +#include + +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; +} diff --git a/src/modules/gtk2/consumer_gtk2.h b/src/modules/gtk2/consumer_gtk2.h new file mode 100644 index 00000000..84b3e32b --- /dev/null +++ b/src/modules/gtk2/consumer_gtk2.h @@ -0,0 +1,29 @@ +/* + * 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 +#include + +extern mlt_consumer consumer_gtk2_preview_init( GtkWidget *widget ); + +#endif diff --git a/src/modules/gtk2/factory.c b/src/modules/gtk2/factory.c index 82ed3d42..b7cca9b3 100644 --- a/src/modules/gtk2/factory.c +++ b/src/modules/gtk2/factory.c @@ -20,6 +20,7 @@ #include #include +#include "consumer_gtk2.h" #include "producer_pixbuf.h" #include "producer_pango.h" #include "filter_rescale.h" @@ -49,6 +50,9 @@ void *mlt_create_transition( char *id, void *arg ) void *mlt_create_consumer( char *id, void *arg ) { + g_type_init( ); + if ( !strcmp( id, "gtk2_preview" ) ) + return consumer_gtk2_preview_init( arg ); return NULL; } diff --git a/src/modules/sdl/consumer_sdl.c b/src/modules/sdl/consumer_sdl.c index 6e8e12d8..58741522 100644 --- a/src/modules/sdl/consumer_sdl.c +++ b/src/modules/sdl/consumer_sdl.c @@ -428,7 +428,7 @@ static int consumer_play_video( consumer_sdl this, mlt_frame frame ) 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; @@ -436,6 +436,19 @@ static int consumer_play_video( consumer_sdl this, mlt_frame frame ) // 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" ) ) @@ -487,19 +500,6 @@ static int consumer_play_video( consumer_sdl this, mlt_frame frame ) 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 ); @@ -514,6 +514,7 @@ static int consumer_play_video( consumer_sdl this, mlt_frame frame ) 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 ); } @@ -655,7 +656,6 @@ static void *consumer_thread( void *arg ) { 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 ); diff --git a/src/modules/sdl/consumer_sdl_preview.c b/src/modules/sdl/consumer_sdl_preview.c index 1bcd173f..ddb3ddf7 100644 --- a/src/modules/sdl/consumer_sdl_preview.c +++ b/src/modules/sdl/consumer_sdl_preview.c @@ -71,6 +71,8 @@ mlt_consumer consumer_sdl_preview_init( char *arg ) 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 ); @@ -204,30 +206,39 @@ static void *consumer_thread( void *arg ) // 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; @@ -238,12 +249,11 @@ static void *consumer_thread( void *arg ) 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; @@ -251,8 +261,21 @@ static void *consumer_thread( void *arg ) 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; } } diff --git a/src/modules/sdl/consumer_sdl_still.c b/src/modules/sdl/consumer_sdl_still.c index d37255ab..dc0c79e6 100644 --- a/src/modules/sdl/consumer_sdl_still.c +++ b/src/modules/sdl/consumer_sdl_still.c @@ -291,7 +291,8 @@ static int consumer_play_video( consumer_sdl this, mlt_frame frame ) { // 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 ); @@ -354,7 +355,7 @@ static int consumer_play_video( consumer_sdl this, mlt_frame frame ) } 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 ); } diff --git a/src/modules/westley/producer_westley.c b/src/modules/westley/producer_westley.c index 1d427543..eb022cdf 100644 --- a/src/modules/westley/producer_westley.c +++ b/src/modules/westley/producer_westley.c @@ -1269,7 +1269,7 @@ mlt_producer producer_westley_init( int info, char *data ) 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(); diff --git a/src/valerie/configure b/src/valerie/configure index 87c33640..a921d4f1 100755 --- a/src/valerie/configure +++ b/src/valerie/configure @@ -1,2 +1,2 @@ #!/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