]> git.sesse.net Git - mlt/commitdiff
Added new profiles system: mlt_profile, MLT_PROFILE, and profiles documents.
authorddennedy <ddennedy@d19143bc-622f-0410-bfdd-b5b2a6649095>
Sun, 15 Jul 2007 01:19:30 +0000 (01:19 +0000)
committerddennedy <ddennedy@d19143bc-622f-0410-bfdd-b5b2a6649095>
Sun, 15 Jul 2007 01:19:30 +0000 (01:19 +0000)
git-svn-id: https://mlt.svn.sourceforge.net/svnroot/mlt/trunk/mlt@1008 d19143bc-622f-0410-bfdd-b5b2a6649095

46 files changed:
ChangeLog
Makefile
configure
profiles/Makefile [new file with mode: 0644]
profiles/atsc_wide_1080i [new file with mode: 0644]
profiles/atsc_wide_720p [new file with mode: 0644]
profiles/cif_ntsc [new file with mode: 0644]
profiles/cif_pal [new file with mode: 0644]
profiles/cvd_ntsc [new file with mode: 0644]
profiles/cvd_pal [new file with mode: 0644]
profiles/dv_ntsc [new file with mode: 0644]
profiles/dv_ntsc_wide [new file with mode: 0644]
profiles/dv_pal [new file with mode: 0644]
profiles/dv_pal_wide [new file with mode: 0644]
profiles/hdv_1080_ntsc [new file with mode: 0644]
profiles/hdv_1080_pal [new file with mode: 0644]
profiles/hdv_720_ntsc [new file with mode: 0644]
profiles/hdv_720_pal [new file with mode: 0644]
profiles/qcif_ntsc [new file with mode: 0644]
profiles/qcif_pal [new file with mode: 0644]
profiles/quarter_ntsc [new file with mode: 0644]
profiles/quarter_ntsc_wide [new file with mode: 0644]
profiles/quarter_pal [new file with mode: 0644]
profiles/quarter_pal_wide [new file with mode: 0644]
profiles/square_ntsc [new file with mode: 0644]
profiles/square_ntsc_wide [new file with mode: 0644]
profiles/square_pal [new file with mode: 0644]
profiles/square_pal_wide [new file with mode: 0644]
profiles/svcd_ntsc [new file with mode: 0644]
profiles/svcd_ntsc_wide [new file with mode: 0644]
profiles/svcd_pal [new file with mode: 0644]
profiles/svcd_pal_wide [new file with mode: 0644]
profiles/vcd_ntsc [new file with mode: 0644]
profiles/vcd_pal [new file with mode: 0644]
src/framework/Makefile
src/framework/mlt.h
src/framework/mlt_consumer.c
src/framework/mlt_factory.c
src/framework/mlt_frame.c
src/framework/mlt_geometry.c
src/framework/mlt_producer.c
src/framework/mlt_profile.c [new file with mode: 0644]
src/framework/mlt_profile.h [new file with mode: 0644]
src/framework/mlt_types.h
src/modules/dv/consumer_libdv.c
src/modules/sdl/consumer_sdl.c

index 9a74663a409222f5e1d299351e632625462cf2f6..6aff12f2c448bc3bc666af48a4147061d30258f9 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,7 @@
 $Id$
 
+USING svn log NOW
+
 2007-04-09 Dan Dennedy <dan@dennedy.org>
        Cleanup copyrights and attributions, and move Jean-Baptiste's services
        to a new kdenlive module.
index 2c4766e02161bb917aaa82f9609247bece2e4c94..5d127b438f6371ac805eb34d43f7e3097eb9457d 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -4,7 +4,8 @@ SUBDIRS = src/framework \
                  src/miracle \
                  src/humperdink \
                  src/albino \
-                 src/modules
+                 src/modules \
+                 profiles
 
 all clean:
        list='$(SUBDIRS)'; \
@@ -55,4 +56,5 @@ uninstall:
 dist:
        [ -d "mlt-$(version)" ] && rm -rf "mlt-$(version)" || echo
        svn export . "mlt-$(version)"
+       svn log > "mlt-$(version)/ChangeLog"
        tar -cvzf "mlt-$(version).tar.gz" "mlt-$(version)"
index 66189a91ea2444a9b38b777c6afc5991109e21d8..fe1423d7768e650c7dade7b238a48b3d1d80db5c 100755 (executable)
--- a/configure
+++ b/configure
@@ -113,7 +113,7 @@ export build_dir=`dirname $0`
 export prefix=/usr/local
 export libdir=""
 export help=0
-export version=0.2.3
+export version=0.2.4
 export debug=true
 export mmx=true
 export gpl=false
