## PgmImageSink PgmImageSink — A GStreamer image sink outputing frames to image drawables. |

## Synopsis

    #include <pgm/pgm.h>

    enum                PgmImageSinkEventMask;
                        PgmImageSink;
    GstElement *        pgm_image_sink_new                  (const gchar *name);
    PgmError            pgm_image_sink_set_image            (PgmImageSink *sink,
                                                             PgmImage *image);
    PgmError            pgm_image_sink_get_image            (PgmImageSink *sink,
                                                             PgmImage **image);
    PgmError            pgm_image_sink_set_events           (PgmImageSink *sink,
                                                             PgmImageSinkEventMask events);
    PgmError            pgm_image_sink_get_events           (PgmImageSink *sink,
                                                             PgmImageSinkEventMask *events);

## Object Hierarchy

      GObject
       +----GstObject
             +----GstElement
                   +----GstBaseSink
                         +----GstVideoSink
                               +----PgmImageSink

## Properties

      "events"                   PgmImageSinkEventMask  : Read / Write
      "image"                    PgmImage*             : Read / Write

## Description

PgmImageSink is a GStreamer image sink element allowing to build GStreamer pipelines outputing frames directly to PgmImage.

You can explicitly use the `pgm_image_sink_new()` function to instanciate a new sink, but you can alos use the standard GStreamer functions using `gst_element_factory_make()` or `gst_parse_launch()`, the factory name of the sink being "pgmimagesink".

Internally, the sink is simply outputing GStreamer buffers (GstBuffer) to images (PgmImage) using the `pgm_image_set_from_gst_buffer()` function.

Last reviewed on 2008-01-28 (0.3.4)

## Details

### enum PgmImageSinkEventMask

    typedef enum {
        PGM_IMAGE_SINK_MOTION   = (1 << 0),
        PGM_IMAGE_SINK_PRESSED  = (1 << 1),
        PGM_IMAGE_SINK_RELEASED = (1 << 2)
    } PgmImageSinkEventMask;

The event mask flags.

`PGM_IMAGE_SINK_MOTION` | The motion event flag.
`PGM_IMAGE_SINK_PRESSED` | The pressed event flag.
`PGM_IMAGE_SINK_RELEASED` | The released event flag.

### PgmImageSink

    typedef struct _PgmImageSink PgmImageSink;

The opaque PgmImageSink data structure.

### pgm_image_sink_new ()

    GstElement *        pgm_image_sink_new                  (const gchar *name);

Creates a new image sink with the given name.

`name` : | the name of the new image sink.
Returns : | a new PgmImageSink.

### pgm_image_sink_set_image ()

    PgmError            pgm_image_sink_set_image            (PgmImageSink *sink,
                                                             PgmImage *image);

Sets `image` as the PgmImage object which will receive the frames (GstBuffer) outputed by `sink`.

MT Safe.

`sink` : | a PgmImageSink object.
`image` : | the PgmImage object.
Returns : | a PgmError indicating success/failure.

### pgm_image_sink_get_image ()

    PgmError            pgm_image_sink_get_image            (PgmImageSink *sink,
                                                             PgmImage **image);

Retrieves the PgmImage object in `image` which `sink` is using to output its frames (GstBuffer).

MT Safe.

`sink` : | a PgmImageSink object.
`image` : | a pointer to a PgmImage pointer where the image will be stored. Unref after usage.
Returns : | a PgmError indicating success/failure.

### pgm_image_sink_set_events ()

    PgmError            pgm_image_sink_set_events           (PgmImageSink *sink,
                                                             PgmImageSinkEventMask events);

Sets the mouse events interacting with the currently set image that will be sent upstream in the pipeline.

`sink` : | a PgmImageSink object.
`events` : | a PgmImageSinkEventMask.
Returns : | a PgmError indicating success/failure.

### pgm_image_sink_get_events ()

    PgmError            pgm_image_sink_get_events           (PgmImageSink *sink,
                                                             PgmImageSinkEventMask *events);

Retrieves in `events` the mouse events sent upstream in the pipeline.

`sink` : | a PgmImageSink object.
`events` : | a PgmImageSinkEventMask pointer where the event mask will be stored.
Returns : | a PgmError indicating success/failure.

## Property Details

### The `"events"` property

      "events"                   PgmImageSinkEventMask  : Read / Write

A PgmImageSinkEventMask specifying what input events should be sent upstream in the pipeline.

### The `"image"` property

      "image"                    PgmImage*             : Read / Write

A PgmImage on which the sink output video frames.

## See Also

#PgmImage