X-Git-Url: http://research.m1stereo.tv/gitweb?a=blobdiff_plain;f=src%2Fmodules%2Fsdl%2Fconsumer_sdl_still.c;h=942726c1c6a9ef2a2ce9d65ce879697b94f8220c;hb=7ecd47eeebf87332a4892d167baff959f0f6a11a;hp=acb50982e4710081ceb47179bcefd87dc5234b2e;hpb=3719f0ab8e239e0ddb38eb758bb745d11880787d;p=melted diff --git a/src/modules/sdl/consumer_sdl_still.c b/src/modules/sdl/consumer_sdl_still.c index acb5098..942726c 100644 --- a/src/modules/sdl/consumer_sdl_still.c +++ b/src/modules/sdl/consumer_sdl_still.c @@ -3,22 +3,22 @@ * 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 library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. * - * This program is distributed in the hope that it will be useful, + * This library 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. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser 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. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "consumer_sdl.h" +#include #include #include #include @@ -72,13 +72,13 @@ static void consumer_sdl_event( mlt_listener listener, mlt_properties owner, mlt via the argument, but keep it simple. */ -mlt_consumer consumer_sdl_still_init( char *arg ) +mlt_consumer consumer_sdl_still_init( mlt_profile profile, mlt_service_type type, const char *id, char *arg ) { // Create the consumer object consumer_sdl this = calloc( sizeof( struct consumer_sdl_s ), 1 ); // If no malloc'd and consumer init ok - if ( this != NULL && mlt_consumer_init( &this->parent, this ) == 0 ) + if ( this != NULL && mlt_consumer_init( &this->parent, this, profile ) == 0 ) { // Get the parent consumer object mlt_consumer parent = &this->parent; @@ -87,9 +87,6 @@ mlt_consumer consumer_sdl_still_init( char *arg ) mlt_service service = MLT_CONSUMER_SERVICE( parent ); this->properties = MLT_SERVICE_PROPERTIES( service ); - // Get the default display ratio - double display_ratio = mlt_properties_get_double( this->properties, "display_ratio" ); - // We have stuff to clean up, so override the close method parent->close = consumer_close; @@ -117,10 +114,6 @@ mlt_consumer consumer_sdl_still_init( char *arg ) mlt_properties_set_int( this->properties, "height", this->height ); } - // Default window size - this->window_width = ( double )this->height * display_ratio; - this->window_height = this->height; - // Set the sdl flags this->sdl_flags = SDL_HWSURFACE | SDL_ASYNCBLIT | SDL_HWACCEL | SDL_RESIZABLE | SDL_DOUBLEBUF; @@ -161,7 +154,8 @@ static int consumer_start( mlt_consumer parent ) // Attach a colour space converter if ( !this->filtered ) { - mlt_filter filter = mlt_factory_filter( "avcolour_space", NULL ); + mlt_profile profile = mlt_service_profile( MLT_CONSUMER_SERVICE( parent ) ); + mlt_filter filter = mlt_factory_filter( profile, "avcolour_space", NULL ); mlt_properties_set_int( MLT_FILTER_PROPERTIES( filter ), "forced", mlt_image_yuv422 ); mlt_service_attach( MLT_CONSUMER_SERVICE( parent ), filter ); mlt_filter_close( filter ); @@ -178,6 +172,11 @@ static int consumer_start( mlt_consumer parent ) this->width = mlt_properties_get_int( this->properties, "width" ); this->height = mlt_properties_get_int( this->properties, "height" ); + // Default window size + double display_ratio = mlt_properties_get_double( this->properties, "display_ratio" ); + this->window_width = ( double )this->height * display_ratio; + this->window_height = this->height; + if ( sdl_started == 0 && preview_off == 0 ) { if ( SDL_Init( SDL_INIT_VIDEO | SDL_INIT_NOPARACHUTE ) < 0 ) @@ -194,7 +193,6 @@ static int consumer_start( mlt_consumer parent ) if ( SDL_GetVideoSurface( ) != NULL ) { this->sdl_screen = SDL_GetVideoSurface( ); - consumer_get_dimensions( &this->window_width, &this->window_height ); } }