]> git.sesse.net Git - mlt/commitdiff
Merge pull request #11 from gmarco/changes
authorDan Dennedy <dan@dennedy.org>
Fri, 7 Sep 2012 04:59:46 +0000 (21:59 -0700)
committerDan Dennedy <dan@dennedy.org>
Fri, 7 Sep 2012 04:59:46 +0000 (21:59 -0700)
fix possible segfault on borders, used >= for

src/framework/mlt_consumer.c
src/framework/mlt_service.c
src/framework/mlt_service.h
src/mlt++/MltProfile.cpp
src/mlt++/MltProfile.h
src/mlt++/MltService.cpp
src/mlt++/MltService.h
src/modules/core/transition_composite.c

index 122f66b0fc29949aff696505164e532c981ad6f7..2a350a76abf8ecf4e529bfdcd2d9cee93a9b3bb3 100644 (file)
@@ -449,6 +449,9 @@ int mlt_consumer_start( mlt_consumer self )
                mlt_properties_set_data( properties, "test_card_producer", NULL, 0, NULL, NULL );
        }
 
+       // The profile could have changed between a stop and a restart.
+       apply_profile_properties( self, mlt_service_profile( MLT_CONSUMER_SERVICE(self) ), properties );
+
        // Set the frame duration in microseconds for the frame-dropping heuristic
        int frame_rate_num = mlt_properties_get_int( properties, "frame_rate_num" );
        int frame_rate_den = mlt_properties_get_int( properties, "frame_rate_den" );
index 7e66451e58fde039d7149c1d4fc896a6568127a0..d40a8f3378aa90e979d7099a9441b4b2c8f2bd68 100644 (file)
@@ -650,6 +650,18 @@ mlt_profile mlt_service_profile( mlt_service self )
        return self? mlt_properties_get_data( MLT_SERVICE_PROPERTIES( self ), "_profile", NULL ) : NULL;
 }
 
+/** Set the profile for a service.
+ *
+ * \public \memberof mlt_service_s
+ * \param self a service
+ * \param profile the profile to set onto the service
+ */
+
+void mlt_service_set_profile( mlt_service self, mlt_profile profile )
+{
+    mlt_properties_set_data( MLT_SERVICE_PROPERTIES( self ), "_profile", profile, 0, NULL, NULL );
+}
+
 /** Destroy a service.
  *
  * \public \memberof mlt_service_s
index 6a29d59abbc18815f8c0d278ad1ce7cc21d6b27e..4a799770d7e0f7a877c9d34ff71173a2e0f627a4 100644 (file)
@@ -94,6 +94,7 @@ extern int mlt_service_detach( mlt_service self, mlt_filter filter );
 extern void mlt_service_apply_filters( mlt_service self, mlt_frame frame, int index );
 extern mlt_filter mlt_service_filter( mlt_service self, int index );
 extern mlt_profile mlt_service_profile( mlt_service self );
+extern void mlt_service_set_profile( mlt_service self, mlt_profile profile );
 extern void mlt_service_close( mlt_service self );
 
 extern void mlt_service_cache_put( mlt_service self, const char *name, void* data, int size, mlt_destructor destructor );
index 3af100aaef54954a12be69333d20e7badbfe04d8..e470a6ed8805270b06c21dd1caf6ea6ef40fd640 100644 (file)
@@ -123,6 +123,11 @@ double Profile::dar() const
        return mlt_profile_dar( instance );
 }
 
+int Profile::is_explicit() const
+{
+       return instance->is_explicit;
+}
+
 Properties* Profile::list()
 {
        return new Properties( mlt_profile_list() );
index 248c83703afbe00197464b983a68d5c3361ab661..3e95d5fdd69d9847e72a880c635fff6203d20ff0 100644 (file)
@@ -58,6 +58,7 @@ namespace Mlt
                        int display_aspect_num() const;
                        int display_aspect_den() const;
                        double dar() const;
+                       int is_explicit() const;
                        static Properties* list();
                        void from_producer( Producer &producer );
                        void set_width( int width );
index 254c592f81ccfc50ab240543d8fb8027377998d0..7e561664fbc971751ea6e8fde90548aca5adba49 100644 (file)
@@ -124,3 +124,7 @@ Filter *Service::filter( int index )
        return result == NULL ? NULL : new Filter( result );
 }
 
+void Service::set_profile( Profile &profile )
+{
+       mlt_service_set_profile( get_service( ), profile.get_profile( ) );
+}
index 4588bcc3e317f620b88b00b24d5583dc75120943..7f79f0406f26d0dfe3370c65f24e2ad9f857dbe9 100644 (file)
@@ -58,6 +58,7 @@ namespace Mlt
                        int attach( Filter &filter );
                        int detach( Filter &filter );
                        Filter *filter( int index );
+                       void set_profile( Profile &profile );
        };
 }
 
index 49d01f5d9c49181002e8c1ea5689628536ed23d1..6357886a483d36a3d856c0598147eea167a5dbc1 100644 (file)
@@ -355,7 +355,7 @@ static void luma_read_yuv422( uint8_t *image, uint16_t **map, int width, int hei
 
 static inline int calculate_mix( uint16_t *luma, int j, int softness, int weight, int alpha, uint32_t step )
 {
-       return ( ( luma ? smoothstep( luma[ j ], luma[ j ] + softness, step ) : weight ) * alpha ) >> 8;
+       return ( ( luma ? smoothstep( luma[ j ], luma[ j ] + softness, step ) : weight ) * ( alpha + 1 ) ) >> 8;
 }
 
 static inline uint8_t sample_mix( uint8_t dest, uint8_t src, int mix )
@@ -460,7 +460,7 @@ static int composite_yuv( uint8_t *p_dest, int width_dest, int height_dest, uint
        int stride_src = geometry.sw * bpp;
        int stride_dest = width_dest * bpp;
        int i_softness = ( 1 << 16 ) * softness;
-       int weight = ( ( ( 1 << 16 ) - 1 ) * geometry.item.mix + 50 ) / 100;
+       int weight = ( ( 1 << 16 ) * geometry.item.mix + 50 ) / 100;
        uint32_t luma_step = ( ( ( 1 << 16 ) - 1 ) * geometry.item.mix + 50 ) / 100 * ( 1.0 + softness );
 
        // Adjust to consumer scale