## dfbvideosink dfbvideosink |

## Properties

gint | brightness | Read / Write
gint | contrast | Read / Write
gint | hue | Read / Write
gchar * | pixel-aspect-ratio | Read / Write
gint | saturation | Read / Write
gpointer | surface | Write
gboolean | vsync | Read / Write
GstDfbVideoSinkLayerMode | layer-mode | Read / Write

## Types and Values

struct | GstDfbVideoSink

## Object Hierarchy

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

## Implemented Interfaces

GstDfbVideoSink implements GstNavigation and GstColorBalance.

## Description

DfbVideoSink renders video frames using the

DirectFB library.

Rendering can happen in two different modes :

- Standalone: this mode will take complete control of the monitor forcing

  DirectFB to fullscreen layout.

  This is convenient to test using the gst-launch-1.0 command line tool or other simple applications. It is possible to interrupt playback while being in this mode by pressing the Escape key. This mode handles navigation events for every input device supported by the DirectFB library, it will look for available video modes in the fb.modes file and try to switch the framebuffer video mode to the most suitable one. Depending on hardware acceleration capabilities the element will handle scaling or not. If no acceleration is available it will do clipping or centering of the video frames respecting the original aspect ratio.

- Embedded: this mode will render video frames in a “surface” provided by the application developer. This is a more advanced usage of the element and it is required to integrate video playback in existing

  DirectFB applications.

  When using this mode the element just renders to the “surface” provided by the application, that means it won't handle navigation events and won't resize the “surface” to fit video frames geometry. Application has to implement the necessary code to grab informations about the negotiated geometry and resize there “surface” accordingly.

For both modes the element implements a buffer pool allocation system to optimize memory allocation time and handle reverse negotiation. Indeed if you insert an element like videoscale in the pipeline the video sink will negotiate with it to try get a scaled video for either the fullscreen layout or the application provided external “surface”.

#### Example application

    #include <directfb.h>

    #ifdef __no_instrument_function__
    #undef __no_instrument_function__
    #endif

    #include <stdio.h>
    #include <gst/gst.h>

    static IDirectFB *dfb = NULL;
    static IDirectFBSurface *primary = NULL;
    static GMainLoop *loop;

    #define DFBCHECK(x...)                                         \
      {                                                            \
        DFBResult err = x;                                         \
                                                                   \
        if (err != DFB_OK)                                         \
          {                                                        \
            fprintf( stderr, "%s <%d>:\n\t", __FILE__, __LINE__ ); \
            DirectFBErrorFatal( #x, err );                         \
          }                                                        \
      }

    static gboolean
    get_me_out (gpointer data)
    {
      g_main_loop_quit (loop);
      return FALSE;
    }

    int
    main (int argc, char *argv[])
    {
      DFBSurfaceDescription dsc;
      GstElement *pipeline, *src, *sink;

      /* Init both GStreamer and DirectFB */
      DFBCHECK (DirectFBInit (&argc, &argv));
      gst_init (&argc, &argv);

      /* Creates DirectFB main context and set it to fullscreen layout */
      DFBCHECK (DirectFBCreate (&dfb));
      DFBCHECK (dfb->SetCooperativeLevel (dfb, DFSCL_FULLSCREEN));

      /* We want a double buffered primary surface */
      dsc.flags = DSDESC_CAPS;
      dsc.caps = DSCAPS_PRIMARY | DSCAPS_FLIPPING;

      DFBCHECK (dfb->CreateSurface (dfb, &dsc, &primary));

      /* Creating our pipeline : videotestsrc ! dfbvideosink */
      pipeline = gst_pipeline_new (NULL);
      g_assert (pipeline);
      src = gst_element_factory_make ("videotestsrc", NULL);
      g_assert (src);
      sink = gst_element_factory_make ("dfbvideosink", NULL);
      g_assert (sink);
      /* That's the interesting part, giving the primary surface to dfbvideosink */
      g_object_set (sink, "surface", primary, NULL);

      /* Adding elements to the pipeline */
      gst_bin_add_many (GST_BIN (pipeline), src, sink, NULL);
      if (!gst_element_link (src, sink))
        g_error ("Couldn't link videotestsrc and dfbvideosink");

      /* Let's play ! */
      gst_element_set_state (pipeline, GST_STATE_PLAYING);

      /* we need to run a GLib main loop to get out of here */
      loop = g_main_loop_new (NULL, FALSE);
      /* Get us out after 20 seconds */
      g_timeout_add (20000, get_me_out, NULL);
      g_main_loop_run (loop);

      /* Release elements and stop playback */
      gst_element_set_state (pipeline, GST_STATE_NULL);

      /* Free the main loop */
      g_main_loop_unref (loop);

      /* Release DirectFB context and surface */
      primary->Release (primary);
      dfb->Release (dfb);

      return 0;
    }

#### Example pipelines

    1
    gst-launch-1.0 -v videotestsrc ! dfbvideosink hue=20000 saturation=40000 brightness=25000

test the colorbalance interface implementation in dfbvideosink

## Synopsis

### Element Information

plugin | dfbvideosink
author | Julien Moutte <julien@moutte.net>
class | Sink/Video

### Element Pads

name | sink
direction | sink
presence | always
details | video/x-raw, framerate=(fraction)[ 0/1, 2147483647/1 ], width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ]

## Functions

## Types and Values

### struct GstDfbVideoSink

    struct GstDfbVideoSink;

The opaque GstDfbVideoSink structure.

## Property Details

### The `“brightness”` property

      “brightness”               gint

The brightness of the video.

Flags: Read / Write

Allowed values: [0,65535]

Default value: 32768

### The `“contrast”` property

      “contrast”                 gint

The contrast of the video.

Flags: Read / Write

Allowed values: [0,65535]

Default value: 32768

### The `“hue”` property

      “hue”                      gint

The hue of the video.

Flags: Read / Write

Allowed values: [0,65535]

Default value: 32768

### The `“pixel-aspect-ratio”` property

      “pixel-aspect-ratio”       gchar *

The pixel aspect ratio of the device.

Flags: Read / Write

Default value: "1/1"

### The `“saturation”` property

      “saturation”               gint

The saturation of the video.

Flags: Read / Write

Allowed values: [0,65535]

Default value: 32768

### The `“surface”` property

      “surface”                  gpointer

The target surface for video.

Flags: Write

### The `“vsync”` property

      “vsync”                    gboolean

Wait for next vertical sync to draw frames.

Flags: Read / Write

Default value: TRUE

### The `“layer-mode”` property

      “layer-mode”               GstDfbVideoSinkLayerMode

The cooperative level handling the access permission (set this to 'administrative' when the cursor is required).

Flags: Read / Write

Default value: DLSCL_EXCLUSIVE