textoverlay: Expose rendering dimensions as properties.
[platform/upstream/gstreamer.git] / ext / pango / gstbasetextoverlay.h
index 4319229..76fb10d 100644 (file)
@@ -1,9 +1,33 @@
+/* GStreamer
+ * Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
+ * Copyright (C) <2003> David Schleef <ds@schleef.org>
+ * Copyright (C) <2006> Julien Moutte <julien@moutte.net>
+ * Copyright (C) <2006> Zeeshan Ali <zeeshan.ali@nokia.com>
+ * Copyright (C) <2006-2008> Tim-Philipp Müller <tim centricular net>
+ * Copyright (C) <2009> Young-Ho Cha <ganadist@gmail.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
 #ifndef __GST_BASE_TEXT_OVERLAY_H__
 #define __GST_BASE_TEXT_OVERLAY_H__
 
 #include <gst/gst.h>
 #include <gst/video/video.h>
-#include <gst/controller/gstcontroller.h>
+#include <gst/video/video-overlay-composition.h>
 #include <pango/pangocairo.h>
 
 G_BEGIN_DECLS
@@ -104,28 +128,25 @@ struct _GstBaseTextOverlay {
     GstSegment               segment;
     GstSegment               text_segment;
     GstBuffer               *text_buffer;
-    gboolean                text_linked;
-    gboolean                video_flushing;
-    gboolean                video_eos;
-    gboolean                text_flushing;
-    gboolean                text_eos;
-
-    GCond                   *cond;  /* to signal removal of a queued text
+    gboolean                 text_linked;
+    gboolean                 video_flushing;
+    gboolean                 video_eos;
+    gboolean                 text_flushing;
+    gboolean                 text_eos;
+
+    GMutex                   lock;
+    GCond                    cond;  /* to signal removal of a queued text
                                      * buffer, arrival of a text buffer,
                                      * a text segment update, or a change
                                      * in status (e.g. shutdown, flushing) */
 
+    /* stream metrics */
+    GstVideoInfo             info;
+    GstVideoFormat           format;
     gint                     width;
     gint                     height;
-    gint                     fps_n;
-    gint                     fps_d;
-    GstVideoFormat           format;
-
-    GstBaseTextOverlayVAlign     valign;
-    GstBaseTextOverlayHAlign     halign;
-    GstBaseTextOverlayWrapMode   wrap_mode;
-    GstBaseTextOverlayLineAlign  line_align;
 
+    /* properties */
     gint                     xpad;
     gint                     ypad;
     gint                     deltax;
@@ -136,23 +157,54 @@ struct _GstBaseTextOverlay {
     gboolean                 want_shading;
     gboolean                 silent;
     gboolean                 wait_text;
-    guint                    color;
-
+    guint                    color, outline_color;
     PangoLayout             *layout;
-    gdouble                  shadow_offset;
-    gdouble                  outline_offset;
-    guchar                  *text_image;
-    gint                     image_width;
-    gint                     image_height;
-    gint                     baseline_y;
-
     gboolean                 auto_adjust_size;
-    gboolean                 need_render;
-
+    gboolean                 draw_shadow;
+    gboolean                 draw_outline;
     gint                     shading_value;  /* for timeoverlay subclass */
+    gboolean                 use_vertical_render;
+    GstBaseTextOverlayVAlign     valign;
+    GstBaseTextOverlayHAlign     halign;
+    GstBaseTextOverlayWrapMode   wrap_mode;
+    GstBaseTextOverlayLineAlign  line_align;
 
+    /* text pad format */
     gboolean                 have_pango_markup;
-    gboolean                 use_vertical_render;
+
+    /* rendering state */
+    gboolean                 need_render;
+    GstBuffer               *text_image;
+
+    /* dimension relative to witch the render is done, this is the stream size
+     * or a portion of the window_size (adapted to aspect ratio) */
+    gint                     render_width;
+    gint                     render_height;
+    /* This is (render_width / width) uses to convert to stream scale */
+    gdouble                  render_scale;
+
+    /* dimension of text_image, the physical dimension */
+    guint                    text_width;
+    guint                    text_height;
+
+    /* position of rendering in image coordinates */
+    gint                     text_x;
+    gint                     text_y;
+
+    /* window dimension, reported in the composition meta params. This is set
+     * to stream width, height if missing */
+    gint                     window_width;
+    gint                     window_height;
+
+    gdouble                  shadow_offset;
+    gdouble                  outline_offset;
+
+    PangoRectangle           ink_rect;
+    PangoRectangle           logical_rect;
+
+    gboolean                    attach_compo_to_buffer;
+    GstVideoOverlayComposition *composition;
+    GstVideoOverlayComposition *upstream_composition;
 };
 
 struct _GstBaseTextOverlayClass {