diff --git a/profiles/Makefile b/profiles/Makefile
new file mode 100644 (file)
index 0000000..6dee650
--- /dev/null
@@ -0,0 +1,14 @@
+include ../config.mak
+
+all:
+
+depend:
+
+distclean:
+
+clean:
+
+install:       all
+       install -d $(DESTDIR)$(prefix)/share/mlt/profiles
+       install -m 644 * $(DESTDIR)$(prefix)/share/mlt/profiles
+       rm -f $(DESTDIR)$(prefix)/share/mlt/profiles/{*~,Makefile}
diff --git a/profiles/atsc_wide_1080i b/profiles/atsc_wide_1080i
new file mode 100644 (file)
index 0000000..889379b
--- /dev/null
@@ -0,0 +1,10 @@
+name=ATSC Widescreen 1080i
+frame_rate_num=30000
+frame_rate_den=1001
+width=1920
+height=1080
+progressive=0
+sample_aspect_num=1
+sample_aspect_den=1
+display_aspect_num=16
+display_aspect_den=9
diff --git a/profiles/atsc_wide_720p b/profiles/atsc_wide_720p
new file mode 100644 (file)
index 0000000..5558016
--- /dev/null
@@ -0,0 +1,10 @@
+name=ATSC Widescreen 720p
+frame_rate_num=30000
+frame_rate_den=1001
+width=1280
+height=720
+progressive=1
+sample_aspect_num=1
+sample_aspect_den=1
+display_aspect_num=16
+display_aspect_den=9
diff --git a/profiles/cif_ntsc b/profiles/cif_ntsc
new file mode 100644 (file)
index 0000000..f4e8491
--- /dev/null
@@ -0,0 +1,10 @@
+name=CIF NTSC
+frame_rate_num=30000
+frame_rate_den=1001
+width=352
+height=288
+progressive=1
+sample_aspect_num=10
+sample_aspect_den=11
+display_aspect_num=4
+display_aspect_den=3
diff --git a/profiles/cif_pal b/profiles/cif_pal
new file mode 100644 (file)
index 0000000..dafa242
--- /dev/null
@@ -0,0 +1,10 @@
+name=CIF PAL
+frame_rate_num=25
+frame_rate_den=1
+width=352
+height=288
+progressive=1
+sample_aspect_num=59
+sample_aspect_den=54
+display_aspect_num=4
+display_aspect_den=3
diff --git a/profiles/cvd_ntsc b/profiles/cvd_ntsc
new file mode 100644 (file)
index 0000000..af844c4
--- /dev/null
@@ -0,0 +1,10 @@
+name=CVD NTSC
+frame_rate_num=30000
+frame_rate_den=1001
+width=352
+height=480
+progressive=0
+sample_aspect_num=20
+sample_aspect_den=11
+display_aspect_num=4
+display_aspect_den=3
diff --git a/profiles/cvd_pal b/profiles/cvd_pal
new file mode 100644 (file)
index 0000000..44cd5bc
--- /dev/null
@@ -0,0 +1,10 @@
+name=CVD PAL
+frame_rate_num=25
+frame_rate_den=1
+width=352
+height=576
+progressive=0
+sample_aspect_num=59
+sample_aspect_den=27
+display_aspect_num=4
+display_aspect_den=3
diff --git a/profiles/dv_ntsc b/profiles/dv_ntsc
new file mode 100644 (file)
index 0000000..68cf870
--- /dev/null
@@ -0,0 +1,10 @@
+name=DV NTSC
+frame_rate_num=30000
+frame_rate_den=1001
+width=720
+height=480
+progressive=0
+sample_aspect_num=10
+sample_aspect_den=11
+display_aspect_num=4
+display_aspect_den=3
diff --git a/profiles/dv_ntsc_wide b/profiles/dv_ntsc_wide
new file mode 100644 (file)
index 0000000..cc6879f
--- /dev/null
@@ -0,0 +1,10 @@
+name=DV NTSC Widescreen
+frame_rate_num=30000
+frame_rate_den=1001
+width=720
+height=480
+progressive=0
+sample_aspect_num=40
+sample_aspect_den=33
+display_aspect_num=16
+display_aspect_den=9
diff --git a/profiles/dv_pal b/profiles/dv_pal
new file mode 100644 (file)
index 0000000..32f72c3
--- /dev/null
@@ -0,0 +1,10 @@
+name=DV PAL
+frame_rate_num=25
+frame_rate_den=1
+width=720
+height=576
+progressive=0
+sample_aspect_num=59
+sample_aspect_den=54
+display_aspect_num=4
+display_aspect_den=3
diff --git a/profiles/dv_pal_wide b/profiles/dv_pal_wide
new file mode 100644 (file)
index 0000000..313f12e
--- /dev/null
@@ -0,0 +1,10 @@
+name=DV PAL Widescreen
+frame_rate_num=25
+frame_rate_den=1
+width=720
+height=576
+progressive=0
+sample_aspect_num=118
+sample_aspect_den=81
+display_aspect_num=16
+display_aspect_den=9
diff --git a/profiles/hdv_1080_ntsc b/profiles/hdv_1080_ntsc
new file mode 100644 (file)
index 0000000..61e409b
--- /dev/null
@@ -0,0 +1,10 @@
+name=HDV 1080i NTSC
+frame_rate_num=30000
+frame_rate_den=1001
+width=1440
+height=1080
+progressive=0
+sample_aspect_num=4
+sample_aspect_den=3
+display_aspect_num=16
+display_aspect_den=9
diff --git a/profiles/hdv_1080_pal b/profiles/hdv_1080_pal
new file mode 100644 (file)
index 0000000..8ecbacd
--- /dev/null
@@ -0,0 +1,10 @@
+name=HDV 1080i PAL
+frame_rate_num=25
+frame_rate_den=1
+width=1440
+height=1080
+progressive=0
+sample_aspect_num=4
+sample_aspect_den=3
+display_aspect_num=16
+display_aspect_den=9
diff --git a/profiles/hdv_720_ntsc b/profiles/hdv_720_ntsc
new file mode 100644 (file)
index 0000000..08e17c0
--- /dev/null
@@ -0,0 +1,10 @@
+name=HDV 720p NTSC
+frame_rate_num=30000
+frame_rate_den=1001
+width=1280
+height=720
+progressive=1
+sample_aspect_num=1
+sample_aspect_den=1
+display_aspect_num=16
+display_aspect_den=9
diff --git a/profiles/hdv_720_pal b/profiles/hdv_720_pal
new file mode 100644 (file)
index 0000000..c1908b5
--- /dev/null
@@ -0,0 +1,10 @@
+name=HDV 720p PAL
+frame_rate_num=25
+frame_rate_den=1
+width=1280
+height=720
+progressive=1
+sample_aspect_num=1
+sample_aspect_den=1
+display_aspect_num=16
+display_aspect_den=9
diff --git a/profiles/qcif_ntsc b/profiles/qcif_ntsc
new file mode 100644 (file)
index 0000000..59bd4ff
--- /dev/null
@@ -0,0 +1,10 @@
+name=QCIF NTSC
+frame_rate_num=30000
+frame_rate_den=1001
+width=176
+height=144
+progressive=1
+sample_aspect_num=10
+sample_aspect_den=11
+display_aspect_num=4
+display_aspect_den=3
diff --git a/profiles/qcif_pal b/profiles/qcif_pal
new file mode 100644 (file)
index 0000000..c96f62f
--- /dev/null
@@ -0,0 +1,10 @@
+name=QCIF PAL
+frame_rate_num=25
+frame_rate_den=1
+width=176
+height=144
+progressive=1
+sample_aspect_num=59
+sample_aspect_den=54
+display_aspect_num=4
+display_aspect_den=3
diff --git a/profiles/quarter_ntsc b/profiles/quarter_ntsc
new file mode 100644 (file)
index 0000000..240a814
--- /dev/null
@@ -0,0 +1,10 @@
+name=Quarter Square NTSC
+frame_rate_num=30000
+frame_rate_den=1001
+width=320
+height=240
+progressive=1
+sample_aspect_num=1
+sample_aspect_den=1
+display_aspect_num=4
+display_aspect_den=3
diff --git a/profiles/quarter_ntsc_wide b/profiles/quarter_ntsc_wide
new file mode 100644 (file)
index 0000000..bc1cf7d
--- /dev/null
@@ -0,0 +1,10 @@
+name=Quarter Square NTSC Widescreen
+frame_rate_num=30000
+frame_rate_den=1001
+width=426
+height=240
+progressive=1
+sample_aspect_num=1
+sample_aspect_den=1
+display_aspect_num=16
+display_aspect_den=9
diff --git a/profiles/quarter_pal b/profiles/quarter_pal
new file mode 100644 (file)
index 0000000..fd64d66
--- /dev/null
@@ -0,0 +1,10 @@
+name=Quarter Square PAL
+frame_rate_num=25
+frame_rate_den=1
+width=384
+height=288
+progressive=1
+sample_aspect_num=1
+sample_aspect_den=1
+display_aspect_num=4
+display_aspect_den=3
diff --git a/profiles/quarter_pal_wide b/profiles/quarter_pal_wide
new file mode 100644 (file)
index 0000000..324a11d
--- /dev/null
@@ -0,0 +1,10 @@
+name=Quarter Square PAL Widescreen
+frame_rate_num=25
+frame_rate_den=1
+width=512
+height=288
+progressive=1
+sample_aspect_num=1
+sample_aspect_den=1
+display_aspect_num=16
+display_aspect_den=9
diff --git a/profiles/square_ntsc b/profiles/square_ntsc
new file mode 100644 (file)
index 0000000..f668b82
--- /dev/null
@@ -0,0 +1,10 @@
+name=Square NTSC
+frame_rate_num=30000
+frame_rate_den=1001
+width=640
+height=480
+progressive=1
+sample_aspect_num=1
+sample_aspect_den=1
+display_aspect_num=4
+display_aspect_den=3
diff --git a/profiles/square_ntsc_wide b/profiles/square_ntsc_wide
new file mode 100644 (file)
index 0000000..86addae
--- /dev/null
@@ -0,0 +1,10 @@
+name=Square NTSC Widescreen
+frame_rate_num=30000
+frame_rate_den=1001
+width=854
+height=480
+progressive=1
+sample_aspect_num=1
+sample_aspect_den=1
+display_aspect_num=16
+display_aspect_den=9
diff --git a/profiles/square_pal b/profiles/square_pal
new file mode 100644 (file)
index 0000000..4ece39b
--- /dev/null
@@ -0,0 +1,10 @@
+name=Square PAL
+frame_rate_num=25
+frame_rate_den=1
+width=768
+height=576
+progressive=1
+sample_aspect_num=1
+sample_aspect_den=1
+display_aspect_num=4
+display_aspect_den=3
diff --git a/profiles/square_pal_wide b/profiles/square_pal_wide
new file mode 100644 (file)
index 0000000..0dd9411
--- /dev/null
@@ -0,0 +1,10 @@
+name=Square PAL Widescreen
+frame_rate_num=25
+frame_rate_den=1
+width=1024
+height=576
+progressive=1
+sample_aspect_num=1
+sample_aspect_den=1
+display_aspect_num=4
+display_aspect_den=3
diff --git a/profiles/svcd_ntsc b/profiles/svcd_ntsc
new file mode 100644 (file)
index 0000000..828cccd
--- /dev/null
@@ -0,0 +1,10 @@
+name=SVCD NTSC
+frame_rate_num=30000
+frame_rate_den=1001
+width=480
+height=480
+progressive=0
+sample_aspect_num=15
+sample_aspect_den=11
+display_aspect_num=4
+display_aspect_den=3
diff --git a/profiles/svcd_ntsc_wide b/profiles/svcd_ntsc_wide
new file mode 100644 (file)
index 0000000..42f04fc
--- /dev/null
@@ -0,0 +1,10 @@
+name=SVCD NTSC Widescreen
+frame_rate_num=30000
+frame_rate_den=1001
+width=480
+height=480
+progressive=0
+sample_aspect_num=20
+sample_aspect_den=11
+display_aspect_num=16
+display_aspect_den=9
diff --git a/profiles/svcd_pal b/profiles/svcd_pal
new file mode 100644 (file)
index 0000000..3c41a68
--- /dev/null
@@ -0,0 +1,10 @@
+name=SVCD PAL
+frame_rate_num=25
+frame_rate_den=1
+width=480
+height=576
+progressive=0
+sample_aspect_num=59
+sample_aspect_den=36
+display_aspect_num=4
+display_aspect_den=3
diff --git a/profiles/svcd_pal_wide b/profiles/svcd_pal_wide
new file mode 100644 (file)
index 0000000..e634a4a
--- /dev/null
@@ -0,0 +1,10 @@
+name=SVCD PAL Widescreen
+frame_rate_num=25
+frame_rate_den=1
+width=480
+height=576
+progressive=0
+sample_aspect_num=59
+sample_aspect_den=27
+display_aspect_num=4
+display_aspect_den=3
diff --git a/profiles/vcd_ntsc b/profiles/vcd_ntsc
new file mode 100644 (file)
index 0000000..ae70cad
--- /dev/null
@@ -0,0 +1,10 @@
+name=VCD NTSC
+frame_rate_num=30000
+frame_rate_den=1001
+width=352
+height=240
+progressive=1
+sample_aspect_num=10
+sample_aspect_den=11
+display_aspect_num=4
+display_aspect_den=3
diff --git a/profiles/vcd_pal b/profiles/vcd_pal
new file mode 100644 (file)
index 0000000..e5db06c
--- /dev/null
@@ -0,0 +1,10 @@
+name=VCD PAL
+frame_rate_num=25
+frame_rate_den=1
+width=352
+height=288
+progressive=1
+sample_aspect_num=59
+sample_aspect_den=54
+display_aspect_num=4
+display_aspect_den=3
index 0ce24391adfa5fc08bb06c7921d586196aeec99a..f5df34ca29a106836ccb280db44c1dd5a20f8227 100644 (file)
@@ -32,7 +32,8 @@ OBJS = mlt_frame.o \
           mlt_factory.o \
           mlt_repository.o \
           mlt_pool.o \
