Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/modules/plus/filter_timer.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ static void get_timer_str( mlt_filter filter, mlt_frame frame, char* text )
char* direction = mlt_properties_get( properties, "direction" );
double timer_start = time_to_seconds( mlt_properties_get( properties, "start" ) );
double timer_duration = time_to_seconds( mlt_properties_get( properties, "duration" ) );
double timer_offset = time_to_seconds( mlt_properties_get( properties, "offset" ) );
double value = time_to_seconds( mlt_properties_frames_to_time( properties, current_frame, mlt_time_clock ) );

if ( timer_duration <= 0.0 )
Expand Down Expand Up @@ -71,6 +72,9 @@ static void get_timer_str( mlt_filter filter, mlt_frame frame, char* text )
value = timer_duration - value;
}

// Apply offset
value += timer_offset;

int hours = value / ( 60 * 60 );
int mins = ( value / 60 ) - ( hours * 60 );
double secs = value - (double)( mins * 60 ) - (double)( hours * 60 * 60 );
Expand Down Expand Up @@ -145,6 +149,7 @@ mlt_filter filter_timer_init( mlt_profile profile, mlt_service_type type, const
mlt_properties_set( my_properties, "format", "SS.SS" );
mlt_properties_set( my_properties, "start", "00:00:00.000" );
mlt_properties_set( my_properties, "duration", "00:10:00.000" );
mlt_properties_set( my_properties, "offset", "00:00:00.000" );
mlt_properties_set( my_properties, "direction", "up" );
mlt_properties_set( my_properties, "geometry", "0%/0%:100%x100%:100%" );
mlt_properties_set( my_properties, "family", "Sans" );
Expand Down
13 changes: 13 additions & 0 deletions src/modules/plus/filter_timer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,19 @@ parameters:
mutable: yes
widget: text

- identifier: offset
title: Offset
type: string
description: >
An offset to be added to the timer value. When the direction is "down",
the timer will count down to "offset" instead of 00:00:00.000. When the
direction is up, the timer will count up starting from "offset".
Must be in the format HH:MM:SS.SSS
default: 00:00:00.000
readonly: no
mutable: yes
widget: text

- identifier: direction
title: Direction
type: string
Expand Down