#include <gst/video/video.h>
- #include <gsttimeoverlay.h>
+ #include "gsttimeoverlay.h"
-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_simple (element_class, "Time overlay",
- "Filter/Editor/Video",
- "Overlays buffer time stamps on a video stream",
- "Tim-Philipp Müller <tim@centricular.net>");
-}
+#define gst_time_overlay_parent_class parent_class
+G_DEFINE_TYPE (GstTimeOverlay, gst_time_overlay, GST_TYPE_BASE_TEXT_OVERLAY);
static gchar *
gst_time_overlay_render_time (GstTimeOverlay * overlay, GstClockTime time)
static void gst_app_src_set_latencies (GstAppSrc * appsrc,
gboolean do_min, guint64 min, gboolean do_max, guint64 max);
-static GstCaps *gst_app_src_internal_get_caps (GstBaseSrc * bsrc);
-static GstFlowReturn gst_app_src_create (GstBaseSrc * bsrc,
- guint64 offset, guint size, GstBuffer ** buf);
+static gboolean gst_app_src_negotiate (GstBaseSrc * basesrc);
- static GstFlowReturn gst_app_src_create (GstBaseSrc * bsrc,
- guint64 offset, guint size, GstBuffer ** buf);
++static GstCaps *gst_app_src_internal_get_caps (GstBaseSrc * bsrc,
++ GstCaps * filter);
++static GstFlowReturn gst_app_src_create (GstBaseSrc * bsrc, guint64 offset,
++ guint size, GstBuffer ** buf);
static gboolean gst_app_src_start (GstBaseSrc * bsrc);
static gboolean gst_app_src_stop (GstBaseSrc * bsrc);
static gboolean gst_app_src_unlock (GstBaseSrc * bsrc);
end_of_stream), NULL, NULL, __gst_app_marshal_ENUM__VOID,
GST_TYPE_FLOW_RETURN, 0, G_TYPE_NONE);
+ gst_element_class_set_details_simple (element_class, "AppSrc",
+ "Generic/Source", "Allow the application to feed buffers to a pipeline",
+ "David Schleef <ds@schleef.org>, Wim Taymans <wim.taymans@gmail.com>");
+
+ gst_element_class_add_pad_template (element_class,
+ gst_static_pad_template_get (&gst_app_src_template));
+
+ basesrc_class->negotiate = gst_app_src_negotiate;
+ basesrc_class->get_caps = gst_app_src_internal_get_caps;
basesrc_class->create = gst_app_src_create;
basesrc_class->start = gst_app_src_start;
basesrc_class->stop = gst_app_src_stop;
G_OBJECT_CLASS (parent_class)->finalize (obj);
}
-gst_app_src_internal_get_caps (GstBaseSrc * bsrc)
+ static GstCaps *
- return gst_app_src_get_caps (GST_APP_SRC_CAST (bsrc));
++gst_app_src_internal_get_caps (GstBaseSrc * bsrc, GstCaps * filter)
+ {
++ return gst_app_src_get_caps (GST_APP_SRC_CAST (bsrc), filter);
+ }
+
static void
gst_app_src_set_property (GObject * object, guint prop_id,
const GValue * value, GParamSpec * pspec)
GstCaps *caps;
/* we're missing a _take_caps() function to transfer ownership */
-- caps = gst_app_src_get_caps (appsrc);
++ caps = gst_app_src_get_caps (appsrc, NULL);
gst_value_set_caps (value, caps);
if (caps)
gst_caps_unref (caps);
* Since: 0.10.22
*/
GstCaps *
--gst_app_src_get_caps (GstAppSrc * appsrc)
++gst_app_src_get_caps (GstAppSrc * appsrc, GstCaps * filter)
{
GstCaps *caps;
GstAppSrcPrivate *priv;
GST_OBJECT_LOCK (appsrc);
if ((caps = priv->caps))
gst_caps_ref (caps);
++
++ if (filter) {
++ GstCaps *intersection =
++ gst_caps_intersect_full (filter, caps, GST_CAPS_INTERSECT_FIRST);
++ gst_caps_unref (caps);
++ caps = intersection;
++ }
++
GST_DEBUG_OBJECT (appsrc, "getting caps of %" GST_PTR_FORMAT, caps);
GST_OBJECT_UNLOCK (appsrc);
GType gst_app_stream_type_get_type (void);
void gst_app_src_set_caps (GstAppSrc *appsrc, const GstCaps *caps);
--GstCaps* gst_app_src_get_caps (GstAppSrc *appsrc);
++GstCaps* gst_app_src_get_caps (GstAppSrc *appsrc, GstCaps * filter);
void gst_app_src_set_size (GstAppSrc *appsrc, gint64 size);
gint64 gst_app_src_get_size (GstAppSrc *appsrc);
DISCO_UNLOCK (ps->dc);
}
- return TRUE;
+ return GST_PAD_PROBE_OK;
}
+ static GstStaticCaps subtitle_caps = GST_STATIC_CAPS ("text/plain; "
+ "text/x-pango-markup; subpicture/x-pgs; subpicture/x-dvb; "
+ "application/x-subtitle-unknown; application/x-ssa; application/x-ass; "
+ "subtitle/x-kate; application/x-kate; video/x-dvd-subpicture");
+
static gboolean
is_subtitle_caps (const GstCaps * caps)
{
video_blend_format_info_init (&rectangle_info,
GST_BUFFER_DATA (rect->pixels), rect->height, rect->width,
- rect->format);
+ rect->format,
- !!(rect->flags & GST_VIDEO_OVERLAY_FORMAT_FLAG_PREMULTIPLIED_ALPHA));
++ ! !(rect->flags & GST_VIDEO_OVERLAY_FORMAT_FLAG_PREMULTIPLIED_ALPHA));
needs_scaling = gst_video_overlay_rectangle_needs_scaling (rect);
if (needs_scaling) {
/* not cached yet, do the scaling and put the result into our cache */
video_blend_format_info_init (&info, GST_BUFFER_DATA (rectangle->pixels),
- rectangle->height, rectangle->width, rectangle->format);
+ rectangle->height, rectangle->width, rectangle->format,
- !!(rectangle->flags & GST_VIDEO_OVERLAY_FORMAT_FLAG_PREMULTIPLIED_ALPHA));
++ ! !(rectangle->flags &
++ GST_VIDEO_OVERLAY_FORMAT_FLAG_PREMULTIPLIED_ALPHA));
- video_blend_scale_linear_RGBA (&info, rectangle->render_height,
- rectangle->render_width);
+ if (wanted_width != rectangle->width || wanted_height != rectangle->height) {
+ video_blend_scale_linear_RGBA (&info, wanted_height, wanted_width);
+ }
+
+ if (!gst_video_overlay_rectangle_is_same_alpha_type (rectangle->flags, flags)) {
+ if (rectangle->flags & GST_VIDEO_OVERLAY_FORMAT_FLAG_PREMULTIPLIED_ALPHA) {
+ gst_video_overlay_rectangle_unpremultiply (&info);
+ } else {
+ gst_video_overlay_rectangle_premultiply (&info);
+ }
+ }
buf = gst_buffer_new ();
GST_BUFFER_DATA (buf) = info.pixels;
* static GstBusSyncReply
* bus_sync_handler (GstBus * bus, GstMessage * message, gpointer user_data)
* {
- * // ignore anything but 'prepare-xwindow-id' element messages
- * if (GST_MESSAGE_TYPE (message) != GST_MESSAGE_ELEMENT)
- * return GST_BUS_PASS;
- * if (!gst_structure_has_name (message->structure, "prepare-xwindow-id"))
+ * // ignore anything but 'prepare-window-handle' element messages
+ * if (!gst_is_video_overlay_prepare_window_handle_message (message))
* return GST_BUS_PASS;
*
- * if (video_window_xid != 0) {
- * GstVideoOverlay *xoverlay;
+ * if (video_window_handle != 0) {
+ * GstXOverlay *xoverlay;
*
* // GST_MESSAGE_SRC (message) will be the video sink element
- * xoverlay = GST_VIDEO_OVERLAY (GST_MESSAGE_SRC (message));
- * gst_video_overlay_set_window_handle (xoverlay, video_window_xid);
+ * xoverlay = GST_X_OVERLAY (GST_MESSAGE_SRC (message));
+ * gst_x_overlay_set_window_handle (xoverlay, video_window_handle);
* } else {
- * g_warning ("Should have obtained video_window_xid by now!");
+ * g_warning ("Should have obtained video_window_handle by now!");
* }
*
* gst_message_unref (message);
int j;
paintinfo pi = { NULL, };
paintinfo *p = π
- struct fourcc_list_struct *fourcc;
+ struct format_list_struct *format;
+ int w = frame->info.width, h = frame->info.height;
- videotestsrc_setup_paintinfo (v, p, w, h);
- fourcc = v->fourcc;
- if (fourcc == NULL)
+ videotestsrc_setup_paintinfo (v, p, frame->info.width, frame->info.height);
+ format = v->format;
+ if (format == NULL)
return;
- fourcc->paint_setup (p, dest);
+ format->paint_setup (p, frame);
y1 = 2 * h / 3;
- y2 = h * 0.75;
+ y2 = 3 * h / 4;
/* color bars */
for (j = 0; j < y1; j++) {
# TORTURE_TO_FIX = \
# elements/adder
-# ffmpegcolorspace takes too long, so disabled for now
+# videoconvert takes too long, so disabled for now
VALGRIND_TO_FIX = \
- elements/ffmpegcolorspace \
+ elements/videoconvert \
+ libs/discoverer \
libs/video
# these tests don't even pass