-          mlt_tokeniser.o
+          mlt_tokeniser.o \
+          mlt_profile.o
 
 INCS = mlt_consumer.h \
           mlt_factory.h \
@@ -55,7 +56,8 @@ INCS = mlt_consumer.h \
           mlt_property.h \
           mlt_service.h  \
           mlt_transition.h \
-          mlt_tokeniser.h
+          mlt_tokeniser.h \
+          mlt_profile.h
 
 SRCS := $(OBJS:.o=.c)
 
index 9d3316be8f3e6f85974fbe35469791d1987c83b6..6f974436d9f6a2cba081f5c519fe0a823abca6de 100644 (file)
@@ -41,6 +41,7 @@ extern "C"
 #include "mlt_tokeniser.h"
 #include "mlt_parser.h"
 #include "mlt_geometry.h"
+#include "mlt_profile.h"
 
 #ifdef __cplusplus
 }
index 1aab394c9d6c21bef9ff7754280dfb893d6a0809..f2e653fda4564e25604878826387c32cea4b83ab 100644 (file)
@@ -23,6 +23,8 @@
 #include "mlt_factory.h"
 #include "mlt_producer.h"
 #include "mlt_frame.h"
+#include "mlt_profile.h"
+
 #include <stdio.h>
 #include <string.h>
 #include <stdlib.h>
 
 static void mlt_consumer_frame_render( mlt_listener listener, mlt_properties owner, mlt_service this, void **args );
 static void mlt_consumer_frame_show( mlt_listener listener, mlt_properties owner, mlt_service this, void **args );
