move pango to base

Original commit message from CVS:
move pango to base
parent fe967d4f
2005-12-01 Thomas Vander Stichele <thomas (at) apestaart (dot) org>
* configure.ac:
* ext/Makefile.am:
* ext/pango/Makefile.am:
* ext/pango/gstclockoverlay.c:
* ext/pango/gstclockoverlay.h:
* ext/pango/gsttextoverlay.c:
* ext/pango/gsttextoverlay.h:
* ext/pango/gsttextrender.c:
* ext/pango/gsttextrender.h:
* ext/pango/gsttimeoverlay.c:
* ext/pango/gsttimeoverlay.h:
move pango to base
2005-12-01 Thomas Vander Stichele <thomas (at) apestaart (dot) org>
* gst/rtp/Makefile.am:
......
......@@ -413,15 +413,6 @@ GST_CHECK_FEATURE(DV1394, [raw1394 and avc1394 library], dv1394src, [
fi
])
dnl *** pango ***
translit(dnm, m, l) AM_CONDITIONAL(USE_PANGO, true)
GST_CHECK_FEATURE(PANGO, [pango], pango, [
PKG_CHECK_MODULES(PANGO, pango pangoft2,
HAVE_PANGO="yes", HAVE_PANGO="no")
AC_SUBST(PANGO_CFLAGS)
AC_SUBST(PANGO_LIBS)
])
dnl *** shout2 ***
translit(dnm, m, l) AM_CONDITIONAL(USE_SHOUT2, true)
GST_CHECK_FEATURE(SHOUT2, [shout2 plug-in], shout2send, [
......@@ -566,7 +557,6 @@ ext/gconf/Makefile
ext/ladspa/Makefile
ext/libcaca/Makefile
ext/libpng/Makefile
ext/pango/Makefile
ext/raw1394/Makefile
ext/shout2/Makefile
ext/speex/Makefile
......
......@@ -76,12 +76,6 @@ endif
MIKMOD_DIR =
# endif
if USE_PANGO
PANGO_DIR = pango
else
PANGO_DIR =
endif
if USE_DV1394
DV1394_DIR = raw1394
else
......@@ -115,7 +109,6 @@ SUBDIRS = \
$(LIBMNG_DIR) \
$(LIBPNG_DIR) \
$(MIKMOD_DIR) \
$(PANGO_DIR) \
$(SHOUT2_DIR) \
$(SPEEX_DIR)
......@@ -130,7 +123,6 @@ DIST_SUBDIRS = \
ladspa \
libcaca \
libpng \
pango \
raw1394 \
shout2 \
speex
plugin_LTLIBRARIES = libgstpango.la
noinst_HEADERS = \
gstclockoverlay.h \
gsttextoverlay.h \
gsttextrender.h \
gsttimeoverlay.h
libgstpango_la_SOURCES = \
gstclockoverlay.c \
gsttextoverlay.c \
gsttextrender.c \
gsttimeoverlay.c
libgstpango_la_CFLAGS = \
$(GST_PLUGINS_BASE_CFLAGS) \
$(GST_BASE_CFLAGS) \
$(GST_CFLAGS) \
$(PANGO_CFLAGS)
libgstpango_la_LIBADD = \
$(GST_BASE_LIBS) \
$(GST_LIBS) \
$(PANGO_LIBS)
libgstpango_la_LDFLAGS = \
$(GST_PLUGIN_LDFLAGS)
/* GStreamer
* Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
* Copyright (C) <2005> Tim-Philipp Müller <tim@centricular.net>
*
* 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., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <gstclockoverlay.h>
#include <gst/video/video.h>
#include <time.h>
static GstElementDetails clock_overlay_details =
GST_ELEMENT_DETAILS ("Time Overlay",
"Filter/Editor/Video",
"Overlays the time on a video stream",
"Tim-Philipp Müller <tim@centricular.net>");
GST_BOILERPLATE (GstClockOverlay, gst_clock_overlay, GstTextOverlay,
GST_TYPE_TEXT_OVERLAY)
static void gst_clock_overlay_base_init (gpointer g_class)
{
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
gst_element_class_set_details (element_class, &clock_overlay_details);
}
static gchar *
gst_clock_overlay_render_time (GstClockOverlay * overlay)
{
struct tm t;
time_t now;
now = time (NULL);
if (localtime_r (&now, &t) == NULL)
return g_strdup ("--:--:--");
return g_strdup_printf ("%02u:%02u:%02u", t.tm_hour, t.tm_min, t.tm_sec);
}
static gchar *
gst_clock_overlay_get_text (GstTextOverlay * overlay, GstBuffer * video_frame)
{
gchar *time_str, *txt, *ret;
overlay->need_render = TRUE;
GST_OBJECT_LOCK (overlay);
txt = g_strdup (overlay->default_text);
GST_OBJECT_UNLOCK (overlay);
time_str = gst_clock_overlay_render_time (GST_CLOCK_OVERLAY (overlay));
if (txt != NULL && *txt != '\0') {
ret = g_strdup_printf ("%s %s", txt, time_str);
} else {
ret = time_str;
time_str = NULL;
}
g_free (txt);
g_free (time_str);
return ret;
}
static void
gst_clock_overlay_class_init (GstClockOverlayClass * klass)
{
GstTextOverlayClass *gsttextoverlay_class;
gsttextoverlay_class = (GstTextOverlayClass *) klass;
gsttextoverlay_class->get_text = gst_clock_overlay_get_text;
}
static void
gst_clock_overlay_init (GstClockOverlay * overlay, GstClockOverlayClass * klass)
{
PangoFontDescription *font_description;
GstTextOverlay *textoverlay;
PangoContext *context;
textoverlay = GST_TEXT_OVERLAY (overlay);
context = GST_TEXT_OVERLAY_CLASS (klass)->pango_context;
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 ();
pango_font_description_set_family (font_description, g_strdup ("Monospace"));
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);
pango_font_description_set_size (font_description, 18 * PANGO_SCALE);
pango_context_set_font_description (context, font_description);
pango_font_description_free (font_description);
textoverlay->valign = GST_TEXT_OVERLAY_VALIGN_TOP;
textoverlay->halign = GST_TEXT_OVERLAY_HALIGN_LEFT;
}
/* GStreamer
* Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
* Copyright (C) <2005> Tim-Philipp Müller <tim@centricular.net>
*
* 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., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef __GST_CLOCK_OVERLAY_H__
#define __GST_CLOCK_OVERLAY_H__
#include "gsttextoverlay.h"
G_BEGIN_DECLS
#define GST_TYPE_CLOCK_OVERLAY \
(gst_clock_overlay_get_type())
#define GST_CLOCK_OVERLAY(obj) \
(G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_CLOCK_OVERLAY,GstClockOverlay))
#define GST_CLOCK_OVERLAY_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_CLOCK_OVERLAY,GstClockOverlayClass))
#define GST_IS_CLOCK_OVERLAY(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_CLOCK_OVERLAY))
#define GST_IS_CLOCK_OVERLAY_CLASS(klass) \
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_CLOCK_OVERLAY))
typedef struct _GstClockOverlay GstClockOverlay;
typedef struct _GstClockOverlayClass GstClockOverlayClass;
struct _GstClockOverlay {
GstTextOverlay textoverlay;
};
struct _GstClockOverlayClass {
GstTextOverlayClass parent_class;
};
GType gst_clock_overlay_get_type (void);
G_END_DECLS
#endif /* __GST_CLOCK_OVERLAY_H__ */
This diff is collapsed.
#ifndef __GST_TEXT_OVERLAY_H__
#define __GST_TEXT_OVERLAY_H__
#include <gst/gst.h>
#include <gst/base/gstcollectpads.h>
#include <pango/pangoft2.h>
G_BEGIN_DECLS
#define GST_TYPE_TEXT_OVERLAY (gst_text_overlay_get_type())
#define GST_TEXT_OVERLAY(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),\
GST_TYPE_TEXT_OVERLAY, GstTextOverlay))
#define GST_TEXT_OVERLAY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),\
GST_TYPE_TEXT_OVERLAY,GstTextOverlayClass))
#define GST_TEXT_OVERLAY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj),\
GST_TYPE_TEXT_OVERLAY, GstTextOverlayClass))
#define GST_IS_TEXT_OVERLAY(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),\
GST_TYPE_TEXT_OVERLAY))
#define GST_IS_TEXT_OVERLAY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),\
GST_TYPE_TEXT_OVERLAY))
typedef struct _GstTextOverlay GstTextOverlay;
typedef struct _GstTextOverlayClass GstTextOverlayClass;
typedef enum _GstTextOverlayVAlign GstTextOverlayVAlign;
typedef enum _GstTextOverlayHAlign GstTextOverlayHAlign;
typedef enum _GstTextOverlayWrapMode GstTextOverlayWrapMode;
enum _GstTextOverlayVAlign {
GST_TEXT_OVERLAY_VALIGN_BASELINE,
GST_TEXT_OVERLAY_VALIGN_BOTTOM,
GST_TEXT_OVERLAY_VALIGN_TOP
};
enum _GstTextOverlayHAlign {
GST_TEXT_OVERLAY_HALIGN_LEFT,
GST_TEXT_OVERLAY_HALIGN_CENTER,
GST_TEXT_OVERLAY_HALIGN_RIGHT
};
enum _GstTextOverlayWrapMode {
GST_TEXT_OVERLAY_WRAP_MODE_NONE = -1,
GST_TEXT_OVERLAY_WRAP_MODE_WORD = PANGO_WRAP_WORD,
GST_TEXT_OVERLAY_WRAP_MODE_CHAR = PANGO_WRAP_CHAR,
GST_TEXT_OVERLAY_WRAP_MODE_WORD_CHAR = PANGO_WRAP_WORD_CHAR
};
struct _GstTextOverlay {
GstElement element;
GstPad *video_sinkpad;
GstPad *text_sinkpad;
GstPad *srcpad;
GstCollectPads *collect;
GstCollectData *video_collect_data;
GstCollectData *text_collect_data;
gint width;
gint height;
gint fps_n;
gint fps_d;
GstTextOverlayVAlign valign;
GstTextOverlayHAlign halign;
GstTextOverlayWrapMode wrap_mode;
gint xpad;
gint ypad;
gint deltax;
gint deltay;
gchar *default_text;
gboolean want_shading;
PangoLayout *layout;
FT_Bitmap bitmap;
gint bitmap_buffer_size;
gint baseline_y;
gboolean need_render;
gint shading_value; /* for timeoverlay subclass */
};
struct _GstTextOverlayClass {
GstElementClass parent_class;
PangoContext *pango_context;
gchar * (*get_text) (GstTextOverlay *overlay, GstBuffer *video_frame);
};
GType gst_text_overlay_get_type(void) G_GNUC_CONST;
G_END_DECLS
#endif /* __GST_TEXT_OVERLAY_H */
This diff is collapsed.
#ifndef __GST_TEXT_RENDER_H__
#define __GST_TEXT_RENDER_H__
#include <gst/gst.h>
#include <pango/pangoft2.h>
G_BEGIN_DECLS
#define GST_TYPE_TEXT_RENDER (gst_text_render_get_type())
#define GST_TEXT_RENDER(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),\
GST_TYPE_TEXT_RENDER, GstTextRender))
#define GST_TEXT_RENDER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),\
GST_TYPE_ULAW, GstTextRender))
#define GST_TEXT_RENDER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj),\
GST_TYPE_TEXT_RENDER, GstTextRenderClass))
#define GST_IS_TEXT_RENDER(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),\
GST_TYPE_TEXT_RENDER))
#define GST_IS_TEXT_RENDER_CLASS(obj) (G_TYPE_CHECK_CLASS_TYPE((klass),\
GST_TYPE_TEXT_RENDER))
typedef struct _GstTextRender GstTextRender;
typedef struct _GstTextRenderClass GstTextRenderClass;
struct _GstTextRender {
GstElement element;
GstPad *sinkpad, *srcpad;
gint width;
gint height;
PangoLayout *layout;
FT_Bitmap bitmap;
gint bitmap_buffer_size;
gint baseline_y;
};
struct _GstTextRenderClass {
GstElementClass parent_class;
PangoContext *pango_context;
};
GType gst_text_render_get_type(void) G_GNUC_CONST;
G_END_DECLS
#endif /* __GST_TEXT_RENDER_H */
/* GStreamer
* Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
* Copyright (C) <2005> Tim-Philipp Müller <tim@centricular.net>
*
* 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., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <gst/video/video.h>
#include <gsttimeoverlay.h>
static GstElementDetails time_overlay_details =
GST_ELEMENT_DETAILS ("Time Overlay",
"Filter/Editor/Video",
"Overlays the time on a video stream",
"Tim-Philipp Müller <tim@centricular.net>");
GST_BOILERPLATE (GstTimeOverlay, gst_time_overlay, GstTextOverlay,
GST_TYPE_TEXT_OVERLAY)
static void gst_time_overlay_base_init (gpointer g_class)
{
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
gst_element_class_set_details (element_class, &time_overlay_details);
}
static gchar *
gst_time_overlay_render_time (GstTimeOverlay * overlay, GstClockTime time)
{
guint hours, mins, secs, msecs;
if (!GST_CLOCK_TIME_IS_VALID (time))
return g_strdup ("");
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));
return g_strdup_printf ("%u:%02u:%02u.%03u", hours, mins, secs, msecs);
}
static gchar *
gst_time_overlay_get_text (GstTextOverlay * overlay, GstBuffer * video_frame)
{
GstClockTime time = GST_BUFFER_TIMESTAMP (video_frame);
gchar *time_str, *txt, *ret;
overlay->need_render = TRUE;
if (!GST_CLOCK_TIME_IS_VALID (time)) {
GST_DEBUG ("buffer without valid timestamp");
return g_strdup ("");
}
GST_DEBUG ("buffer with timestamp %" GST_TIME_FORMAT, GST_TIME_ARGS (time));
GST_OBJECT_LOCK (overlay);
txt = g_strdup (overlay->default_text);
GST_OBJECT_UNLOCK (overlay);
time_str = gst_time_overlay_render_time (GST_TIME_OVERLAY (overlay), time);
if (txt != NULL && *txt != '\0') {
ret = g_strdup_printf ("%s %s", txt, time_str);
} else {
ret = time_str;
time_str = NULL;
}
g_free (txt);
g_free (time_str);
return ret;
}
static void
gst_time_overlay_class_init (GstTimeOverlayClass * klass)
{
GstTextOverlayClass *gsttextoverlay_class;
gsttextoverlay_class = (GstTextOverlayClass *) klass;
gsttextoverlay_class->get_text = gst_time_overlay_get_text;
}
static void
gst_time_overlay_init (GstTimeOverlay * overlay, GstTimeOverlayClass * klass)
{
PangoFontDescription *font_description;
GstTextOverlay *textoverlay;
PangoContext *context;
textoverlay = GST_TEXT_OVERLAY (overlay);
context = GST_TEXT_OVERLAY_CLASS (klass)->pango_context;
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 ();
pango_font_description_set_family (font_description, g_strdup ("Monospace"));
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);
pango_font_description_set_size (font_description, 18 * PANGO_SCALE);
pango_context_set_font_description (context, font_description);
pango_font_description_free (font_description);
textoverlay->valign = GST_TEXT_OVERLAY_VALIGN_TOP;
textoverlay->halign = GST_TEXT_OVERLAY_HALIGN_LEFT;
}
/* GStreamer
* Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
* Copyright (C) <2005> Tim-Philipp Müller <tim@centricular.net>
*
* 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., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef __GST_TIME_OVERLAY_H__
#define __GST_TIME_OVERLAY_H__
#include "gsttextoverlay.h"
G_BEGIN_DECLS
#define GST_TYPE_TIME_OVERLAY \
(gst_time_overlay_get_type())
#define GST_TIME_OVERLAY(obj) \
(G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_TIME_OVERLAY,GstTimeOverlay))
#define GST_TIME_OVERLAY_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_TIME_OVERLAY,GstTimeOverlayClass))
#define GST_IS_TIME_OVERLAY(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_TIME_OVERLAY))
#define GST_IS_TIME_OVERLAY_CLASS(klass) \
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_TIME_OVERLAY))
typedef struct _GstTimeOverlay GstTimeOverlay;
typedef struct _GstTimeOverlayClass GstTimeOverlayClass;
struct _GstTimeOverlay {
GstTextOverlay textoverlay;
};
struct _GstTimeOverlayClass {
GstTextOverlayClass parent_class;
};
GType gst_time_overlay_get_type (void);
G_END_DECLS
#endif /* __GST_TIME_OVERLAY_H__ */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment