2003-07-02 08:07:24 +00:00
|
|
|
/* GStreamer
|
2014-11-25 14:45:23 +00:00
|
|
|
* Copyright (C) 1999 Erik Walthinsen <omega@cse.ogi.edu>
|
|
|
|
* Copyright (C) 2005-2014 Tim-Philipp Müller <tim@centricular.net>
|
2003-07-02 08:07:24 +00:00
|
|
|
*
|
|
|
|
* 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
|
2012-11-03 23:05:09 +00:00
|
|
|
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
|
|
|
|
* Boston, MA 02110-1301, USA.
|
2003-07-02 08:07:24 +00:00
|
|
|
*/
|
|
|
|
|
2005-12-02 16:52:54 +00:00
|
|
|
/**
|
|
|
|
* SECTION:element-timeoverlay
|
2017-01-23 19:36:11 +00:00
|
|
|
* @title: timeoverlay
|
2011-04-16 13:56:55 +00:00
|
|
|
* @see_also: #GstBaseTextOverlay, #GstClockOverlay
|
2005-12-02 16:52:54 +00:00
|
|
|
*
|
|
|
|
* This element overlays the buffer time stamps of a video stream on
|
|
|
|
* top of itself. You can position the text and configure the font details
|
2019-05-25 14:54:39 +00:00
|
|
|
* using its properties.
|
|
|
|
*
|
|
|
|
* By default, the time stamp is displayed in the top left corner of the picture,
|
|
|
|
* with some padding to the left and to the top.
|
2008-07-10 21:06:06 +00:00
|
|
|
*
|
|
|
|
* |[
|
2015-05-09 21:33:26 +00:00
|
|
|
* gst-launch-1.0 -v videotestsrc ! timeoverlay ! autovideosink
|
2017-01-23 19:36:11 +00:00
|
|
|
* ]|
|
|
|
|
* Display the time stamps in the top left corner of the video picture.
|
2008-07-10 21:06:06 +00:00
|
|
|
* |[
|
2015-05-09 21:33:26 +00:00
|
|
|
* gst-launch-1.0 -v videotestsrc ! timeoverlay halignment=right valignment=bottom text="Stream time:" shaded-background=true font-desc="Sans, 24" ! autovideosink
|
2017-01-23 19:36:11 +00:00
|
|
|
* ]|
|
|
|
|
* Another pipeline that displays the time stamps with some leading
|
2005-12-02 16:52:54 +00:00
|
|
|
* text in the bottom right corner of the video picture, with the background
|
|
|
|
* of the text being shaded in order to make it more legible on top of a
|
2008-07-10 21:06:06 +00:00
|
|
|
* bright video background.
|
2017-01-23 19:36:11 +00:00
|
|
|
*
|
2005-12-02 16:52:54 +00:00
|
|
|
*/
|
|
|
|
|
2003-11-07 12:47:02 +00:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
#include "config.h"
|
|
|
|
#endif
|
2003-07-02 08:07:24 +00:00
|
|
|
|
Port pango-based textoverlay, timeoverlay and textrender to 0.9 and add background shading and text wrapping modes. M...
Original commit message from CVS:
* configure.ac:
* ext/Makefile.am:
* ext/pango/Makefile.am:
* ext/pango/gstclockoverlay.c: (gst_clock_overlay_base_init),
(gst_clock_overlay_render_time), (gst_clock_overlay_get_text),
(gst_clock_overlay_class_init), (gst_clock_overlay_init):
* ext/pango/gstclockoverlay.h:
* ext/pango/gsttextoverlay.c: (gst_text_overlay_base_init),
(gst_text_overlay_get_text), (gst_text_overlay_class_init),
(gst_text_overlay_finalize), (gst_text_overlay_init),
(gst_text_overlay_update_wrap_mode), (gst_text_overlay_setcaps),
(gst_text_overlay_text_pad_linked),
(gst_text_overlay_text_pad_unlinked),
(gst_text_overlay_set_property), (gst_text_overlay_getcaps),
(gst_text_overlay_shade_y), (gst_text_overlay_blit_yuv420),
(gst_text_overlay_resize_bitmap), (gst_text_overlay_render_text),
(gst_text_overlay_push_frame), (gst_text_overlay_pop_video),
(gst_text_overlay_pop_text), (gst_text_overlay_collected),
(gst_text_overlay_change_state), (plugin_init):
* ext/pango/gsttextoverlay.h:
* ext/pango/gsttimeoverlay.c: (gst_time_overlay_base_init),
(gst_time_overlay_render_time), (gst_time_overlay_get_text),
(gst_time_overlay_class_init), (gst_time_overlay_init):
* ext/pango/gsttimeoverlay.h:
Port pango-based textoverlay, timeoverlay and textrender to 0.9
and add background shading and text wrapping modes. Make
timoverlay derive from textoverlay. Also add new clockoverlay
element.
2005-11-30 13:20:57 +00:00
|
|
|
#include <gst/video/video.h>
|
2003-07-02 08:07:24 +00:00
|
|
|
|
2011-08-04 09:30:05 +00:00
|
|
|
#include "gsttimeoverlay.h"
|
2003-07-02 08:07:24 +00:00
|
|
|
|
2014-11-25 14:45:23 +00:00
|
|
|
#define DEFAULT_TIME_LINE GST_TIME_OVERLAY_TIME_LINE_BUFFER_TIME
|
2019-07-10 12:00:56 +00:00
|
|
|
#define DEFAULT_SHOW_TIMES_AS_DATES FALSE
|
|
|
|
#define DEFAULT_DATETIME_FORMAT "%F %T" /* YYYY-MM-DD hh:mm:ss */
|
2014-11-25 14:45:23 +00:00
|
|
|
|
|
|
|
enum
|
|
|
|
{
|
|
|
|
PROP_0,
|
2019-07-10 12:00:56 +00:00
|
|
|
PROP_TIME_LINE,
|
|
|
|
PROP_SHOW_TIMES_AS_DATES,
|
|
|
|
PROP_DATETIME_EPOCH,
|
|
|
|
PROP_DATETIME_FORMAT,
|
2014-11-25 14:45:23 +00:00
|
|
|
};
|
|
|
|
|
2011-04-19 12:11:32 +00:00
|
|
|
#define gst_time_overlay_parent_class parent_class
|
|
|
|
G_DEFINE_TYPE (GstTimeOverlay, gst_time_overlay, GST_TYPE_BASE_TEXT_OVERLAY);
|
2003-07-02 08:07:24 +00:00
|
|
|
|
2014-11-25 14:45:23 +00:00
|
|
|
static void gst_time_overlay_set_property (GObject * object, guint prop_id,
|
|
|
|
const GValue * value, GParamSpec * pspec);
|
|
|
|
static void gst_time_overlay_get_property (GObject * object, guint prop_id,
|
|
|
|
GValue * value, GParamSpec * pspec);
|
|
|
|
|
|
|
|
#define GST_TYPE_TIME_OVERLAY_TIME_LINE (gst_time_overlay_time_line_type())
|
|
|
|
static GType
|
|
|
|
gst_time_overlay_time_line_type (void)
|
|
|
|
{
|
|
|
|
static GType time_line_type = 0;
|
|
|
|
static const GEnumValue modes[] = {
|
|
|
|
{GST_TIME_OVERLAY_TIME_LINE_BUFFER_TIME, "buffer-time", "buffer-time"},
|
|
|
|
{GST_TIME_OVERLAY_TIME_LINE_STREAM_TIME, "stream-time", "stream-time"},
|
|
|
|
{GST_TIME_OVERLAY_TIME_LINE_RUNNING_TIME, "running-time", "running-time"},
|
2016-05-18 16:30:52 +00:00
|
|
|
{GST_TIME_OVERLAY_TIME_LINE_TIME_CODE, "time-code", "time-code"},
|
2014-11-25 14:45:23 +00:00
|
|
|
{0, NULL, NULL},
|
|
|
|
};
|
|
|
|
|
|
|
|
if (!time_line_type) {
|
|
|
|
time_line_type = g_enum_register_static ("GstTimeOverlayTimeLine", modes);
|
|
|
|
}
|
|
|
|
return time_line_type;
|
|
|
|
}
|
|
|
|
|
Port pango-based textoverlay, timeoverlay and textrender to 0.9 and add background shading and text wrapping modes. M...
Original commit message from CVS:
* configure.ac:
* ext/Makefile.am:
* ext/pango/Makefile.am:
* ext/pango/gstclockoverlay.c: (gst_clock_overlay_base_init),
(gst_clock_overlay_render_time), (gst_clock_overlay_get_text),
(gst_clock_overlay_class_init), (gst_clock_overlay_init):
* ext/pango/gstclockoverlay.h:
* ext/pango/gsttextoverlay.c: (gst_text_overlay_base_init),
(gst_text_overlay_get_text), (gst_text_overlay_class_init),
(gst_text_overlay_finalize), (gst_text_overlay_init),
(gst_text_overlay_update_wrap_mode), (gst_text_overlay_setcaps),
(gst_text_overlay_text_pad_linked),
(gst_text_overlay_text_pad_unlinked),
(gst_text_overlay_set_property), (gst_text_overlay_getcaps),
(gst_text_overlay_shade_y), (gst_text_overlay_blit_yuv420),
(gst_text_overlay_resize_bitmap), (gst_text_overlay_render_text),
(gst_text_overlay_push_frame), (gst_text_overlay_pop_video),
(gst_text_overlay_pop_text), (gst_text_overlay_collected),
(gst_text_overlay_change_state), (plugin_init):
* ext/pango/gsttextoverlay.h:
* ext/pango/gsttimeoverlay.c: (gst_time_overlay_base_init),
(gst_time_overlay_render_time), (gst_time_overlay_get_text),
(gst_time_overlay_class_init), (gst_time_overlay_init):
* ext/pango/gsttimeoverlay.h:
Port pango-based textoverlay, timeoverlay and textrender to 0.9
and add background shading and text wrapping modes. Make
timoverlay derive from textoverlay. Also add new clockoverlay
element.
2005-11-30 13:20:57 +00:00
|
|
|
static gchar *
|
|
|
|
gst_time_overlay_render_time (GstTimeOverlay * overlay, GstClockTime time)
|
2003-11-02 01:21:38 +00:00
|
|
|
{
|
Port pango-based textoverlay, timeoverlay and textrender to 0.9 and add background shading and text wrapping modes. M...
Original commit message from CVS:
* configure.ac:
* ext/Makefile.am:
* ext/pango/Makefile.am:
* ext/pango/gstclockoverlay.c: (gst_clock_overlay_base_init),
(gst_clock_overlay_render_time), (gst_clock_overlay_get_text),
(gst_clock_overlay_class_init), (gst_clock_overlay_init):
* ext/pango/gstclockoverlay.h:
* ext/pango/gsttextoverlay.c: (gst_text_overlay_base_init),
(gst_text_overlay_get_text), (gst_text_overlay_class_init),
(gst_text_overlay_finalize), (gst_text_overlay_init),
(gst_text_overlay_update_wrap_mode), (gst_text_overlay_setcaps),
(gst_text_overlay_text_pad_linked),
(gst_text_overlay_text_pad_unlinked),
(gst_text_overlay_set_property), (gst_text_overlay_getcaps),
(gst_text_overlay_shade_y), (gst_text_overlay_blit_yuv420),
(gst_text_overlay_resize_bitmap), (gst_text_overlay_render_text),
(gst_text_overlay_push_frame), (gst_text_overlay_pop_video),
(gst_text_overlay_pop_text), (gst_text_overlay_collected),
(gst_text_overlay_change_state), (plugin_init):
* ext/pango/gsttextoverlay.h:
* ext/pango/gsttimeoverlay.c: (gst_time_overlay_base_init),
(gst_time_overlay_render_time), (gst_time_overlay_get_text),
(gst_time_overlay_class_init), (gst_time_overlay_init):
* ext/pango/gsttimeoverlay.h:
Port pango-based textoverlay, timeoverlay and textrender to 0.9
and add background shading and text wrapping modes. Make
timoverlay derive from textoverlay. Also add new clockoverlay
element.
2005-11-30 13:20:57 +00:00
|
|
|
guint hours, mins, secs, msecs;
|
2004-03-14 22:34:34 +00:00
|
|
|
|
Port pango-based textoverlay, timeoverlay and textrender to 0.9 and add background shading and text wrapping modes. M...
Original commit message from CVS:
* configure.ac:
* ext/Makefile.am:
* ext/pango/Makefile.am:
* ext/pango/gstclockoverlay.c: (gst_clock_overlay_base_init),
(gst_clock_overlay_render_time), (gst_clock_overlay_get_text),
(gst_clock_overlay_class_init), (gst_clock_overlay_init):
* ext/pango/gstclockoverlay.h:
* ext/pango/gsttextoverlay.c: (gst_text_overlay_base_init),
(gst_text_overlay_get_text), (gst_text_overlay_class_init),
(gst_text_overlay_finalize), (gst_text_overlay_init),
(gst_text_overlay_update_wrap_mode), (gst_text_overlay_setcaps),
(gst_text_overlay_text_pad_linked),
(gst_text_overlay_text_pad_unlinked),
(gst_text_overlay_set_property), (gst_text_overlay_getcaps),
(gst_text_overlay_shade_y), (gst_text_overlay_blit_yuv420),
(gst_text_overlay_resize_bitmap), (gst_text_overlay_render_text),
(gst_text_overlay_push_frame), (gst_text_overlay_pop_video),
(gst_text_overlay_pop_text), (gst_text_overlay_collected),
(gst_text_overlay_change_state), (plugin_init):
* ext/pango/gsttextoverlay.h:
* ext/pango/gsttimeoverlay.c: (gst_time_overlay_base_init),
(gst_time_overlay_render_time), (gst_time_overlay_get_text),
(gst_time_overlay_class_init), (gst_time_overlay_init):
* ext/pango/gsttimeoverlay.h:
Port pango-based textoverlay, timeoverlay and textrender to 0.9
and add background shading and text wrapping modes. Make
timoverlay derive from textoverlay. Also add new clockoverlay
element.
2005-11-30 13:20:57 +00:00
|
|
|
if (!GST_CLOCK_TIME_IS_VALID (time))
|
|
|
|
return g_strdup ("");
|
2003-11-09 15:44:25 +00:00
|
|
|
|
Port pango-based textoverlay, timeoverlay and textrender to 0.9 and add background shading and text wrapping modes. M...
Original commit message from CVS:
* configure.ac:
* ext/Makefile.am:
* ext/pango/Makefile.am:
* ext/pango/gstclockoverlay.c: (gst_clock_overlay_base_init),
(gst_clock_overlay_render_time), (gst_clock_overlay_get_text),
(gst_clock_overlay_class_init), (gst_clock_overlay_init):
* ext/pango/gstclockoverlay.h:
* ext/pango/gsttextoverlay.c: (gst_text_overlay_base_init),
(gst_text_overlay_get_text), (gst_text_overlay_class_init),
(gst_text_overlay_finalize), (gst_text_overlay_init),
(gst_text_overlay_update_wrap_mode), (gst_text_overlay_setcaps),
(gst_text_overlay_text_pad_linked),
(gst_text_overlay_text_pad_unlinked),
(gst_text_overlay_set_property), (gst_text_overlay_getcaps),
(gst_text_overlay_shade_y), (gst_text_overlay_blit_yuv420),
(gst_text_overlay_resize_bitmap), (gst_text_overlay_render_text),
(gst_text_overlay_push_frame), (gst_text_overlay_pop_video),
(gst_text_overlay_pop_text), (gst_text_overlay_collected),
(gst_text_overlay_change_state), (plugin_init):
* ext/pango/gsttextoverlay.h:
* ext/pango/gsttimeoverlay.c: (gst_time_overlay_base_init),
(gst_time_overlay_render_time), (gst_time_overlay_get_text),
(gst_time_overlay_class_init), (gst_time_overlay_init):
* ext/pango/gsttimeoverlay.h:
Port pango-based textoverlay, timeoverlay and textrender to 0.9
and add background shading and text wrapping modes. Make
timoverlay derive from textoverlay. Also add new clockoverlay
element.
2005-11-30 13:20:57 +00:00
|
|
|
hours = (guint) (time / (GST_SECOND * 60 * 60));
|
|
|
|
mins = (guint) ((time / (GST_SECOND * 60)) % 60);
|
|
|
|
secs = (guint) ((time / GST_SECOND) % 60);
|
|
|
|
msecs = (guint) ((time % GST_SECOND) / (1000 * 1000));
|
2003-11-10 18:42:32 +00:00
|
|
|
|
Port pango-based textoverlay, timeoverlay and textrender to 0.9 and add background shading and text wrapping modes. M...
Original commit message from CVS:
* configure.ac:
* ext/Makefile.am:
* ext/pango/Makefile.am:
* ext/pango/gstclockoverlay.c: (gst_clock_overlay_base_init),
(gst_clock_overlay_render_time), (gst_clock_overlay_get_text),
(gst_clock_overlay_class_init), (gst_clock_overlay_init):
* ext/pango/gstclockoverlay.h:
* ext/pango/gsttextoverlay.c: (gst_text_overlay_base_init),
(gst_text_overlay_get_text), (gst_text_overlay_class_init),
(gst_text_overlay_finalize), (gst_text_overlay_init),
(gst_text_overlay_update_wrap_mode), (gst_text_overlay_setcaps),
(gst_text_overlay_text_pad_linked),
(gst_text_overlay_text_pad_unlinked),
(gst_text_overlay_set_property), (gst_text_overlay_getcaps),
(gst_text_overlay_shade_y), (gst_text_overlay_blit_yuv420),
(gst_text_overlay_resize_bitmap), (gst_text_overlay_render_text),
(gst_text_overlay_push_frame), (gst_text_overlay_pop_video),
(gst_text_overlay_pop_text), (gst_text_overlay_collected),
(gst_text_overlay_change_state), (plugin_init):
* ext/pango/gsttextoverlay.h:
* ext/pango/gsttimeoverlay.c: (gst_time_overlay_base_init),
(gst_time_overlay_render_time), (gst_time_overlay_get_text),
(gst_time_overlay_class_init), (gst_time_overlay_init):
* ext/pango/gsttimeoverlay.h:
Port pango-based textoverlay, timeoverlay and textrender to 0.9
and add background shading and text wrapping modes. Make
timoverlay derive from textoverlay. Also add new clockoverlay
element.
2005-11-30 13:20:57 +00:00
|
|
|
return g_strdup_printf ("%u:%02u:%02u.%03u", hours, mins, secs, msecs);
|
2003-11-02 01:21:38 +00:00
|
|
|
}
|
|
|
|
|
2006-02-18 19:53:48 +00:00
|
|
|
/* Called with lock held */
|
Port pango-based textoverlay, timeoverlay and textrender to 0.9 and add background shading and text wrapping modes. M...
Original commit message from CVS:
* configure.ac:
* ext/Makefile.am:
* ext/pango/Makefile.am:
* ext/pango/gstclockoverlay.c: (gst_clock_overlay_base_init),
(gst_clock_overlay_render_time), (gst_clock_overlay_get_text),
(gst_clock_overlay_class_init), (gst_clock_overlay_init):
* ext/pango/gstclockoverlay.h:
* ext/pango/gsttextoverlay.c: (gst_text_overlay_base_init),
(gst_text_overlay_get_text), (gst_text_overlay_class_init),
(gst_text_overlay_finalize), (gst_text_overlay_init),
(gst_text_overlay_update_wrap_mode), (gst_text_overlay_setcaps),
(gst_text_overlay_text_pad_linked),
(gst_text_overlay_text_pad_unlinked),
(gst_text_overlay_set_property), (gst_text_overlay_getcaps),
(gst_text_overlay_shade_y), (gst_text_overlay_blit_yuv420),
(gst_text_overlay_resize_bitmap), (gst_text_overlay_render_text),
(gst_text_overlay_push_frame), (gst_text_overlay_pop_video),
(gst_text_overlay_pop_text), (gst_text_overlay_collected),
(gst_text_overlay_change_state), (plugin_init):
* ext/pango/gsttextoverlay.h:
* ext/pango/gsttimeoverlay.c: (gst_time_overlay_base_init),
(gst_time_overlay_render_time), (gst_time_overlay_get_text),
(gst_time_overlay_class_init), (gst_time_overlay_init):
* ext/pango/gsttimeoverlay.h:
Port pango-based textoverlay, timeoverlay and textrender to 0.9
and add background shading and text wrapping modes. Make
timoverlay derive from textoverlay. Also add new clockoverlay
element.
2005-11-30 13:20:57 +00:00
|
|
|
static gchar *
|
2011-04-16 13:56:55 +00:00
|
|
|
gst_time_overlay_get_text (GstBaseTextOverlay * overlay,
|
|
|
|
GstBuffer * video_frame)
|
2003-11-02 01:21:38 +00:00
|
|
|
{
|
2019-07-10 12:00:56 +00:00
|
|
|
GstTimeOverlay *self = GST_TIME_OVERLAY (overlay);
|
2014-11-25 14:45:23 +00:00
|
|
|
GstTimeOverlayTimeLine time_line;
|
Port pango-based textoverlay, timeoverlay and textrender to 0.9 and add background shading and text wrapping modes. M...
Original commit message from CVS:
* configure.ac:
* ext/Makefile.am:
* ext/pango/Makefile.am:
* ext/pango/gstclockoverlay.c: (gst_clock_overlay_base_init),
(gst_clock_overlay_render_time), (gst_clock_overlay_get_text),
(gst_clock_overlay_class_init), (gst_clock_overlay_init):
* ext/pango/gstclockoverlay.h:
* ext/pango/gsttextoverlay.c: (gst_text_overlay_base_init),
(gst_text_overlay_get_text), (gst_text_overlay_class_init),
(gst_text_overlay_finalize), (gst_text_overlay_init),
(gst_text_overlay_update_wrap_mode), (gst_text_overlay_setcaps),
(gst_text_overlay_text_pad_linked),
(gst_text_overlay_text_pad_unlinked),
(gst_text_overlay_set_property), (gst_text_overlay_getcaps),
(gst_text_overlay_shade_y), (gst_text_overlay_blit_yuv420),
(gst_text_overlay_resize_bitmap), (gst_text_overlay_render_text),
(gst_text_overlay_push_frame), (gst_text_overlay_pop_video),
(gst_text_overlay_pop_text), (gst_text_overlay_collected),
(gst_text_overlay_change_state), (plugin_init):
* ext/pango/gsttextoverlay.h:
* ext/pango/gsttimeoverlay.c: (gst_time_overlay_base_init),
(gst_time_overlay_render_time), (gst_time_overlay_get_text),
(gst_time_overlay_class_init), (gst_time_overlay_init):
* ext/pango/gsttimeoverlay.h:
Port pango-based textoverlay, timeoverlay and textrender to 0.9
and add background shading and text wrapping modes. Make
timoverlay derive from textoverlay. Also add new clockoverlay
element.
2005-11-30 13:20:57 +00:00
|
|
|
gchar *time_str, *txt, *ret;
|
2003-11-02 01:21:38 +00:00
|
|
|
|
Port pango-based textoverlay, timeoverlay and textrender to 0.9 and add background shading and text wrapping modes. M...
Original commit message from CVS:
* configure.ac:
* ext/Makefile.am:
* ext/pango/Makefile.am:
* ext/pango/gstclockoverlay.c: (gst_clock_overlay_base_init),
(gst_clock_overlay_render_time), (gst_clock_overlay_get_text),
(gst_clock_overlay_class_init), (gst_clock_overlay_init):
* ext/pango/gstclockoverlay.h:
* ext/pango/gsttextoverlay.c: (gst_text_overlay_base_init),
(gst_text_overlay_get_text), (gst_text_overlay_class_init),
(gst_text_overlay_finalize), (gst_text_overlay_init),
(gst_text_overlay_update_wrap_mode), (gst_text_overlay_setcaps),
(gst_text_overlay_text_pad_linked),
(gst_text_overlay_text_pad_unlinked),
(gst_text_overlay_set_property), (gst_text_overlay_getcaps),
(gst_text_overlay_shade_y), (gst_text_overlay_blit_yuv420),
(gst_text_overlay_resize_bitmap), (gst_text_overlay_render_text),
(gst_text_overlay_push_frame), (gst_text_overlay_pop_video),
(gst_text_overlay_pop_text), (gst_text_overlay_collected),
(gst_text_overlay_change_state), (plugin_init):
* ext/pango/gsttextoverlay.h:
* ext/pango/gsttimeoverlay.c: (gst_time_overlay_base_init),
(gst_time_overlay_render_time), (gst_time_overlay_get_text),
(gst_time_overlay_class_init), (gst_time_overlay_init):
* ext/pango/gsttimeoverlay.h:
Port pango-based textoverlay, timeoverlay and textrender to 0.9
and add background shading and text wrapping modes. Make
timoverlay derive from textoverlay. Also add new clockoverlay
element.
2005-11-30 13:20:57 +00:00
|
|
|
overlay->need_render = TRUE;
|
2003-11-02 01:21:38 +00:00
|
|
|
|
2014-11-25 14:45:23 +00:00
|
|
|
time_line = g_atomic_int_get (&GST_TIME_OVERLAY_CAST (overlay)->time_line);
|
2016-05-18 16:30:52 +00:00
|
|
|
if (time_line == GST_TIME_OVERLAY_TIME_LINE_TIME_CODE) {
|
|
|
|
GstVideoTimeCodeMeta *tc_meta =
|
|
|
|
gst_buffer_get_video_time_code_meta (video_frame);
|
|
|
|
if (!tc_meta) {
|
|
|
|
GST_DEBUG ("buffer without valid timecode");
|
|
|
|
return g_strdup ("00:00:00:00");
|
|
|
|
}
|
|
|
|
time_str = gst_video_time_code_to_string (&tc_meta->tc);
|
|
|
|
GST_DEBUG ("buffer with timecode %s", time_str);
|
|
|
|
} else {
|
|
|
|
GstClockTime ts, ts_buffer;
|
|
|
|
GstSegment *segment = &overlay->segment;
|
|
|
|
|
|
|
|
ts_buffer = GST_BUFFER_TIMESTAMP (video_frame);
|
|
|
|
|
|
|
|
if (!GST_CLOCK_TIME_IS_VALID (ts_buffer)) {
|
|
|
|
GST_DEBUG ("buffer without valid timestamp");
|
|
|
|
return g_strdup ("");
|
|
|
|
}
|
|
|
|
|
|
|
|
GST_DEBUG ("buffer with timestamp %" GST_TIME_FORMAT,
|
|
|
|
GST_TIME_ARGS (ts_buffer));
|
|
|
|
|
|
|
|
switch (time_line) {
|
|
|
|
case GST_TIME_OVERLAY_TIME_LINE_STREAM_TIME:
|
|
|
|
ts = gst_segment_to_stream_time (segment, GST_FORMAT_TIME, ts_buffer);
|
|
|
|
break;
|
|
|
|
case GST_TIME_OVERLAY_TIME_LINE_RUNNING_TIME:
|
|
|
|
ts = gst_segment_to_running_time (segment, GST_FORMAT_TIME, ts_buffer);
|
|
|
|
break;
|
|
|
|
case GST_TIME_OVERLAY_TIME_LINE_BUFFER_TIME:
|
|
|
|
default:
|
|
|
|
ts = ts_buffer;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2019-07-10 12:00:56 +00:00
|
|
|
if (self->show_times_as_dates) {
|
|
|
|
GDateTime *datetime;
|
|
|
|
|
|
|
|
datetime =
|
|
|
|
g_date_time_add_seconds (self->datetime_epoch,
|
|
|
|
(gdouble) GST_BUFFER_TIMESTAMP (video_frame) / GST_SECOND);
|
|
|
|
time_str = g_date_time_format (datetime, self->datetime_format);
|
|
|
|
g_date_time_unref (datetime);
|
|
|
|
} else {
|
|
|
|
time_str = gst_time_overlay_render_time (GST_TIME_OVERLAY (overlay), ts);
|
|
|
|
}
|
2014-11-25 14:45:23 +00:00
|
|
|
}
|
2019-07-10 12:00:56 +00:00
|
|
|
|
Port pango-based textoverlay, timeoverlay and textrender to 0.9 and add background shading and text wrapping modes. M...
Original commit message from CVS:
* configure.ac:
* ext/Makefile.am:
* ext/pango/Makefile.am:
* ext/pango/gstclockoverlay.c: (gst_clock_overlay_base_init),
(gst_clock_overlay_render_time), (gst_clock_overlay_get_text),
(gst_clock_overlay_class_init), (gst_clock_overlay_init):
* ext/pango/gstclockoverlay.h:
* ext/pango/gsttextoverlay.c: (gst_text_overlay_base_init),
(gst_text_overlay_get_text), (gst_text_overlay_class_init),
(gst_text_overlay_finalize), (gst_text_overlay_init),
(gst_text_overlay_update_wrap_mode), (gst_text_overlay_setcaps),
(gst_text_overlay_text_pad_linked),
(gst_text_overlay_text_pad_unlinked),
(gst_text_overlay_set_property), (gst_text_overlay_getcaps),
(gst_text_overlay_shade_y), (gst_text_overlay_blit_yuv420),
(gst_text_overlay_resize_bitmap), (gst_text_overlay_render_text),
(gst_text_overlay_push_frame), (gst_text_overlay_pop_video),
(gst_text_overlay_pop_text), (gst_text_overlay_collected),
(gst_text_overlay_change_state), (plugin_init):
* ext/pango/gsttextoverlay.h:
* ext/pango/gsttimeoverlay.c: (gst_time_overlay_base_init),
(gst_time_overlay_render_time), (gst_time_overlay_get_text),
(gst_time_overlay_class_init), (gst_time_overlay_init):
* ext/pango/gsttimeoverlay.h:
Port pango-based textoverlay, timeoverlay and textrender to 0.9
and add background shading and text wrapping modes. Make
timoverlay derive from textoverlay. Also add new clockoverlay
element.
2005-11-30 13:20:57 +00:00
|
|
|
txt = g_strdup (overlay->default_text);
|
2003-11-02 01:21:38 +00:00
|
|
|
|
Port pango-based textoverlay, timeoverlay and textrender to 0.9 and add background shading and text wrapping modes. M...
Original commit message from CVS:
* configure.ac:
* ext/Makefile.am:
* ext/pango/Makefile.am:
* ext/pango/gstclockoverlay.c: (gst_clock_overlay_base_init),
(gst_clock_overlay_render_time), (gst_clock_overlay_get_text),
(gst_clock_overlay_class_init), (gst_clock_overlay_init):
* ext/pango/gstclockoverlay.h:
* ext/pango/gsttextoverlay.c: (gst_text_overlay_base_init),
(gst_text_overlay_get_text), (gst_text_overlay_class_init),
(gst_text_overlay_finalize), (gst_text_overlay_init),
(gst_text_overlay_update_wrap_mode), (gst_text_overlay_setcaps),
(gst_text_overlay_text_pad_linked),
(gst_text_overlay_text_pad_unlinked),
(gst_text_overlay_set_property), (gst_text_overlay_getcaps),
(gst_text_overlay_shade_y), (gst_text_overlay_blit_yuv420),
(gst_text_overlay_resize_bitmap), (gst_text_overlay_render_text),
(gst_text_overlay_push_frame), (gst_text_overlay_pop_video),
(gst_text_overlay_pop_text), (gst_text_overlay_collected),
(gst_text_overlay_change_state), (plugin_init):
* ext/pango/gsttextoverlay.h:
* ext/pango/gsttimeoverlay.c: (gst_time_overlay_base_init),
(gst_time_overlay_render_time), (gst_time_overlay_get_text),
(gst_time_overlay_class_init), (gst_time_overlay_init):
* ext/pango/gsttimeoverlay.h:
Port pango-based textoverlay, timeoverlay and textrender to 0.9
and add background shading and text wrapping modes. Make
timoverlay derive from textoverlay. Also add new clockoverlay
element.
2005-11-30 13:20:57 +00:00
|
|
|
if (txt != NULL && *txt != '\0') {
|
|
|
|
ret = g_strdup_printf ("%s %s", txt, time_str);
|
|
|
|
} else {
|
|
|
|
ret = time_str;
|
|
|
|
time_str = NULL;
|
|
|
|
}
|
2003-07-02 08:07:24 +00:00
|
|
|
|
Port pango-based textoverlay, timeoverlay and textrender to 0.9 and add background shading and text wrapping modes. M...
Original commit message from CVS:
* configure.ac:
* ext/Makefile.am:
* ext/pango/Makefile.am:
* ext/pango/gstclockoverlay.c: (gst_clock_overlay_base_init),
(gst_clock_overlay_render_time), (gst_clock_overlay_get_text),
(gst_clock_overlay_class_init), (gst_clock_overlay_init):
* ext/pango/gstclockoverlay.h:
* ext/pango/gsttextoverlay.c: (gst_text_overlay_base_init),
(gst_text_overlay_get_text), (gst_text_overlay_class_init),
(gst_text_overlay_finalize), (gst_text_overlay_init),
(gst_text_overlay_update_wrap_mode), (gst_text_overlay_setcaps),
(gst_text_overlay_text_pad_linked),
(gst_text_overlay_text_pad_unlinked),
(gst_text_overlay_set_property), (gst_text_overlay_getcaps),
(gst_text_overlay_shade_y), (gst_text_overlay_blit_yuv420),
(gst_text_overlay_resize_bitmap), (gst_text_overlay_render_text),
(gst_text_overlay_push_frame), (gst_text_overlay_pop_video),
(gst_text_overlay_pop_text), (gst_text_overlay_collected),
(gst_text_overlay_change_state), (plugin_init):
* ext/pango/gsttextoverlay.h:
* ext/pango/gsttimeoverlay.c: (gst_time_overlay_base_init),
(gst_time_overlay_render_time), (gst_time_overlay_get_text),
(gst_time_overlay_class_init), (gst_time_overlay_init):
* ext/pango/gsttimeoverlay.h:
Port pango-based textoverlay, timeoverlay and textrender to 0.9
and add background shading and text wrapping modes. Make
timoverlay derive from textoverlay. Also add new clockoverlay
element.
2005-11-30 13:20:57 +00:00
|
|
|
g_free (txt);
|
|
|
|
g_free (time_str);
|
2003-07-02 08:07:24 +00:00
|
|
|
|
Port pango-based textoverlay, timeoverlay and textrender to 0.9 and add background shading and text wrapping modes. M...
Original commit message from CVS:
* configure.ac:
* ext/Makefile.am:
* ext/pango/Makefile.am:
* ext/pango/gstclockoverlay.c: (gst_clock_overlay_base_init),
(gst_clock_overlay_render_time), (gst_clock_overlay_get_text),
(gst_clock_overlay_class_init), (gst_clock_overlay_init):
* ext/pango/gstclockoverlay.h:
* ext/pango/gsttextoverlay.c: (gst_text_overlay_base_init),
(gst_text_overlay_get_text), (gst_text_overlay_class_init),
(gst_text_overlay_finalize), (gst_text_overlay_init),
(gst_text_overlay_update_wrap_mode), (gst_text_overlay_setcaps),
(gst_text_overlay_text_pad_linked),
(gst_text_overlay_text_pad_unlinked),
(gst_text_overlay_set_property), (gst_text_overlay_getcaps),
(gst_text_overlay_shade_y), (gst_text_overlay_blit_yuv420),
(gst_text_overlay_resize_bitmap), (gst_text_overlay_render_text),
(gst_text_overlay_push_frame), (gst_text_overlay_pop_video),
(gst_text_overlay_pop_text), (gst_text_overlay_collected),
(gst_text_overlay_change_state), (plugin_init):
* ext/pango/gsttextoverlay.h:
* ext/pango/gsttimeoverlay.c: (gst_time_overlay_base_init),
(gst_time_overlay_render_time), (gst_time_overlay_get_text),
(gst_time_overlay_class_init), (gst_time_overlay_init):
* ext/pango/gsttimeoverlay.h:
Port pango-based textoverlay, timeoverlay and textrender to 0.9
and add background shading and text wrapping modes. Make
timoverlay derive from textoverlay. Also add new clockoverlay
element.
2005-11-30 13:20:57 +00:00
|
|
|
return ret;
|
2003-07-02 08:07:24 +00:00
|
|
|
}
|
|
|
|
|
2019-07-10 12:00:56 +00:00
|
|
|
static void
|
|
|
|
gst_time_overlay_finalize (GObject * gobject)
|
|
|
|
{
|
|
|
|
GstTimeOverlay *self = GST_TIME_OVERLAY (gobject);
|
|
|
|
|
|
|
|
g_date_time_unref (self->datetime_epoch);
|
|
|
|
g_free (self->datetime_format);
|
2019-08-07 18:18:34 +00:00
|
|
|
G_OBJECT_CLASS (parent_class)->finalize (gobject);
|
2019-07-10 12:00:56 +00:00
|
|
|
}
|
|
|
|
|
2003-07-02 08:07:24 +00:00
|
|
|
static void
|
Port pango-based textoverlay, timeoverlay and textrender to 0.9 and add background shading and text wrapping modes. M...
Original commit message from CVS:
* configure.ac:
* ext/Makefile.am:
* ext/pango/Makefile.am:
* ext/pango/gstclockoverlay.c: (gst_clock_overlay_base_init),
(gst_clock_overlay_render_time), (gst_clock_overlay_get_text),
(gst_clock_overlay_class_init), (gst_clock_overlay_init):
* ext/pango/gstclockoverlay.h:
* ext/pango/gsttextoverlay.c: (gst_text_overlay_base_init),
(gst_text_overlay_get_text), (gst_text_overlay_class_init),
(gst_text_overlay_finalize), (gst_text_overlay_init),
(gst_text_overlay_update_wrap_mode), (gst_text_overlay_setcaps),
(gst_text_overlay_text_pad_linked),
(gst_text_overlay_text_pad_unlinked),
(gst_text_overlay_set_property), (gst_text_overlay_getcaps),
(gst_text_overlay_shade_y), (gst_text_overlay_blit_yuv420),
(gst_text_overlay_resize_bitmap), (gst_text_overlay_render_text),
(gst_text_overlay_push_frame), (gst_text_overlay_pop_video),
(gst_text_overlay_pop_text), (gst_text_overlay_collected),
(gst_text_overlay_change_state), (plugin_init):
* ext/pango/gsttextoverlay.h:
* ext/pango/gsttimeoverlay.c: (gst_time_overlay_base_init),
(gst_time_overlay_render_time), (gst_time_overlay_get_text),
(gst_time_overlay_class_init), (gst_time_overlay_init):
* ext/pango/gsttimeoverlay.h:
Port pango-based textoverlay, timeoverlay and textrender to 0.9
and add background shading and text wrapping modes. Make
timoverlay derive from textoverlay. Also add new clockoverlay
element.
2005-11-30 13:20:57 +00:00
|
|
|
gst_time_overlay_class_init (GstTimeOverlayClass * klass)
|
2003-07-02 08:07:24 +00:00
|
|
|
{
|
2011-04-19 12:11:32 +00:00
|
|
|
GstElementClass *gstelement_class;
|
2011-04-16 13:56:55 +00:00
|
|
|
GstBaseTextOverlayClass *gsttextoverlay_class;
|
2014-11-25 14:45:23 +00:00
|
|
|
GObjectClass *gobject_class;
|
2003-07-02 08:07:24 +00:00
|
|
|
|
2011-04-16 13:56:55 +00:00
|
|
|
gsttextoverlay_class = (GstBaseTextOverlayClass *) klass;
|
2011-04-19 12:11:32 +00:00
|
|
|
gstelement_class = (GstElementClass *) klass;
|
2014-11-25 14:45:23 +00:00
|
|
|
gobject_class = (GObjectClass *) klass;
|
2011-04-19 12:11:32 +00:00
|
|
|
|
2012-04-09 23:45:16 +00:00
|
|
|
gst_element_class_set_static_metadata (gstelement_class, "Time overlay",
|
2011-04-19 12:11:32 +00:00
|
|
|
"Filter/Editor/Video",
|
|
|
|
"Overlays buffer time stamps on a video stream",
|
|
|
|
"Tim-Philipp Müller <tim@centricular.net>");
|
2003-07-02 08:07:24 +00:00
|
|
|
|
Port pango-based textoverlay, timeoverlay and textrender to 0.9 and add background shading and text wrapping modes. M...
Original commit message from CVS:
* configure.ac:
* ext/Makefile.am:
* ext/pango/Makefile.am:
* ext/pango/gstclockoverlay.c: (gst_clock_overlay_base_init),
(gst_clock_overlay_render_time), (gst_clock_overlay_get_text),
(gst_clock_overlay_class_init), (gst_clock_overlay_init):
* ext/pango/gstclockoverlay.h:
* ext/pango/gsttextoverlay.c: (gst_text_overlay_base_init),
(gst_text_overlay_get_text), (gst_text_overlay_class_init),
(gst_text_overlay_finalize), (gst_text_overlay_init),
(gst_text_overlay_update_wrap_mode), (gst_text_overlay_setcaps),
(gst_text_overlay_text_pad_linked),
(gst_text_overlay_text_pad_unlinked),
(gst_text_overlay_set_property), (gst_text_overlay_getcaps),
(gst_text_overlay_shade_y), (gst_text_overlay_blit_yuv420),
(gst_text_overlay_resize_bitmap), (gst_text_overlay_render_text),
(gst_text_overlay_push_frame), (gst_text_overlay_pop_video),
(gst_text_overlay_pop_text), (gst_text_overlay_collected),
(gst_text_overlay_change_state), (plugin_init):
* ext/pango/gsttextoverlay.h:
* ext/pango/gsttimeoverlay.c: (gst_time_overlay_base_init),
(gst_time_overlay_render_time), (gst_time_overlay_get_text),
(gst_time_overlay_class_init), (gst_time_overlay_init):
* ext/pango/gsttimeoverlay.h:
Port pango-based textoverlay, timeoverlay and textrender to 0.9
and add background shading and text wrapping modes. Make
timoverlay derive from textoverlay. Also add new clockoverlay
element.
2005-11-30 13:20:57 +00:00
|
|
|
gsttextoverlay_class->get_text = gst_time_overlay_get_text;
|
2003-07-02 08:07:24 +00:00
|
|
|
|
2019-07-10 12:00:56 +00:00
|
|
|
gobject_class->finalize = gst_time_overlay_finalize;
|
2014-11-25 14:45:23 +00:00
|
|
|
gobject_class->set_property = gst_time_overlay_set_property;
|
|
|
|
gobject_class->get_property = gst_time_overlay_get_property;
|
|
|
|
|
|
|
|
g_object_class_install_property (gobject_class, PROP_TIME_LINE,
|
|
|
|
g_param_spec_enum ("time-mode", "Time Mode", "What time to show",
|
|
|
|
GST_TYPE_TIME_OVERLAY_TIME_LINE, DEFAULT_TIME_LINE,
|
|
|
|
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
2019-07-10 12:00:56 +00:00
|
|
|
|
|
|
|
g_object_class_install_property (gobject_class, PROP_DATETIME_EPOCH,
|
|
|
|
g_param_spec_boxed ("datetime-epoch", "Datetime Epoch",
|
|
|
|
"When showing times as dates, the initial date from which time "
|
|
|
|
"is counted, if not specified prime epoch is used (1900-01-01)",
|
|
|
|
G_TYPE_DATE_TIME, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
|
|
|
|
|
|
|
g_object_class_install_property (gobject_class, PROP_DATETIME_FORMAT,
|
|
|
|
g_param_spec_string ("datetime-format", "Datetime Format",
|
|
|
|
"When showing times as dates, the format to render date and time in",
|
|
|
|
DEFAULT_DATETIME_FORMAT, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
|
|
|
|
|
|
|
g_object_class_install_property (gobject_class, PROP_SHOW_TIMES_AS_DATES,
|
|
|
|
g_param_spec_boolean ("show-times-as-dates", "Show times as dates",
|
|
|
|
"Whether to display times, counted from datetime-epoch, as dates",
|
|
|
|
DEFAULT_SHOW_TIMES_AS_DATES,
|
|
|
|
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
2020-05-29 00:43:59 +00:00
|
|
|
|
2020-06-05 22:41:17 +00:00
|
|
|
gst_type_mark_as_plugin_api (GST_TYPE_TIME_OVERLAY_TIME_LINE, 0);
|
2018-08-27 12:41:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gst_time_overlay_init (GstTimeOverlay * overlay)
|
|
|
|
{
|
|
|
|
GstBaseTextOverlay *textoverlay;
|
|
|
|
PangoContext *context;
|
|
|
|
PangoFontDescription *font_description;
|
|
|
|
|
|
|
|
textoverlay = GST_BASE_TEXT_OVERLAY (overlay);
|
|
|
|
|
|
|
|
textoverlay->valign = GST_BASE_TEXT_OVERLAY_VALIGN_TOP;
|
|
|
|
textoverlay->halign = GST_BASE_TEXT_OVERLAY_HALIGN_LEFT;
|
2014-11-25 14:45:23 +00:00
|
|
|
|
2018-08-27 12:41:31 +00:00
|
|
|
overlay->time_line = DEFAULT_TIME_LINE;
|
2019-07-10 12:00:56 +00:00
|
|
|
overlay->show_times_as_dates = DEFAULT_SHOW_TIMES_AS_DATES;
|
|
|
|
overlay->datetime_epoch = g_date_time_new_utc (1900, 1, 1, 0, 0, 0);
|
|
|
|
overlay->datetime_format = g_strdup (DEFAULT_DATETIME_FORMAT);
|
2018-08-27 12:41:31 +00:00
|
|
|
|
|
|
|
context = textoverlay->pango_context;
|
2003-07-02 08:07:24 +00:00
|
|
|
|
|
|
|
pango_context_set_language (context, pango_language_from_string ("en_US"));
|
|
|
|
pango_context_set_base_dir (context, PANGO_DIRECTION_LTR);
|
|
|
|
|
|
|
|
font_description = pango_font_description_new ();
|
2007-03-08 12:53:51 +00:00
|
|
|
pango_font_description_set_family_static (font_description, "Monospace");
|
2003-07-02 08:07:24 +00:00
|
|
|
pango_font_description_set_style (font_description, PANGO_STYLE_NORMAL);
|
|
|
|
pango_font_description_set_variant (font_description, PANGO_VARIANT_NORMAL);
|
|
|
|
pango_font_description_set_weight (font_description, PANGO_WEIGHT_NORMAL);
|
|
|
|
pango_font_description_set_stretch (font_description, PANGO_STRETCH_NORMAL);
|
Port pango-based textoverlay, timeoverlay and textrender to 0.9 and add background shading and text wrapping modes. M...
Original commit message from CVS:
* configure.ac:
* ext/Makefile.am:
* ext/pango/Makefile.am:
* ext/pango/gstclockoverlay.c: (gst_clock_overlay_base_init),
(gst_clock_overlay_render_time), (gst_clock_overlay_get_text),
(gst_clock_overlay_class_init), (gst_clock_overlay_init):
* ext/pango/gstclockoverlay.h:
* ext/pango/gsttextoverlay.c: (gst_text_overlay_base_init),
(gst_text_overlay_get_text), (gst_text_overlay_class_init),
(gst_text_overlay_finalize), (gst_text_overlay_init),
(gst_text_overlay_update_wrap_mode), (gst_text_overlay_setcaps),
(gst_text_overlay_text_pad_linked),
(gst_text_overlay_text_pad_unlinked),
(gst_text_overlay_set_property), (gst_text_overlay_getcaps),
(gst_text_overlay_shade_y), (gst_text_overlay_blit_yuv420),
(gst_text_overlay_resize_bitmap), (gst_text_overlay_render_text),
(gst_text_overlay_push_frame), (gst_text_overlay_pop_video),
(gst_text_overlay_pop_text), (gst_text_overlay_collected),
(gst_text_overlay_change_state), (plugin_init):
* ext/pango/gsttextoverlay.h:
* ext/pango/gsttimeoverlay.c: (gst_time_overlay_base_init),
(gst_time_overlay_render_time), (gst_time_overlay_get_text),
(gst_time_overlay_class_init), (gst_time_overlay_init):
* ext/pango/gsttimeoverlay.h:
Port pango-based textoverlay, timeoverlay and textrender to 0.9
and add background shading and text wrapping modes. Make
timoverlay derive from textoverlay. Also add new clockoverlay
element.
2005-11-30 13:20:57 +00:00
|
|
|
pango_font_description_set_size (font_description, 18 * PANGO_SCALE);
|
2003-07-02 08:07:24 +00:00
|
|
|
pango_context_set_font_description (context, font_description);
|
Port pango-based textoverlay, timeoverlay and textrender to 0.9 and add background shading and text wrapping modes. M...
Original commit message from CVS:
* configure.ac:
* ext/Makefile.am:
* ext/pango/Makefile.am:
* ext/pango/gstclockoverlay.c: (gst_clock_overlay_base_init),
(gst_clock_overlay_render_time), (gst_clock_overlay_get_text),
(gst_clock_overlay_class_init), (gst_clock_overlay_init):
* ext/pango/gstclockoverlay.h:
* ext/pango/gsttextoverlay.c: (gst_text_overlay_base_init),
(gst_text_overlay_get_text), (gst_text_overlay_class_init),
(gst_text_overlay_finalize), (gst_text_overlay_init),
(gst_text_overlay_update_wrap_mode), (gst_text_overlay_setcaps),
(gst_text_overlay_text_pad_linked),
(gst_text_overlay_text_pad_unlinked),
(gst_text_overlay_set_property), (gst_text_overlay_getcaps),
(gst_text_overlay_shade_y), (gst_text_overlay_blit_yuv420),
(gst_text_overlay_resize_bitmap), (gst_text_overlay_render_text),
(gst_text_overlay_push_frame), (gst_text_overlay_pop_video),
(gst_text_overlay_pop_text), (gst_text_overlay_collected),
(gst_text_overlay_change_state), (plugin_init):
* ext/pango/gsttextoverlay.h:
* ext/pango/gsttimeoverlay.c: (gst_time_overlay_base_init),
(gst_time_overlay_render_time), (gst_time_overlay_get_text),
(gst_time_overlay_class_init), (gst_time_overlay_init):
* ext/pango/gsttimeoverlay.h:
Port pango-based textoverlay, timeoverlay and textrender to 0.9
and add background shading and text wrapping modes. Make
timoverlay derive from textoverlay. Also add new clockoverlay
element.
2005-11-30 13:20:57 +00:00
|
|
|
pango_font_description_free (font_description);
|
2014-11-25 14:45:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gst_time_overlay_set_property (GObject * object, guint prop_id,
|
|
|
|
const GValue * value, GParamSpec * pspec)
|
|
|
|
{
|
|
|
|
GstTimeOverlay *overlay = GST_TIME_OVERLAY (object);
|
|
|
|
|
|
|
|
switch (prop_id) {
|
|
|
|
case PROP_TIME_LINE:
|
|
|
|
g_atomic_int_set (&overlay->time_line, g_value_get_enum (value));
|
|
|
|
break;
|
2019-07-10 12:00:56 +00:00
|
|
|
case PROP_SHOW_TIMES_AS_DATES:
|
|
|
|
overlay->show_times_as_dates = g_value_get_boolean (value);
|
|
|
|
break;
|
|
|
|
case PROP_DATETIME_EPOCH:
|
|
|
|
g_date_time_unref (overlay->datetime_epoch);
|
|
|
|
overlay->datetime_epoch = (GDateTime *) g_value_dup_boxed (value);
|
|
|
|
break;
|
|
|
|
case PROP_DATETIME_FORMAT:
|
|
|
|
g_free (overlay->datetime_format);
|
|
|
|
overlay->datetime_format = g_value_dup_string (value);
|
|
|
|
break;
|
2014-11-25 14:45:23 +00:00
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gst_time_overlay_get_property (GObject * object, guint prop_id,
|
|
|
|
GValue * value, GParamSpec * pspec)
|
|
|
|
{
|
|
|
|
GstTimeOverlay *overlay = GST_TIME_OVERLAY (object);
|
|
|
|
|
|
|
|
switch (prop_id) {
|
|
|
|
case PROP_TIME_LINE:
|
|
|
|
g_value_set_enum (value, g_atomic_int_get (&overlay->time_line));
|
|
|
|
break;
|
2019-07-10 12:00:56 +00:00
|
|
|
case PROP_SHOW_TIMES_AS_DATES:
|
|
|
|
g_value_set_boolean (value, overlay->show_times_as_dates);
|
|
|
|
break;
|
|
|
|
case PROP_DATETIME_EPOCH:
|
|
|
|
g_value_set_boxed (value, overlay->datetime_epoch);
|
|
|
|
break;
|
|
|
|
case PROP_DATETIME_FORMAT:
|
|
|
|
g_value_set_string (value, overlay->datetime_format);
|
|
|
|
break;
|
2014-11-25 14:45:23 +00:00
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
|
|
break;
|
|
|
|
}
|
2003-07-02 08:07:24 +00:00
|
|
|
}
|