textoverlay: Add support for vertical center alignment

Fixes bug #639159.
This commit is contained in:
Lane Brooks 2011-01-11 18:18:34 +01:00 committed by Sebastian Dröge
parent 254088344c
commit 876bf233fb
2 changed files with 6 additions and 1 deletions

View file

@ -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;

View file

@ -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;
/**