mlt_frame mlt_frame_init( mlt_service service )
{
// Allocate a frame
- mlt_frame self = calloc( sizeof( struct mlt_frame_s ), 1 );
+ mlt_frame self = calloc( 1, sizeof( struct mlt_frame_s ) );
if ( self != NULL )
{
}
/** Get the time position of this frame.
+ *
+ * This position is not necessarily the position as the original
+ * producer knows it. It could be the position that the playlist,
+ * multitrack, or tractor producer set.
*
* \public \memberof mlt_frame_s
* \param self a frame
* \return the position
+ * \see mlt_frame_original_position
*/
mlt_position mlt_frame_get_position( mlt_frame self )
return pos < 0 ? 0 : pos;
}
+/** Get the original time position of this frame.
+ *
+ * This is the position that the original producer set on the frame.
+ *
+ * \public \memberof mlt_frame_s
+ * \param self a frame
+ * \return the position
+ */
+
+mlt_position mlt_frame_original_position( mlt_frame self )
+{
+ int pos = mlt_properties_get_position( MLT_FRAME_PROPERTIES( self ), "original_position" );
+ return pos < 0 ? 0 : pos;
+}
+
/** Set the time position of this frame.
*
* \public \memberof mlt_frame_s
int mlt_frame_set_position( mlt_frame self, mlt_position value )
{
+ // Only set the original_position the first time.
+ if ( ! mlt_properties_get( MLT_FRAME_PROPERTIES( self ), "original_position" ) )
+ mlt_properties_set_position( MLT_FRAME_PROPERTIES( self ), "original_position", value );
return mlt_properties_set_position( MLT_FRAME_PROPERTIES( self ), "_position", value );
}
// Make an 8-bit buffer large enough to hold rendering
int size = w * h;
+ if ( size <= 0 )
+ return NULL;
unsigned char *bitmap = ( unsigned char* )mlt_pool_alloc( size );
if ( bitmap != NULL )
memset( bitmap, 0, size );