+static void mlt_consumer_property_changed( mlt_service owner, mlt_consumer this, char *name );
+static void apply_profile_properties( mlt_profile profile, mlt_properties properties );
+
+static mlt_event g_event_listener = NULL;
 
 /** Public final methods
 */
@@ -44,43 +50,9 @@ int mlt_consumer_init( mlt_consumer this, void *child )
        {
                // Get the properties from the service
                mlt_properties properties = MLT_SERVICE_PROPERTIES( &this->parent );
-
-               // Get the normalisation preference
-               char *normalisation = mlt_environment( "MLT_NORMALISATION" );
-
-               // Deal with normalisation
-               if ( normalisation == NULL || strcmp( normalisation, "NTSC" ) )
-               {
-                       mlt_properties_set( properties, "normalisation", "PAL" );
-                       mlt_properties_set_double( properties, "fps", 25.0 );
-                       mlt_properties_set_int( properties, "frame_rate_num", 25 );
-                       mlt_properties_set_int( properties, "frame_rate_den", 1 );
-                       mlt_properties_set_int( properties, "width", 720 );
-                       mlt_properties_set_int( properties, "height", 576 );
-                       mlt_properties_set_int( properties, "progressive", 0 );
-                       mlt_properties_set_double( properties, "aspect_ratio", 59.0 / 54.0 );
-                       mlt_properties_set_int( properties, "aspect_ratio_num", 59 );
-                       mlt_properties_set_int( properties, "aspect_ratio_den", 54 );
-                       mlt_properties_set_double( properties, "display_ratio", 4.0 / 3.0 );
-                       mlt_properties_set_int( properties, "display_ratio_num", 4 );
-                       mlt_properties_set_int( properties, "display_ratio_den", 3 );
-               }
-               else
-               {
-                       mlt_properties_set( properties, "normalisation", "NTSC" );
-                       mlt_properties_set_double( properties, "fps", 30000.0 / 1001.0 );
-                       mlt_properties_set_int( properties, "frame_rate_num", 30000 );
-                       mlt_properties_set_int( properties, "frame_rate_den", 1001 );
-                       mlt_properties_set_int( properties, "width", 720 );
-                       mlt_properties_set_int( properties, "height", 480 );
-                       mlt_properties_set_int( properties, "progressive", 0 );
-                       mlt_properties_set_double( properties, "aspect_ratio", 10.0 / 11.0 );
-                       mlt_properties_set_int( properties, "aspect_ratio_num", 10 );
-                       mlt_properties_set_int( properties, "aspect_ratio_den", 11 );
-                       mlt_properties_set_double( properties, "display_ratio", 4.0 / 3.0 );
-                       mlt_properties_set_int( properties, "display_ratio_num", 4 );
-                       mlt_properties_set_int( properties, "display_ratio_den", 3 );
-               }
+       
+               // Apply the profile to properties for legacy integration
+               apply_profile_properties( mlt_profile_get(), properties );
 
                // Default rescaler for all consumers
                mlt_properties_set( properties, "rescale", "bilinear" );
@@ -105,6 +77,10 @@ int mlt_consumer_init( mlt_consumer this, void *child )
                mlt_events_register( properties, "consumer-frame-render", ( mlt_transmitter )mlt_consumer_frame_render );
                mlt_events_register( properties, "consumer-stopped", NULL );
 
+               // Register a property-changed listener to handle the profile property -
+               // subsequent properties can override the profile
+               g_event_listener = mlt_events_listen( properties, this, "property-changed", ( mlt_listener )mlt_consumer_property_changed );
+
                // Create the push mutex and condition
                pthread_mutex_init( &this->put_mutex, NULL );
                pthread_cond_init( &this->put_cond, NULL );
@@ -113,6 +89,41 @@ int mlt_consumer_init( mlt_consumer this, void *child )
        return error;
 }
 
