## GstVideoSink

GstVideoSink — Base class for video sinks

## Functions

#define | GST_VIDEO_SINK_HEIGHT()
#define | GST_VIDEO_SINK_PAD()
#define | GST_VIDEO_SINK_WIDTH()
void | gst_video_sink_center_rect ()

## Properties

gboolean | show-preroll-frame | Read / Write / Construct

## Types and Values

struct | GstVideoSink
struct | GstVideoSinkClass
struct | GstVideoRectangle

## Object Hierarchy

        GObject
        ╰── GInitiallyUnowned
            ╰── GstObject
                ╰── GstElement
                    ╰── GstBaseSink
                        ╰── GstVideoSink

## Includes

    #include <gst/video/gstvideosink.h>

## Description

Provides useful functions and a base class for video sinks.

GstVideoSink will configure the default base sink to drop frames that arrive later than 20ms as this is considered the default threshold for observing out-of-sync frames.

## Functions

### GST_VIDEO_SINK_HEIGHT()

    #define GST_VIDEO_SINK_HEIGHT(obj) (GST_VIDEO_SINK_CAST (obj)->height)

### GST_VIDEO_SINK_PAD()

    #define GST_VIDEO_SINK_PAD(obj) GST_BASE_SINK_PAD(obj)

Get the sink GstPad of `obj` .

#### Parameters

obj | a GstVideoSink |

### GST_VIDEO_SINK_WIDTH()

    #define GST_VIDEO_SINK_WIDTH(obj) (GST_VIDEO_SINK_CAST (obj)->width)

### gst_video_sink_center_rect ()

    void
    gst_video_sink_center_rect (GstVideoRectangle src,
                                GstVideoRectangle dst,
                                GstVideoRectangle *result,
                                gboolean scaling);

Takes `src` rectangle and position it at the center of `dst` rectangle with or without `scaling` . It handles clipping if the `src` rectangle is bigger than the `dst` one and `scaling` is set to FALSE.

#### Parameters

src | the GstVideoRectangle describing the source area |
dst | the GstVideoRectangle describing the destination area |
result | a pointer to a GstVideoRectangle which will receive the result area |
scaling | a gboolean indicating if scaling should be applied or not |

## Types and Values

### struct GstVideoSink

    struct GstVideoSink {
      gint width, height;
    };

The video sink instance structure. Derived video sinks should set the `height` and `width` members.

#### Members

gint `width`; | video width (derived class needs to set this) |
gint `height`; | video height (derived class needs to set this) |

### struct GstVideoSinkClass

    struct GstVideoSinkClass {
      GstBaseSinkClass parent_class;

      GstFlowReturn  (*show_frame) (GstVideoSink *video_sink, GstBuffer *buf);
    };

The video sink class structure. Derived classes should override the `show_frame` virtual function.

#### Members

`show_frame` () | render a video frame. Maps to `GstBaseSinkClass.render()` and `GstBaseSinkClass.preroll()` vfuncs. Rendering during preroll will be suppressed if the “show-preroll-frame” property is set to `FALSE`. |

### struct GstVideoRectangle

    struct GstVideoRectangle {
      gint x;
      gint y;
      gint w;
      gint h;
    };

Helper structure representing a rectangular area.

#### Members

gint `x`; | X coordinate of rectangle's top-left point |
gint `y`; | Y coordinate of rectangle's top-left point |
gint `w`; | width of the rectangle |
gint `h`; | height of the rectangle |

## Property Details

### The `“show-preroll-frame”` property

      “show-preroll-frame”       gboolean

Whether to show video frames during preroll. If set to FALSE, video frames will only be rendered in PLAYING state.

Flags: Read / Write / Construct

Default value: TRUE