From: dezeroex Date: Mon, 15 Aug 2005 06:25:37 +0000 (+0000) Subject: Fix build errors caused by the (hypothetical) conversion of mlt_position from an... X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=1e55d8082c842d4ae2d718eb2675719eeb615c0c;p=mlt Fix build errors caused by the (hypothetical) conversion of mlt_position from an int to a float, preserving original behavior. git-svn-id: https://mlt.svn.sourceforge.net/svnroot/mlt/trunk/mlt@800 d19143bc-622f-0410-bfdd-b5b2a6649095 --- diff --git a/src/framework/mlt_frame.c b/src/framework/mlt_frame.c index 0f54d4df..914ef854 100644 --- a/src/framework/mlt_frame.c +++ b/src/framework/mlt_frame.c @@ -1021,6 +1021,7 @@ int mlt_frame_mix_audio( mlt_frame this, mlt_frame that, float weight_start, flo return ret; } +/* Will this break when mlt_position is converted to double? -Zach */ int mlt_sample_calculator( float fps, int frequency, int64_t position ) { int samples = 0; diff --git a/src/framework/mlt_playlist.c b/src/framework/mlt_playlist.c index dac8c6d1..8097fc4b 100644 --- a/src/framework/mlt_playlist.c +++ b/src/framework/mlt_playlist.c @@ -363,7 +363,7 @@ static mlt_service mlt_playlist_virtual_seek( mlt_playlist this, int *progressiv { int count = this->list[ i ]->frame_count / this->list[ i ]->repeat; *progressive = count == 1; - mlt_producer_seek( producer, position % count ); + mlt_producer_seek( producer, (int)position % count ); } else if ( !strcmp( eof, "pause" ) && total > 0 ) { @@ -372,7 +372,7 @@ static mlt_service mlt_playlist_virtual_seek( mlt_playlist this, int *progressiv mlt_producer this_producer = MLT_PLAYLIST_PRODUCER( this ); mlt_producer_seek( this_producer, original - 1 ); producer = entry->producer; - mlt_producer_seek( producer, entry->frame_out % count ); + mlt_producer_seek( producer, (int)entry->frame_out % count ); mlt_producer_set_speed( this_producer, 0 ); mlt_producer_set_speed( producer, 0 ); *progressive = count == 1; @@ -1035,7 +1035,7 @@ mlt_producer mlt_playlist_get_clip( mlt_playlist this, int clip ) /** Return the clip at the specified position. */ -mlt_producer mlt_playlist_get_clip_at( mlt_playlist this, int position ) +mlt_producer mlt_playlist_get_clip_at( mlt_playlist this, mlt_position position ) { int index = 0, total = 0; return mlt_playlist_locate( this, &position, &index, &total ); @@ -1044,7 +1044,7 @@ mlt_producer mlt_playlist_get_clip_at( mlt_playlist this, int position ) /** Return the clip index of the specified position. */ -int mlt_playlist_get_clip_index_at( mlt_playlist this, int position ) +int mlt_playlist_get_clip_index_at( mlt_playlist this, mlt_position position ) { int index = 0, total = 0; mlt_playlist_locate( this, &position, &index, &total ); @@ -1208,7 +1208,7 @@ int mlt_playlist_is_blank( mlt_playlist this, int clip ) /** Determine if the specified position is a blank. */ -int mlt_playlist_is_blank_at( mlt_playlist this, int position ) +int mlt_playlist_is_blank_at( mlt_playlist this, mlt_position position ) { return this == NULL || mlt_producer_is_blank( mlt_playlist_get_clip_at( this, position ) ); } @@ -1251,7 +1251,7 @@ void mlt_playlist_insert_blank( mlt_playlist this, int clip, int length ) } } -void mlt_playlist_pad_blanks( mlt_playlist this, int position, int length, int find ) +void mlt_playlist_pad_blanks( mlt_playlist this, mlt_position position, int length, int find ) { if ( this != NULL && length != 0 ) { @@ -1278,7 +1278,7 @@ void mlt_playlist_pad_blanks( mlt_playlist this, int position, int length, int f } } -int mlt_playlist_insert_at( mlt_playlist this, int position, mlt_producer producer, int mode ) +int mlt_playlist_insert_at( mlt_playlist this, mlt_position position, mlt_producer producer, int mode ) { int ret = this == NULL || position < 0 || producer == NULL; if ( ret == 0 ) @@ -1376,7 +1376,7 @@ int mlt_playlist_blanks_from( mlt_playlist this, int clip, int bounded ) return count; } -int mlt_playlist_remove_region( mlt_playlist this, int position, int length ) +int mlt_playlist_remove_region( mlt_playlist this, mlt_position position, int length ) { int index = mlt_playlist_get_clip_index_at( this, position ); if ( index >= 0 && index < this->count ) @@ -1414,7 +1414,7 @@ int mlt_playlist_remove_region( mlt_playlist this, int position, int length ) return index; } -int mlt_playlist_move_region( mlt_playlist this, int position, int length, int new_position ) +int mlt_playlist_move_region( mlt_playlist this, mlt_position position, int length, int new_position ) { if ( this != NULL ) { diff --git a/src/framework/mlt_playlist.h b/src/framework/mlt_playlist.h index e70ff623..27ee8d9c 100644 --- a/src/framework/mlt_playlist.h +++ b/src/framework/mlt_playlist.h @@ -88,21 +88,21 @@ extern int mlt_playlist_join( mlt_playlist self, int clip, int count, int merge extern int mlt_playlist_mix( mlt_playlist self, int clip, int length, mlt_transition transition ); extern int mlt_playlist_mix_add( mlt_playlist self, int clip, mlt_transition transition ); extern mlt_producer mlt_playlist_get_clip( mlt_playlist self, int clip ); -extern mlt_producer mlt_playlist_get_clip_at( mlt_playlist self, int position ); -extern int mlt_playlist_get_clip_index_at( mlt_playlist self, int position ); +extern mlt_producer mlt_playlist_get_clip_at( mlt_playlist self, mlt_position position ); +extern int mlt_playlist_get_clip_index_at( mlt_playlist self, mlt_position position ); extern int mlt_playlist_clip_is_mix( mlt_playlist self, int clip ); extern void mlt_playlist_consolidate_blanks( mlt_playlist self, int keep_length ); extern int mlt_playlist_is_blank( mlt_playlist self, int clip ); -extern int mlt_playlist_is_blank_at( mlt_playlist self, int position ); +extern int mlt_playlist_is_blank_at( mlt_playlist self, mlt_position position ); extern void mlt_playlist_insert_blank( mlt_playlist self, int clip, int length ); -extern void mlt_playlist_pad_blanks( mlt_playlist self, int position, int length, int find ); +extern void mlt_playlist_pad_blanks( mlt_playlist self, mlt_position position, int length, int find ); extern mlt_producer mlt_playlist_replace_with_blank( mlt_playlist self, int clip ); -extern int mlt_playlist_insert_at( mlt_playlist self, int position, mlt_producer producer, int mode ); +extern int mlt_playlist_insert_at( mlt_playlist self, mlt_position position, mlt_producer producer, int mode ); extern int mlt_playlist_clip_start( mlt_playlist self, int clip ); extern int mlt_playlist_clip_length( mlt_playlist self, int clip ); extern int mlt_playlist_blanks_from( mlt_playlist self, int clip, int bounded ); -extern int mlt_playlist_remove_region( mlt_playlist self, int position, int length ); -extern int mlt_playlist_move_region( mlt_playlist self, int position, int length, int new_position ); +extern int mlt_playlist_remove_region( mlt_playlist self, mlt_position position, int length ); +extern int mlt_playlist_move_region( mlt_playlist self, mlt_position position, int length, int new_position ); extern void mlt_playlist_close( mlt_playlist self ); #endif diff --git a/src/framework/mlt_producer.c b/src/framework/mlt_producer.c index f137973a..3f7a01b2 100644 --- a/src/framework/mlt_producer.c +++ b/src/framework/mlt_producer.c @@ -260,7 +260,7 @@ int mlt_producer_seek( mlt_producer this, mlt_position position ) } else if ( use_points && !strcmp( eof, "loop" ) && position >= mlt_producer_get_playtime( this ) ) { - position = position % mlt_producer_get_playtime( this ); + position = (int)position % (int)mlt_producer_get_playtime( this ); } // Set the position diff --git a/src/framework/mlt_property.c b/src/framework/mlt_property.c index 63e32a43..016ea918 100644 --- a/src/framework/mlt_property.c +++ b/src/framework/mlt_property.c @@ -269,7 +269,7 @@ char *mlt_property_get_string( mlt_property this ) { this->types |= mlt_prop_string; this->prop_string = malloc( 32 ); - sprintf( this->prop_string, "%d", this->prop_position ); + sprintf( this->prop_string, "%d", (int)this->prop_position ); /* I don't know if this is wanted. -Zach */ } else if ( this->types & mlt_prop_int64 ) { diff --git a/src/framework/mlt_types.h b/src/framework/mlt_types.h index c5a8e68f..e9c17432 100644 --- a/src/framework/mlt_types.h +++ b/src/framework/mlt_types.h @@ -65,7 +65,14 @@ typedef enum } mlt_service_type; +/* I don't want to break anyone's applications without warning. -Zach */ +#undef DOUBLE_MLT_POSITION +#ifdef DOUBLE_MLT_POSITION +typedef double mlt_position; +#else typedef int32_t mlt_position; +#endif + typedef struct mlt_frame_s *mlt_frame, **mlt_frame_ptr; typedef struct mlt_properties_s *mlt_properties; typedef struct mlt_event_struct *mlt_event;