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
10 changes: 6 additions & 4 deletions src/modules/plus/filter_dynamictext.c
Original file line number Diff line number Diff line change
Expand Up @@ -88,11 +88,11 @@ static void get_timecode_str(mlt_filter filter,
strncat(text, s, MAX_TEXT_LEN - strlen(text) - 1);
}

static void get_frame_str(mlt_filter filter, mlt_frame frame, char *text)
static void get_frame_str(mlt_filter filter, mlt_frame frame, char *text, int offset)
{
int pos = mlt_frame_get_position(frame);
int pos = mlt_frame_get_position(frame) + offset;
char s[12];
snprintf(s, sizeof(s) - 1, "%d", pos);
snprintf(s, sizeof(s), "%d", pos);
strncat(text, s, MAX_TEXT_LEN - strlen(text) - 1);
}

Expand Down Expand Up @@ -221,7 +221,9 @@ static void substitute_keywords(mlt_filter filter, char *result, char *value, ml
} else if (!strcmp(keyword, "smpte_ndf")) {
get_timecode_str(filter, frame, result, mlt_time_smpte_ndf);
} else if (!strcmp(keyword, "frame")) {
get_frame_str(filter, frame, result);
get_frame_str(filter, frame, result, 0);
} else if (!strcmp(keyword, "frame+1")) {
get_frame_str(filter, frame, result, 1);
} else if (!strncmp(keyword, "filedate", 8)) {
get_filedate_str(keyword, filter, frame, result);
} else if (!strncmp(keyword, "localfiledate", 13)) {
Expand Down
3 changes: 2 additions & 1 deletion src/modules/plus/filter_dynamictext.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ schema_version: 7.2
type: filter
identifier: dynamictext
title: Dynamic text
version: 5
version: 6
copyright: Meltytech, LLC
license: LGPLv2.1
language: en
Expand All @@ -27,6 +27,7 @@ parameters:
* #smpte_ndf# - SMPTE non-drop-frame timecode of the frame
* #timecode# - same as #smpte_df#
* #frame# - frame number of the frame
* #frame+1# - frame number of the frame, starting at 1, not 0
* #filedate# - modification date of the file (GMT)
* #localfiledate# - modification date of the file (local)
* #localtime# - current system date and time
Expand Down
Loading