Skip to content
Closed
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
2 changes: 2 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,8 @@ Modules
- Fixed `crop` with hardware decode+scale plus preview scale.
- Fixed subtitle filter rendering one frame past the end time, and
`subtitle_feed` end-frame calculation.
- Added a keyframable `bg_radius` property for rounded backgrounds to
`qtext` and the text services that delegate to it.
- Fixed file-name buffer overflows in `gpsgraphic` and `gpstext`.

Other
Expand Down
4 changes: 3 additions & 1 deletion src/modules/plus/filter_dynamictext.c
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,8 @@ static mlt_frame filter_process(mlt_filter filter, mlt_frame frame)
free(result);
mlt_properties_pass_list(text_filter_properties,
properties,
"geometry family size weight style fgcolour bgcolour olcolour pad "
"geometry family size weight style fgcolour bgcolour bg_radius "
"olcolour pad "
"halign valign outline underline strikethrough opacity");
mlt_filter_set_in_and_out(text_filter, mlt_filter_get_in(filter), mlt_filter_get_out(filter));
return mlt_filter_process(text_filter, frame);
Expand Down Expand Up @@ -311,6 +312,7 @@ mlt_filter filter_dynamictext_init(mlt_profile profile,
mlt_properties_set_string(my_properties, "style", "normal");
mlt_properties_set_string(my_properties, "fgcolour", "0x000000ff");
mlt_properties_set_string(my_properties, "bgcolour", "0x00000020");
mlt_properties_set_double(my_properties, "bg_radius", 0.0);
mlt_properties_set_string(my_properties, "olcolour", "0x00000000");
mlt_properties_set_string(my_properties, "pad", "0");
mlt_properties_set_string(my_properties, "halign", "left");
Expand Down
17 changes: 16 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: 6
version: 7
copyright: Meltytech, LLC
license: LGPLv2.1
language: en
Expand Down Expand Up @@ -119,6 +119,21 @@ parameters:
mutable: yes
widget: color

- identifier: bg_radius
title: Background corner radius
type: float
description: >
The corner radius in pixels of the background rectangle. Values larger
than half the rectangle's shortest side are clamped. Only supported when
the qtext filter is available.
default: 0
minimum: 0
readonly: no
mutable: yes
animation: yes
widget: spinner
unit: pixels

- identifier: olcolour
title: Outline color
type: string
Expand Down
4 changes: 3 additions & 1 deletion src/modules/plus/filter_subtitle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,8 @@ static mlt_frame filter_process(mlt_filter filter, mlt_frame frame)
mlt_properties_set_string(text_filter_properties, "argument", text);
mlt_properties_pass_list(text_filter_properties,
properties,
"geometry family size weight style fgcolour bgcolour olcolour pad "
"geometry family size weight style fgcolour bgcolour bg_radius "
"olcolour pad "
"halign valign outline underline strikethrough opacity "
"typewriter typewriter.step_length typewriter.step_sigma "
"typewriter.random_seed typewriter.macro_type typewriter.cursor "
Expand Down Expand Up @@ -203,6 +204,7 @@ mlt_filter filter_subtitle_init(mlt_profile profile,
mlt_properties_set_string(properties, "style", "normal");
mlt_properties_set_string(properties, "fgcolour", "0x000000ff");
mlt_properties_set_string(properties, "bgcolour", "0x00000020");
mlt_properties_set_double(properties, "bg_radius", 0.0);
mlt_properties_set_string(properties, "olcolour", "0x00000000");
mlt_properties_set_string(properties, "pad", "0");
mlt_properties_set_string(properties, "halign", "left");
Expand Down
17 changes: 16 additions & 1 deletion src/modules/plus/filter_subtitle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ schema_version: 7.2
type: filter
identifier: subtitle
title: Subtitle
version: 5
version: 6
copyright: Meltytech, LLC
license: LGPLv2.1
language: en
Expand Down Expand Up @@ -113,6 +113,21 @@ parameters:
mutable: yes
widget: color

- identifier: bg_radius
title: Background corner radius
type: float
description: >
The corner radius in pixels of the background rectangle. Values larger
than half the rectangle's shortest side are clamped. Only supported when
the qtext filter is available.
default: 0
minimum: 0
readonly: no
mutable: yes
animation: yes
widget: spinner
unit: pixels

- identifier: olcolour
title: Outline color
type: string
Expand Down
4 changes: 3 additions & 1 deletion src/modules/plus/filter_timer.c
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,8 @@ static mlt_frame filter_process(mlt_filter filter, mlt_frame frame)
free(result);
mlt_properties_pass_list(text_filter_properties,
properties,
"geometry family size weight style fgcolour bgcolour olcolour pad "
"geometry family size weight style fgcolour bgcolour bg_radius "
"olcolour pad "
"halign valign outline underline strikethrough opacity");
mlt_filter_set_in_and_out(text_filter, mlt_filter_get_in(filter), mlt_filter_get_out(filter));
return mlt_filter_process(text_filter, frame);
Expand Down Expand Up @@ -156,6 +157,7 @@ mlt_filter filter_timer_init(mlt_profile profile, mlt_service_type type, const c
mlt_properties_set(my_properties, "style", "normal");
mlt_properties_set(my_properties, "fgcolour", "0x000000ff");
mlt_properties_set(my_properties, "bgcolour", "0x00000020");
mlt_properties_set_double(my_properties, "bg_radius", 0.0);
mlt_properties_set(my_properties, "olcolour", "0x00000000");
mlt_properties_set(my_properties, "pad", "0");
mlt_properties_set(my_properties, "halign", "left");
Expand Down
17 changes: 16 additions & 1 deletion src/modules/plus/filter_timer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ schema_version: 7.2
type: filter
identifier: timer
title: Timer
version: 5
version: 6
copyright: Meltytech, LLC
license: LGPLv2.1
language: en
Expand Down Expand Up @@ -175,6 +175,21 @@ parameters:
mutable: yes
widget: color

- identifier: bg_radius
title: Background corner radius
type: float
description: >
The corner radius in pixels of the background rectangle. Values larger
than half the rectangle's shortest side are clamped. Only supported when
the qtext filter is available.
default: 0
minimum: 0
readonly: no
mutable: yes
animation: yes
widget: spinner
unit: pixels

- identifier: olcolour
title: Outline color
type: string
Expand Down
3 changes: 2 additions & 1 deletion src/modules/plus/producer_subtitle.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ static int producer_get_frame(mlt_producer producer, mlt_frame_ptr frame, int in
mlt_properties_pass_list(
MLT_FILTER_PROPERTIES(sub_filter),
producer_properties,
"resource geometry family size weight style fgcolour bgcolour "
"resource geometry family size weight style fgcolour bgcolour bg_radius "
"olcolour pad halign valign outline underline strikethrough opacity");
mlt_filter_process(sub_filter, *frame);
}
Expand Down Expand Up @@ -89,6 +89,7 @@ mlt_producer producer_subtitle_init(mlt_profile profile,
mlt_properties_set_string(producer_properties, "style", "normal");
mlt_properties_set_string(producer_properties, "fgcolour", "0xffffffff");
mlt_properties_set_string(producer_properties, "bgcolour", "0x00000020");
mlt_properties_set_double(producer_properties, "bg_radius", 0.0);
mlt_properties_set_string(producer_properties, "olcolour", "0x00000000");
mlt_properties_set_string(producer_properties, "pad", "0");
mlt_properties_set_string(producer_properties, "halign", "left");
Expand Down
17 changes: 16 additions & 1 deletion src/modules/plus/producer_subtitle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ schema_version: 7.2
type: producer
identifier: subtitle
title: Subtitle
version: 3
version: 4
copyright: Meltytech, LLC
license: LGPLv2.1
language: en
Expand Down Expand Up @@ -96,6 +96,21 @@ parameters:
mutable: yes
widget: color

- identifier: bg_radius
title: Background corner radius
type: float
description: >
The corner radius in pixels of the background rectangle. Values larger
than half the rectangle's shortest side are clamped. Only supported when
the qtext filter is available.
default: 0
minimum: 0
readonly: no
mutable: yes
animation: yes
widget: spinner
unit: pixels

- identifier: olcolour
title: Outline color
type: string
Expand Down
4 changes: 3 additions & 1 deletion src/modules/qt/filter_gpstext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -592,7 +592,8 @@ static mlt_frame filter_process(mlt_filter filter, mlt_frame frame)

mlt_properties_pass_list(text_filter_properties,
properties,
"geometry family size weight style fgcolour bgcolour olcolour pad "
"geometry family size weight style fgcolour bgcolour bg_radius "
"olcolour pad "
"halign valign outline underline strikethrough opacity");
mlt_filter_set_in_and_out(text_filter, mlt_filter_get_in(filter), mlt_filter_get_out(filter));
return mlt_filter_process(text_filter, frame);
Expand Down Expand Up @@ -659,6 +660,7 @@ mlt_filter filter_gpstext_init(mlt_profile profile, mlt_service_type type, const
mlt_properties_set_string(my_properties, "style", "normal");
mlt_properties_set_string(my_properties, "fgcolour", "0xffffffff");
mlt_properties_set_string(my_properties, "bgcolour", "0x00000000");
mlt_properties_set_double(my_properties, "bg_radius", 0.0);
mlt_properties_set_string(my_properties, "olcolour", "0x000000ff");
mlt_properties_set_string(my_properties, "pad", "5");
mlt_properties_set_string(my_properties, "halign", "left");
Expand Down
17 changes: 16 additions & 1 deletion src/modules/qt/filter_gpstext.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ schema_version: 7.2
type: filter
identifier: gpstext
title: GPS Text
version: 8
version: 9
copyright: Meltytech, LLC
creator: Daniel F
license: LGPLv2.1
Expand Down Expand Up @@ -264,6 +264,21 @@ parameters:
mutable: yes
widget: color

- identifier: bg_radius
title: Background corner radius
type: float
description: >
The corner radius in pixels of the background rectangle. Values larger
than half the rectangle's shortest side are clamped. Only supported when
the qtext filter is available.
default: 0
minimum: 0
readonly: no
mutable: yes
animation: yes
widget: spinner
unit: pixels

- identifier: olcolour
title: Outline color
type: string
Expand Down
16 changes: 15 additions & 1 deletion src/modules/qt/filter_qtext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -351,11 +351,22 @@ static void paint_background(QPainter *painter,
QRectF path_rect,
mlt_properties filter_properties,
mlt_properties frame_properties,
double radius_scale,
int position,
int length)
{
QColor bg_color = get_qcolor(filter_properties, "bgcolour", frame_properties, position, length);
painter->fillRect(path_rect, bg_color);
qreal radius = mlt_properties_anim_get_double(filter_properties, "bg_radius", position, length)
* radius_scale;
if (radius <= 0.0) {
painter->fillRect(path_rect, bg_color);
return;
}

radius = qMin(radius, qMin(path_rect.width(), path_rect.height()) / 2.0);
QPainterPath background_path;
background_path.addRoundedRect(path_rect, radius, radius);
painter->fillPath(background_path, bg_color);
}

static void paint_text(QPainter *painter,
Expand Down Expand Up @@ -545,6 +556,7 @@ static int filter_get_image(mlt_frame frame,
path_rect,
filter_properties,
frame_properties,
pixel_ratio,
position,
length);
doc->drawContents(&painter, drawRect);
Expand All @@ -562,6 +574,7 @@ static int filter_get_image(mlt_frame frame,
path_rect,
filter_properties,
frame_properties,
scale,
position,
length);
paint_text(&painter, &text_path, filter_properties, frame_properties, position, length);
Expand Down Expand Up @@ -641,6 +654,7 @@ mlt_filter filter_qtext_init(mlt_profile profile, mlt_service_type type, const c
mlt_properties_set_string(filter_properties, "style", "normal");
mlt_properties_set_string(filter_properties, "fgcolour", "0x000000ff");
mlt_properties_set_string(filter_properties, "bgcolour", "0x00000020");
mlt_properties_set_double(filter_properties, "bg_radius", 0.0);
mlt_properties_set_string(filter_properties, "olcolour", "0x00000000");
mlt_properties_set_string(filter_properties, "pad", "0");
mlt_properties_set_string(filter_properties, "halign", "left");
Expand Down
27 changes: 20 additions & 7 deletions src/modules/qt/filter_qtext.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ schema_version: 7.2
type: filter
identifier: qtext
title: QText
version: 8
version: 9
copyright: Meltytech, LLC
license: LGPLv2.1
language: en
Expand Down Expand Up @@ -93,6 +93,19 @@ parameters:
widget: color
animation: yes

- identifier: bg_radius
title: Background corner radius
type: float
description: >
The corner radius in pixels of the background rectangle. Values larger
than half the rectangle's shortest side are clamped.
default: 0
minimum: 0
mutable: yes
animation: yes
widget: spinner
unit: pixels

- identifier: olcolour
title: Outline color
type: color
Expand Down Expand Up @@ -180,9 +193,9 @@ parameters:
type: string
description: >
Render rich text from a string containing a subset of HTML 4.
The only other properties that can be used with this are geometry and
bgcolour. The geometry width and height defines the page or block size
while its X and Y coordinates determine its position.
The only other properties that can be used with this are geometry,
bgcolour, and bg_radius. The geometry width and height defines the page
or block size while its X and Y coordinates determine its position.
This property has a higher priority than argument; argument is ignored if
this property is set.
mutable: yes
Expand All @@ -192,9 +205,9 @@ parameters:
type: string
description: >
Render rich text from a file containing a subset of HTML 4.
The only other properties that can be used with this are geometry and
bgcolour. The geometry width and height defines the page or block size
while its X and Y coordinates determine its position.
The only other properties that can be used with this are geometry,
bgcolour, and bg_radius. The geometry width and height defines the page
or block size while its X and Y coordinates determine its position.
This property has a higher priority than both argument and html; argument
and html are ignored if this property is set.
mutable: yes
Expand Down