From 1d2994ce64f5f9e53194f484bd9ad7ce0934cf02 Mon Sep 17 00:00:00 2001 From: Thibault Saunier Date: Wed, 29 May 2019 14:41:10 -0400 Subject: [PATCH] overlaycompositor: Show the full example instead of a stripped down version --- .../gstoverlaycomposition.c | 94 +------------------ 1 file changed, 2 insertions(+), 92 deletions(-) diff --git a/gst/overlaycomposition/gstoverlaycomposition.c b/gst/overlaycomposition/gstoverlaycomposition.c index 2f65ac4193..f9a4ebc740 100644 --- a/gst/overlaycomposition/gstoverlaycomposition.c +++ b/gst/overlaycomposition/gstoverlaycomposition.c @@ -23,99 +23,9 @@ * The overlaycomposition element renders an overlay using an application * provided draw function. * - * A more interesting example can be found at - * https://cgit.freedesktop.org/gstreamer/gst-plugins-base/tree/tests/examples/overlaycomposition/overlaycomposition.c + * ## Example code * - * - * Example code - * |[ - * - * #include <gst/gst.h> - * #include <gst/video/video.h> - * - * ... - * - * typedef struct { - * gboolean valid; - * GstVideoInfo info; - * } OverlayState; - * - * ... - * - * static void - * prepare_overlay (GstElement * overlay, GstCaps * caps, gint window_width, - * gint window_height, gpointer user_data) - * { - * OverlayState *s = (OverlayState *)user_data; - * - * if (gst_video_info_from_caps (&s->info, caps)) - * s->valid = TRUE; - * } - * - * static GstVideoOverlayComposition * - * draw_overlay (GstElement * overlay, GstSample * sample, gpointer user_data) - * { - * OverlayState *s = (OverlayState *)user_data; - * GstBuffer *buffer; - * GstVideoOverlayRectangle *rect; - * GstVideoOverlayComposition *comp; - * GstVideoInfo info; - * GstVideoFrame frame; - * gint x, y; - * guint8 *data; - * - * if (!s->valid) - * return NULL; - * - * gst_video_info_set_format (&info, GST_VIDEO_FORMAT_BGRA, 16, 16); - * buffer = gst_buffer_new_and_alloc (info.size); - * gst_buffer_add_video_meta (buffer, GST_VIDEO_FRAME_FLAG_NONE, - * GST_VIDEO_INFO_FORMAT(&info), - * GST_VIDEO_INFO_WIDTH(&info), - * GST_VIDEO_INFO_HEIGHT(&info)); - * - * gst_video_frame_map (&frame, &info, buffer, GST_MAP_WRITE); - * - * // Overlay a half-transparent blue 16x16 rectangle in the middle - * // of the frame - * data = GST_VIDEO_FRAME_PLANE_DATA(&frame, 0); - * for (y = 0; y < 16; y++) { - * guint8 *line = &data[y * GST_VIDEO_FRAME_PLANE_STRIDE (&frame, 0)]; - * for (x = 0; x < 16; x++) { - * guint8 *pixel = &line[x * 4]; - * - * pixel[0] = 255; - * pixel[1] = 0; - * pixel[2] = 0; - * pixel[3] = 127; - * } - * } - * - * gst_video_frame_unmap (&frame); - * rect = gst_video_overlay_rectangle_new_raw (buffer, - * s->info.width / 2 - 8, - * s->info.height / 2 - 8, - * 16, 16, - * GST_VIDEO_OVERLAY_FORMAT_FLAG_NONE); - * comp = gst_video_overlay_composition_new (rect); - * gst_video_overlay_rectangle_unref (rect); - * gst_buffer_unref (buffer); - * - * return comp; - * } - * - * ... - * - * overlay = gst_element_factory_make ("overlaycomposition", "overlay"); - * - * g_signal_connect (overlay, "draw", G_CALLBACK (draw_overlay), - * overlay_state); - * g_signal_connect (overlay, "caps-changed", - * G_CALLBACK (prepare_overlay), overlay_state); - * ... - * - * ]| - * + * {{ ../../tests/examples/overlaycomposition/overlaycomposition.c[23:316] }} */ #if HAVE_CONFIG_H