mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 20:21:24 +00:00
textoverlay: Add support for vertical center alignment
Fixes bug #639159.
This commit is contained in:
parent
254088344c
commit
876bf233fb
2 changed files with 6 additions and 1 deletions
|
@ -216,6 +216,7 @@ gst_text_overlay_valign_get_type (void)
|
|||
{GST_TEXT_OVERLAY_VALIGN_BOTTOM, "bottom", "bottom"},
|
||||
{GST_TEXT_OVERLAY_VALIGN_TOP, "top", "top"},
|
||||
{GST_TEXT_OVERLAY_VALIGN_POS, "position", "position"},
|
||||
{GST_TEXT_OVERLAY_VALIGN_CENTER, "center", "center"},
|
||||
{0, NULL, NULL},
|
||||
};
|
||||
|
||||
|
@ -1798,6 +1799,9 @@ gst_text_overlay_push_frame (GstTextOverlay * overlay, GstBuffer * video_frame)
|
|||
ypos = (gint) (overlay->height * overlay->ypos) - height / 2;
|
||||
ypos = CLAMP (ypos, 0, overlay->height - height);
|
||||
break;
|
||||
case GST_TEXT_OVERLAY_VALIGN_CENTER:
|
||||
ypos = (overlay->height - height) / 2;
|
||||
break;
|
||||
default:
|
||||
ypos = overlay->ypad;
|
||||
break;
|
||||
|
|
|
@ -35,7 +35,8 @@ typedef enum {
|
|||
GST_TEXT_OVERLAY_VALIGN_BASELINE,
|
||||
GST_TEXT_OVERLAY_VALIGN_BOTTOM,
|
||||
GST_TEXT_OVERLAY_VALIGN_TOP,
|
||||
GST_TEXT_OVERLAY_VALIGN_POS
|
||||
GST_TEXT_OVERLAY_VALIGN_POS,
|
||||
GST_TEXT_OVERLAY_VALIGN_CENTER
|
||||
} GstTextOverlayVAlign;
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue