textoverlay: Add support for vertical center alignment
Fixes bug #639159.
This commit is contained in:
parent
254088344c
commit
876bf233fb
@ -216,6 +216,7 @@ gst_text_overlay_valign_get_type (void)
|
|||||||
{GST_TEXT_OVERLAY_VALIGN_BOTTOM, "bottom", "bottom"},
|
{GST_TEXT_OVERLAY_VALIGN_BOTTOM, "bottom", "bottom"},
|
||||||
{GST_TEXT_OVERLAY_VALIGN_TOP, "top", "top"},
|
{GST_TEXT_OVERLAY_VALIGN_TOP, "top", "top"},
|
||||||
{GST_TEXT_OVERLAY_VALIGN_POS, "position", "position"},
|
{GST_TEXT_OVERLAY_VALIGN_POS, "position", "position"},
|
||||||
|
{GST_TEXT_OVERLAY_VALIGN_CENTER, "center", "center"},
|
||||||
{0, NULL, NULL},
|
{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 = (gint) (overlay->height * overlay->ypos) - height / 2;
|
||||||
ypos = CLAMP (ypos, 0, overlay->height - height);
|
ypos = CLAMP (ypos, 0, overlay->height - height);
|
||||||
break;
|
break;
|
||||||
|
case GST_TEXT_OVERLAY_VALIGN_CENTER:
|
||||||
|
ypos = (overlay->height - height) / 2;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
ypos = overlay->ypad;
|
ypos = overlay->ypad;
|
||||||
break;
|
break;
|
||||||
|
@ -35,7 +35,8 @@ typedef enum {
|
|||||||
GST_TEXT_OVERLAY_VALIGN_BASELINE,
|
GST_TEXT_OVERLAY_VALIGN_BASELINE,
|
||||||
GST_TEXT_OVERLAY_VALIGN_BOTTOM,
|
GST_TEXT_OVERLAY_VALIGN_BOTTOM,
|
||||||
GST_TEXT_OVERLAY_VALIGN_TOP,
|
GST_TEXT_OVERLAY_VALIGN_TOP,
|
||||||
GST_TEXT_OVERLAY_VALIGN_POS
|
GST_TEXT_OVERLAY_VALIGN_POS,
|
||||||
|
GST_TEXT_OVERLAY_VALIGN_CENTER
|
||||||
} GstTextOverlayVAlign;
|
} GstTextOverlayVAlign;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user