+static void apply_profile_properties( mlt_profile profile, mlt_properties properties )
+{
+       mlt_properties_set_double( properties, "fps", mlt_profile_fps( profile ) );
+       mlt_properties_set_int( properties, "frame_rate_num", profile->frame_rate_num );
+       mlt_properties_set_int( properties, "frame_rate_den", profile->frame_rate_den );
+       mlt_properties_set_int( properties, "width", profile->width );
+       mlt_properties_set_int( properties, "height", profile->height );
+       mlt_properties_set_int( properties, "progressive", profile->progressive );
+       mlt_properties_set_double( properties, "aspect_ratio", mlt_profile_sar( profile )  );
+       mlt_properties_set_int( properties, "sample_aspect_num", profile->sample_aspect_num );
+       mlt_properties_set_int( properties, "sample_aspect_den", profile->sample_aspect_den );
+       mlt_properties_set_double( properties, "display_ratio", mlt_profile_dar( profile )  );
+       mlt_properties_set_int( properties, "display_aspect_num", profile->display_aspect_num );
+       mlt_properties_set_int( properties, "display_aspect_num", profile->display_aspect_num );
+}
+
+static void mlt_consumer_property_changed( mlt_service owner, mlt_consumer this, char *name )
+{
+       if ( !strcmp( name, "profile" ) )
+       {
+               // Get the properies
+               mlt_properties properties = MLT_CONSUMER_PROPERTIES( this );
+
+               // Locate the profile
+               mlt_profile_select( mlt_properties_get( properties, "profile" ) );
+
+               // Stop listening to this
+               mlt_event_close( g_event_listener );
+               g_event_listener = NULL;
+
+               // Apply to properties
+               apply_profile_properties( mlt_profile_get(), properties );
+       }
+}
+
 static void mlt_consumer_frame_show( mlt_listener listener, mlt_properties owner, mlt_service this, void **args )
 {
        if ( listener != NULL )
@@ -176,16 +187,6 @@ int mlt_consumer_start( mlt_consumer this )
        // Determine if there's a test card producer
        char *test_card = mlt_properties_get( properties, "test_card" );
 
-       // Handle profiles
-       char *profile = mlt_properties_get( properties, "profile" );
-       int profile_ok = mlt_consumer_profile( properties, profile );
-
-       // Check that everything is OK
-       if ( !profile_ok )
-               fprintf( stderr, "Unrecognised profile %s - continuing with defaults.\n", mlt_properties_get( properties, "profile" ) );
-       else if ( profile_ok < 0 )
-               fprintf( stderr, "Recognised profile %s with warnings - trying to continue with some defaults.\n", mlt_properties_get( properties, "profile" ) );
-
        // Just to make sure nothing is hanging around...
        mlt_frame_close( this->put );
        this->put = NULL;
@@ -349,164 +350,16 @@ static inline long time_difference( struct timeval *time1 )
 
 int mlt_consumer_profile( mlt_properties properties, char *profile )
 {
-       double fps = mlt_properties_get_double( properties, "fps" );
-       int recognised = 1;
-       double display_num = 0;
-       double display_den = 0;
-       double pixel_num = 0;
-       double pixel_den = 0;
-       int width = 0;
-       int height = 0;
-
-       if ( fps == 25.0 && profile != NULL )
-       {
-               width = 720;
-               height = 576;
-               display_num = 4;
-               display_den = 3;
-               pixel_num = 59;
-               pixel_den = 54;
-
-               if ( !strcmp( profile, "dv_wide" ) )
-               {
-                       display_num = 16;
-                       display_den = 9;
-                       pixel_num = 118;
-                       pixel_den = 81;
-               }
-               else if ( !strncmp( profile, "square_wide", 11 ) )
-               {
-                       display_num = 16;
-                       display_den = 9;
-                       pixel_num = 1;
-                       pixel_den = 1;
-                       width = 1024;
-                       height = 576;
-               }
-               else if ( !strncmp( profile, "square", 6 ) )
-               {
-                       pixel_num = 1;
-                       pixel_den = 1;
-                       width = 768;
-                       height = 576;
-               }
-               else if ( !strncmp( profile, "vcd", 3 ) )
-               {
-                       width = 352;
-                       height = 288;
-               }
-               else if ( !strncmp( profile, "cvd", 3 ) )
-               {
-                       width = 352;
-                       height = 576;
-                       pixel_num = 59;
-                       pixel_den = 27;
-               }
-               else if ( !strncmp( profile, "svcd_wide", 9 ) )
-               {
-                       width = 480;
-                       height = 576;
-                       pixel_num = 59;
-                       pixel_den = 27;
-                       display_num = 16;
-                       display_den = 9;
-               }
-               else if ( !strncmp( profile, "svcd", 4 ) )
-               {
-                       width = 480;
-                       height = 576;
-                       pixel_num = 59;
-                       pixel_den = 36;
-               }
-               else if ( strncmp( profile, "frame", 5 ) && strcmp( profile, "dv" ) )
-               {
-                       recognised = 0;
-               }
-       }
-       else if ( profile != NULL )
+       mlt_profile p = mlt_profile_select( profile );
+       if ( p )
        {
-               width = 720;
-               height = 480;
-               display_num = 4;
-               display_den = 3;
-               pixel_num = 10;
-               pixel_den = 11;
-
-               if ( !strcmp( profile, "dv_wide" ) )
-               {
-                       display_num = 16;
-                       display_den = 9;
-                       pixel_num = 40;
-                       pixel_den = 33;
-               }
-               else if ( !strncmp( profile, "square_wide", 11 ) )
-               {
-                       display_num = 16;
-                       display_den = 9;
-                       pixel_num = 1;
-                       pixel_den = 1;
-                       width = 854;
-                       height = 480;
-               }
-               else if ( !strncmp( profile, "square", 6 ) )
-               {
-                       pixel_num = 1;
-                       pixel_den = 1;
-                       width = 640;
-                       height = 480;
-               }
-               else if ( !strncmp( profile, "vcd", 3 ) )
-               {
-                       width = 352;
-                       height = 240;
-               }
-               else if ( !strncmp( profile, "cvd", 3 ) )
-               {
-                       width = 352;
-                       height = 480;
-                       pixel_num = 20;
-                       pixel_den = 11;
-               }
-               else if ( !strncmp( profile, "svcd_wide", 9 ) )
-               {
-                       width = 480;
-                       height = 480;
-                       pixel_num = 20;
-                       pixel_den = 11;
-                       display_num = 16;
-                       display_den = 9;
-               }
-               else if ( !strncmp( profile, "svcd", 4 ) )
-               {
-                       width = 480;
-                       height = 480;
-                       pixel_num = 15;
-                       pixel_den = 11;
-               }
-               else if ( strncmp( profile, "frame", 5 ) && strcmp( profile, "dv" ) )
-               {
-                       recognised = 0;
-               }
+               apply_profile_properties( p, properties );
+               return 1;
        }
-
-       // If width (or any of the above are 0), we use defaults otherwise we switch to recognised
-       if ( width != 0 && recognised )
+       else
        {
-               if ( recognised && strchr( profile, ':' ) )
-                       if ( sscanf( strchr( profile, ':' ) + 1, "%dx%d", &width, &height ) != 2 )
-                               recognised = -1;
-
-               mlt_properties_set_int( properties, "width", width );
-               mlt_properties_set_int( properties, "height", height );
-               mlt_properties_set_double( properties, "aspect_ratio", pixel_num / pixel_den );
-               mlt_properties_set_int( properties, "aspect_ratio_num", pixel_num );
-               mlt_properties_set_int( properties, "aspect_ratio_den", pixel_den );
-               mlt_properties_set_double( properties, "display_ratio", display_num / display_den );
-               mlt_properties_set_int( properties, "display_ratio_num", display_num );
-               mlt_properties_set_int( properties, "display_ratio_den", display_den );
+               return 0;
        }
-
-       return recognised;
 }
 
 static void *consumer_read_ahead_thread( void *arg )
index b624113350f0ba641a6468d710e32a8a6ea26b8a..124526575533c3242c31c14734cf2b1f7999243a 100644 (file)
@@ -111,8 +111,37 @@ int mlt_factory_init( const char *prefix )
                mlt_properties_set_or_default( global_properties, "MLT_PRODUCER", getenv( "MLT_PRODUCER" ), "fezzik" );
                mlt_properties_set_or_default( global_properties, "MLT_CONSUMER", getenv( "MLT_CONSUMER" ), "sdl" );
                mlt_properties_set( global_properties, "MLT_TEST_CARD", getenv( "MLT_TEST_CARD" ) );
+               mlt_properties_set_or_default( global_properties, "MLT_PROFILE", getenv( "MLT_PROFILE" ), "dv_pal" );
+
+               // Load the most appropriate profile
+               // MLT_PROFILE preferred
+               if ( getenv( "MLT_PROFILE" ) )
+               {
+                       if ( !mlt_profile_select( mlt_environment( "MLT_PROFILE" ) ) )
+                               mlt_profile_load_file( mlt_environment( "MLT_PROFILE" ) );
+               }
+               // MLT_NORMALISATION backwards compatibility
+               else if ( strcmp( mlt_environment( "MLT_NORMALISATION" ), "PAL" ) )
+                       mlt_profile_select( "dv_ntsc" );
+               else
+                       mlt_profile_select( "dv_pal" );
+
+               // destroy an invalid profile so it can be constructed from hard defauls
+               if ( mlt_profile_get()->width == 0 )
+                       mlt_profile_close();
+
+               // Set MLT_NORMALISATION to appease legacy modules
+               if ( !getenv( "MLT_NORMALISATION" ) )
+               {
+                       const char *profile = mlt_profile_get()->name;
+                       if ( strstr( profile, "_ntsc" ) || strstr( profile, "_atsc" ) )
+                               setenv( "MLT_NORMALISATION", "NTSC", 1 );
+                       else if ( strstr( profile, "_pal" ) )
+                               setenv( "MLT_NORMALISATION", "PAL", 1 );
+               }
        }
 
