return result;
}
+/** Set a property to an integer value by color.
+ *
+ * \public \memberof mlt_properties_s
+ * \param self a properties list
+ * \param name the property to set
+ * \param value the color
+ * \return true if error
+ */
+
+int mlt_properties_set_color( mlt_properties self, const char *name, mlt_color color )
+{
+ int error = 1;
+
+ if ( !self || !name ) return error;
+
+ // Fetch the property to work with
+ mlt_property property = mlt_properties_fetch( self, name );
+
+ // Set it if not NULL
+ if ( property != NULL )
+ {
+ uint32_t value = ( color.r << 24 ) | ( color.g << 16 ) | ( color.b << 8 ) | color.a;
+ error = mlt_property_set_int( property, value );
+ mlt_properties_do_mirror( self, name );
+ }
+
+ mlt_events_fire( self, "property-changed", name, NULL );
+
+ return error;
+}
/** Get a string value by name.
*
extern void mlt_properties_unlock( mlt_properties self );
extern char *mlt_properties_get_time( mlt_properties, const char* name, mlt_time_format );
extern mlt_color mlt_properties_get_color( mlt_properties, const char* name );
+extern int mlt_properties_set_color( mlt_properties, const char* name, mlt_color value );
extern char* mlt_properties_anim_get( mlt_properties self, const char *name, int position, int length );
extern int mlt_properties_anim_set( mlt_properties self, const char *name, const char *value, int position, int length );
return mlt_properties_get_color( get_properties(), name );
}
+int Properties::set( const char *name, mlt_color value )
+{
+ return mlt_properties_set_color( get_properties(), name, value );
+}
+
char *Properties::anim_get( const char *name, int position, int length )
{
return mlt_properties_anim_get( get_properties(), name, position, length );
const char *get_lcnumeric( );
char *get_time( const char *name, mlt_time_format = mlt_time_smpte );
mlt_color get_color( const char *name );
+ int set( const char *name , mlt_color value );
char* anim_get( const char *name, int position, int length = 0 );
int anim_set( const char *name, const char *value, int position, int length = 0 );
global:
extern "C++" {
"Mlt::Deque::peek(int)";
- "Mlt::Properties::get_color(char const*)";
"Mlt::Properties::anim_get(char const*, int, int)";
- "Mlt::Properties::anim_set(char const*, char const*, int, int)";
- "Mlt::Properties::anim_get_int(char const*, int, int)";
- "Mlt::Properties::anim_set(char const*, int, int, int, mlt_keyframe_type)";
"Mlt::Properties::anim_get_double(char const*, int, int)";
+ "Mlt::Properties::anim_get_int(char const*, int, int)";
+ "Mlt::Properties::anim_get_rect(char const*, int, int)";
+ "Mlt::Properties::anim_set(char const*, char const*, int, int)";
"Mlt::Properties::anim_set(char const*, double, int, int, mlt_keyframe_type)";
- "Mlt::Properties::set(char const*, mlt_rect)";
- "Mlt::Properties::set(char const*, double, double, double, double, double)";
- "Mlt::Properties::get_rect(char const*)";
+ "Mlt::Properties::anim_set(char const*, int, int, int, mlt_keyframe_type)";
"Mlt::Properties::anim_set(char const*, mlt_rect, int, int, mlt_keyframe_type)";
- "Mlt::Properties::anim_get_rect(char const*, int, int)";
+ "Mlt::Properties::get_color(char const*)";
+ "Mlt::Properties::get_rect(char const*)";
+ "Mlt::Properties::set(char const*, double, double, double, double, double)";
+ "Mlt::Properties::set(char const*, mlt_color);
+ "Mlt::Properties::set(char const*, mlt_rect)";
"Mlt::Service::filter_count()";
"Mlt::Service::move_filter(int, int)";
};
QCOMPARE(color.g, quint8(0xbb));
QCOMPARE(color.b, quint8(0xcc));
QCOMPARE(color.a, quint8(0xdd));
- p.set("key", *((int*) &color));
- QCOMPARE(p.get_int("key"), int(0xddccbbaa));
+ p.set("key", color);
+ QCOMPARE(p.get_int("key"), int(0xaabbccdd));
}
void ColorFromString()