+
        return 0;
 }
 
@@ -279,6 +308,6 @@ void mlt_factory_close( )
                free( mlt_prefix );
                mlt_prefix = NULL;
                mlt_pool_close( );
+               mlt_profile_close();
        }
 }
-
index 92983aabefa3108b74c6e832d148a6aa43c3e1f3..52de88d9ea40757ab28e936f3dcfb1ccfdaed079 100644 (file)
@@ -22,6 +22,8 @@
 #include "mlt_frame.h"
 #include "mlt_producer.h"
 #include "mlt_factory.h"
+#include "mlt_profile.h"
+
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
@@ -37,9 +39,6 @@ mlt_frame mlt_frame_init( )
 
        if ( this != NULL )
        {
-               // Get the normalisation
-               char *normalisation = mlt_environment( "MLT_NORMALISATION" );
-
                // Initialise the properties
                mlt_properties properties = &this->parent;
                mlt_properties_init( properties, this );
@@ -47,24 +46,11 @@ mlt_frame mlt_frame_init( )
                // Set default properties on the frame
                mlt_properties_set_position( properties, "_position", 0.0 );
                mlt_properties_set_data( properties, "image", NULL, 0, NULL, NULL );
-
-               if ( normalisation == NULL || strcmp( normalisation, "NTSC" ) )
-               {
-                       mlt_properties_set_int( properties, "width", 720 );
-                       mlt_properties_set_int( properties, "height", 576 );
-                       mlt_properties_set_int( properties, "normalised_width", 720 );
-                       mlt_properties_set_int( properties, "normalised_height", 576 );
-                       mlt_properties_set_double( properties, "aspect_ratio", 59.0/54.0 );
-               }
-               else
-               {
-                       mlt_properties_set_int( properties, "width", 720 );
-                       mlt_properties_set_int( properties, "height", 480 );
-                       mlt_properties_set_int( properties, "normalised_width", 720 );
-                       mlt_properties_set_int( properties, "normalised_height", 480 );
-                       mlt_properties_set_double( properties, "aspect_ratio", 10.0/11.0 );
-               }
-
+               mlt_properties_set_int( properties, "width", mlt_profile_get()->width );
+               mlt_properties_set_int( properties, "height", mlt_profile_get()->height );
+               mlt_properties_set_int( properties, "normalised_width", mlt_profile_get()->width );
+               mlt_properties_set_int( properties, "normalised_height", mlt_profile_get()->height );
+               mlt_properties_set_double( properties, "aspect_ratio", mlt_profile_sar( NULL ) );
                mlt_properties_set_data( properties, "audio", NULL, 0, NULL, NULL );
                mlt_properties_set_data( properties, "alpha", NULL, 0, NULL, NULL );
 
index 50a0d6227fac32d3961f537d8106b6ab433b6bec..67d98ee9f5759227fdfe05d906127a1af013d810 100644 (file)
@@ -21,6 +21,7 @@
 #include "mlt_geometry.h"
 #include "mlt_tokeniser.h"
 #include "mlt_factory.h"
+#include "mlt_profile.h"
 
 #include <stdio.h>
 #include <stdlib.h>
@@ -54,12 +55,8 @@ mlt_geometry mlt_geometry_init( )
                if ( this->local != NULL )
                {
                        geometry self = this->local;
-                       char *normalisation = mlt_environment( "MLT_NORMALISATION" );
-                       self->nw = 720;
-                       if ( normalisation == NULL || strcmp( normalisation, "NTSC" ) )
-                               self->nh = 576;
-                       else
-                               self->nh = 480;
+                       self->nw = mlt_profile_get()->width;
+                       self->nh = mlt_profile_get()->height;
                }
                else
                {
index ecd1eedc3b7ae4e94f83426e424c16e044620260..56d1d3f36fa8d935b03abae7341670264bb91730 100644 (file)
@@ -23,6 +23,8 @@
 #include "mlt_factory.h"
 #include "mlt_frame.h"
 #include "mlt_parser.h"
+#include "mlt_profile.h"
+
 #include <stdio.h>
 #include <string.h>
 #include <stdlib.h>
@@ -66,9 +68,6 @@ int mlt_producer_init( mlt_producer this, void *child )
                // Initialise the service
                if ( mlt_service_init( &this->parent, this ) == 0 )
                {
-                       // Get the normalisation preference
-                       char *normalisation = mlt_environment( "MLT_NORMALISATION" );
-
                        // The parent is the service
                        mlt_service parent = &this->parent;
        
@@ -86,20 +85,10 @@ int mlt_producer_init( mlt_producer this, void *child )
                        mlt_properties_set( properties, "mlt_type", "mlt_producer" );
                        mlt_properties_set_position( properties, "_position", 0.0 );
                        mlt_properties_set_double( properties, "_frame", 0 );
-                       if ( normalisation == NULL || strcmp( normalisation, "NTSC" ) )
-                       {
-                               mlt_properties_set_double( properties, "fps", 25.0 );
-                               mlt_properties_set_int( properties, "frame_rate_num", 25 );
-                               mlt_properties_set_int( properties, "frame_rate_den", 1 );
-                               mlt_properties_set_double( properties, "aspect_ratio", 59.0 / 54.0 );
-                       }
-                       else
-                       {
-                               mlt_properties_set_double( properties, "fps", 30000.0 / 1001.0 );
-                               mlt_properties_set_int( properties, "frame_rate_num", 30000 );
-                               mlt_properties_set_int( properties, "frame_rate_den", 1001 );
-                               mlt_properties_set_double( properties, "aspect_ratio", 10.0 / 11.0 );
-                       }
+                       mlt_properties_set_double( properties, "fps", mlt_profile_fps( NULL ) );
+                       mlt_properties_set_int( properties, "frame_rate_num", mlt_profile_get()->frame_rate_num );
+                       mlt_properties_set_int( properties, "frame_rate_den", mlt_profile_get()->frame_rate_den );
+                       mlt_properties_set_double( properties, "aspect_ratio", mlt_profile_sar( NULL ) );
                        mlt_properties_set_double( properties, "_speed", 1.0 );
                        mlt_properties_set_position( properties, "in", 0 );
                        mlt_properties_set_position( properties, "out", 14999 );
diff --git a/src/framework/mlt_profile.c b/src/framework/mlt_profile.c
new file mode 100644 (file)
index 0000000..d32146a
--- /dev/null
@@ -0,0 +1,193 @@
+/*
+ * mlt_profile.c -- video output definition
+ * Copyright (C) 2007 Ushodaya Enterprises Limited
+ * Author: Dan Dennedy <dan@dennedy.org>
+ *
+ * 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 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
+ * Lesser General Public License for more details.
+ *
+ * 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 "mlt_profile.h"
+#include "mlt_factory.h"
+#include "mlt_properties.h"
+
+#include <stdlib.h>
+#include <string.h>
+#include <libgen.h>
+
+#define PROFILES_DIR "/share/mlt/profiles/"
+
+static mlt_profile profile = NULL;
+
+/** Get the current profile
+* Builds one for PAL DV if non-existing
+*/
+
+mlt_profile mlt_profile_get( )
+{
+       if ( !profile )
+       {
+               profile = calloc( 1, sizeof( struct mlt_profile_s ) );
+               if ( profile )
+               {
+                       profile->name = strdup( "DV PAL" );
+                       profile->frame_rate_num = 25;
+                       profile->frame_rate_den = 1;
+                       profile->width = 720;
+                       profile->height = 576;
+                       profile->progressive = 0;
+                       profile->sample_aspect_num = 59;
+                       profile->sample_aspect_den = 54;
+                       profile->display_aspect_num = 4;
+                       profile->display_aspect_den = 3;
+               }
+       }
+       return profile;
+}
+
+
+/** Load a profile from the system folder
+*/
+
+mlt_profile mlt_profile_select( const char *name )
+{
+       const char *prefix = PREFIX;
+       char *filename = calloc( 1, strlen( prefix ) + strlen( PROFILES_DIR ) + strlen( name ) + 1 );
+       strcpy( filename, prefix );
+       if ( filename[ strlen( filename ) - 1 ] != '/' )
+               filename[ strlen( filename ) ] = '/';
+       strcat( filename, PROFILES_DIR );
+       strcat( filename, name );
+       return mlt_profile_load_file( filename );
+}
+
+/** Load a profile from specific file
+*/
+
+mlt_profile mlt_profile_load_file( const char *file )
+{
+       // Load the profile as properties
+       mlt_properties properties = mlt_properties_load( file );
+       if ( properties && mlt_properties_get_int( properties, "width" ) )
+       {
+               mlt_profile_load_properties( properties );
+               if ( !profile->name )
+               {
+                       char *filename = strdup( file );
+                       profile->name = strdup( basename( filename ) );
+                       free( filename );
+               }
+       }
+       else
+       {
+               mlt_properties_close( properties );
+               mlt_profile_close();
+       }
+       return profile;
+}
+
+/** Load a profile from a properties object
+*/
+
+mlt_profile mlt_profile_load_properties( mlt_properties properties )
+{
+       mlt_profile_close();
+       profile = calloc( 1, sizeof( struct mlt_profile_s ) );
+       if ( profile )
+       {
+               if ( mlt_properties_get( properties, "name" ) )
+                       profile->name = mlt_properties_get( properties, "name" );
+               profile->frame_rate_num = mlt_properties_get_int( properties, "frame_rate_num" );
+               profile->frame_rate_den = mlt_properties_get_int( properties, "frame_rate_den" );
+               profile->width = mlt_properties_get_int( properties, "width" );
+               profile->height = mlt_properties_get_int( properties, "height" );
+               profile->progressive = mlt_properties_get_int( properties, "progressive" );
+               profile->sample_aspect_num = mlt_properties_get_int( properties, "sample_aspect_num" );
+               profile->sample_aspect_den = mlt_properties_get_int( properties, "sample_aspect_den" );
+               profile->display_aspect_num = mlt_properties_get_int( properties, "display_aspect_num" );
+               profile->display_aspect_den = mlt_properties_get_int( properties, "display_aspect_den" );
+       }
+       return profile;
+}
+
+/** Load an anonymous profile from string
+*/
+
+mlt_profile mlt_profile_load_string( const char *string )
+{
+       mlt_properties properties = mlt_properties_new();
+       if ( properties )
+       {
+               const char *p = string;
+               while ( p )
+               {
+                       if ( strcmp( p, "" ) && p[ 0 ] != '#' )
+                               mlt_properties_parse( properties, p );
+                       p = strchr( p, '\n' );
+                       if ( p ) p++;
+               }
+       }
+       mlt_profile_load_properties( properties );
+       if ( profile && !profile->name )
+               profile->name = strdup( "untitled" );
+       return profile;
+}
+
+/** Get the framerate as float
+*/
+
+double mlt_profile_fps( mlt_profile aprofile )
+{
+       if ( aprofile )
+               return ( double ) aprofile->frame_rate_num / aprofile->frame_rate_den;
+       else
+               return ( double ) mlt_profile_get()->frame_rate_num / mlt_profile_get()->frame_rate_den;
+}
+
+/** Get the sample aspect ratio as float
+*/
+
+double mlt_profile_sar( mlt_profile aprofile )
+{
+       if ( aprofile )
+               return ( double ) aprofile->sample_aspect_num / aprofile->sample_aspect_den;
+       else
+               return ( double ) mlt_profile_get()->sample_aspect_num / mlt_profile_get()->sample_aspect_den;
+}
+
+/** Get the display aspect ratio as float
+*/
+
+double mlt_profile_dar( mlt_profile aprofile )
+{
+       if ( aprofile )
+               return ( double ) aprofile->display_aspect_num / aprofile->display_aspect_den;
+       else
+               return ( double ) mlt_profile_get()->display_aspect_num / mlt_profile_get()->display_aspect_den;
+}
+
+/** Free up the global profile resources
+*/
+
+void mlt_profile_close( )
+{
+       if ( profile )
+       {
+               if ( profile->name )
+                       free( profile->name );
+               profile->name = NULL;
+               free( profile );
+               profile = NULL;
+       }
+}
diff --git a/src/framework/mlt_profile.h b/src/framework/mlt_profile.h
new file mode 100644 (file)
index 0000000..29ee633
--- /dev/null
@@ -0,0 +1,49 @@
+/*
+ * mlt_profile.h -- video output definition
+ * Copyright (C) 2007 Ushodaya Enterprises Limited
+ * Author: Dan Dennedy <dan@dennedy.org>
+ *
+ * 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 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
+ * Lesser General Public License for more details.
+ *
+ * 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
+ */
+
+#ifndef _MLT_PROFILE_H
+#define _MLT_PROFILE_H
+
+#include "mlt_types.h"
+
+struct mlt_profile_s
+{
+       char* name;
+       int frame_rate_num;
+       int frame_rate_den;
+       int width;
+       int height;
+       int progressive;
+       int sample_aspect_num;
+       int sample_aspect_den;
+       int display_aspect_num;
+       int display_aspect_den;
+};
+
+extern mlt_profile mlt_profile_get( );
+extern mlt_profile mlt_profile_select( const char *name );
+extern mlt_profile mlt_profile_load_file( const char *file );
+extern mlt_profile mlt_profile_load_properties( mlt_properties properties );
+extern mlt_profile mlt_profile_load_string( const char *string );
+extern double mlt_profile_fps( mlt_profile profile );
+extern double mlt_profile_sar( mlt_profile profile );
+extern double mlt_profile_dar( mlt_profile profile );
+extern void mlt_profile_close( );
+#endif
index 50baba6d2dfcc7e3bda0c2d8287dd00250612e33..d550c3f919251ca21799185c2e41caa180673043 100644 (file)
@@ -94,6 +94,7 @@ typedef struct mlt_parser_s *mlt_parser;
 typedef struct mlt_deque_s *mlt_deque;
 typedef struct mlt_geometry_s *mlt_geometry;
 typedef struct mlt_geometry_item_s *mlt_geometry_item;
+typedef struct mlt_profile_s *mlt_profile;
 
 typedef void ( *mlt_destructor )( void * );
 typedef char *( *mlt_serialiser )( void *, int length );
index e3deee044daee976b3d8195f5ea49b8417fb4ccc..f6c468e33715ca0e4544586ac62e402fb5f0a933 100644 (file)
@@ -283,7 +283,7 @@ static void consumer_encode_audio( mlt_consumer this, uint8_t *dv_frame, mlt_fra
                time_t start = time( NULL );
                int height = mlt_properties_get_int( this_properties, "height" );
                int is_pal = height == 576;
-               int is_wide = mlt_properties_get_int( this_properties, "display_ratio_num" ) == 16;
+               int is_wide = mlt_properties_get_int( this_properties, "display_aspect_num" ) == 16;
 
                // Temporary - audio buffer allocation
                int16_t *audio_buffers[ 4 ];
index fdfcdc240892b032dae703c22fbef6fa1a5ccfae..70e65d9cf3ca13204ce25c69ac68116b0e6c58fa 100644 (file)
@@ -102,9 +102,6 @@ mlt_consumer consumer_sdl_init( char *arg )
                mlt_service service = MLT_CONSUMER_SERVICE( parent );
                this->properties = MLT_SERVICE_PROPERTIES( service );
 
-               // Default display aspect ratio
-               double display_ratio = mlt_properties_get_double( this->properties, "display_ratio" );
-               
                // Set the default volume
                mlt_properties_set_double( this->properties, "volume", 1.0 );
 
@@ -136,10 +133,6 @@ mlt_consumer consumer_sdl_init( char *arg )
                        this->height = mlt_properties_get_int( this->properties, "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;
 
@@ -219,6 +212,11 @@ int consumer_start( mlt_consumer parent )
                if ( audio_off == 0 )
                        SDL_InitSubSystem( SDL_INIT_AUDIO );
 
+               // 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 ( this->sdl_screen == NULL && display_off == 0 )
                        this->sdl_screen = SDL_SetVideoMode( this->window_width, this->window_height, 0, this->sdl_flags );