## UnicapgtkVideoDisplay

UnicapgtkVideoDisplay

## Synopsis

                        UnicapgtkVideoDisplayCropping;
                        UnicapgtkVideoDisplay;
    GType               unicapgtk_video_display_get_type    (void);
    GtkWidget*          unicapgtk_video_display_new         (void);
    GtkWidget*          unicapgtk_video_display_new_by_device
                                                            (unicap_device_t *device_spec);
    GtkWidget*          unicapgtk_video_display_new_by_handle
                                                            (unicap_handle_t handle);
    gboolean            unicapgtk_video_display_start       (UnicapgtkVideoDisplay *ugtk);
    void                unicapgtk_video_display_stop        (UnicapgtkVideoDisplay *ugtk);
    unicap_device_t*    unicapgtk_video_display_get_device  (UnicapgtkVideoDisplay *ugtk);
    unicap_handle_t     unicapgtk_video_display_get_handle  (UnicapgtkVideoDisplay *ugkt);
    gboolean            unicapgtk_video_display_set_format  (UnicapgtkVideoDisplay *ugtk,
                                                             unicap_format_t *format_spec);
    void                unicapgtk_video_display_get_format  (UnicapgtkVideoDisplay *ugtk,
                                                             unicap_format_t *format);
    void                unicapgtk_video_display_set_pause   (UnicapgtkVideoDisplay *ugtk,
                                                             gboolean state);
    gboolean            unicapgtk_video_display_get_pause   (UnicapgtkVideoDisplay *ugtk);
    gboolean            unicapgtk_video_display_set_device  (UnicapgtkVideoDisplay *ugtk,
                                                             unicap_device_t *device_spec);
    gboolean            unicapgtk_video_display_set_handle  (UnicapgtkVideoDisplay *ugtk,
                                                             unicap_handle_t handle);
    GdkPixbuf*          unicapgtk_video_display_get_still_image
                                                            (UnicapgtkVideoDisplay *ugtk);
    void                unicapgtk_video_display_set_still_image
                                                            (UnicapgtkVideoDisplay *ugtk,
                                                             unicap_data_buffer_t *buffer);
    void                unicapgtk_video_display_get_data_buffer
                                                            (UnicapgtkVideoDisplay *ugtk,
                                                             unicap_data_buffer_t **dest_buffer);
    void                unicapgtk_video_display_set_crop    (UnicapgtkVideoDisplay *ugtk,
                                                             UnicapgtkVideoDisplayCropping *crop);
    void                unicapgtk_video_display_get_crop    (UnicapgtkVideoDisplay *ugtk,
                                                             UnicapgtkVideoDisplayCropping *crop);
    void                unicapgtk_video_display_set_size    (UnicapgtkVideoDisplay *ugtk,
                                                             gint width,
                                                             gint height);
    void                unicapgtk_video_display_set_scale_to_fit
                                                            (UnicapgtkVideoDisplay *ugtk,
                                                             gboolean scale);
    unicap_new_frame_callback_t unicapgtk_video_display_set_new_frame_callback
                                                            (UnicapgtkVideoDisplay *ugtk,
                                                             UnicapgtkCallbackFlags flags,
                                                             unicap_new_frame_callback_t cb,
                                                             void *data);

## Object Hierarchy

      GObject
       +----GInitiallyUnowned
             +----GtkObject
                   +----GtkWidget
                         +----GtkContainer
                               +----GtkBin
                                     +----GtkFrame
                                           +----GtkAspectFrame
                                                 +----UnicapgtkVideoDisplay

## Implemented Interfaces

UnicapgtkVideoDisplay implements AtkImplementorIface and GtkBuildable.

## Properties

      "backend"                  gchar*                : Read / Write
      "backend-fourcc"           guint                 : Read / Write
      "scale-to-fit"             gboolean              : Read / Write

## Signals

      "unicapgtk-video-display-predisplay"             : Run First / Action

## Description

## Details

### UnicapgtkVideoDisplayCropping

    typedef struct {
      int crop_x;
      int crop_y;
      int crop_width;
      int crop_height;
    } UnicapgtkVideoDisplayCropping;

### UnicapgtkVideoDisplay

    typedef struct _UnicapgtkVideoDisplay UnicapgtkVideoDisplay;

### unicapgtk_video_display_get_type ()

    GType               unicapgtk_video_display_get_type    (void);

Returns : |

### unicapgtk_video_display_new ()

    GtkWidget*          unicapgtk_video_display_new         (void);

Creates a new UnicapgtkVideoDisplay

Returns : | a new UnicapgtkVideoDisplay

### unicapgtk_video_display_new_by_device ()

    GtkWidget*          unicapgtk_video_display_new_by_device
                                                            (unicap_device_t *device_spec);

Creates a new UnicapgtkVideoDisplay and opens the given device to operate with.

`device_spec` : | the device to be used by this video display widget
Returns : | a new UnicapgtkVideoDisplay

### unicapgtk_video_display_new_by_handle ()

    GtkWidget*          unicapgtk_video_display_new_by_handle
                                                            (unicap_handle_t handle);

Creates a new UnicapgtkVideoDisplay and uses the handle to control the video device. The handle gets cloned by this call.

`handle` : | a handle of the device to be used by this video display widget
Returns : | a new UnicapgtkVideoDisplay

### unicapgtk_video_display_start ()

    gboolean            unicapgtk_video_display_start       (UnicapgtkVideoDisplay *ugtk);

Calls unicap_start_capture on the device and starts displaying the live video stream.

`ugtk` : | an UnicapgtkVideoDisplay
Returns : | TRUE when the live display could be successfully started.

### unicapgtk_video_display_stop ()

    void                unicapgtk_video_display_stop        (UnicapgtkVideoDisplay *ugtk);

Calls unicap_stop_capture on the device and stops displaying the live video image.

`ugtk` : | an UnicapgtkVideoDisplay

### unicapgtk_video_display_get_device ()

    unicap_device_t*    unicapgtk_video_display_get_device  (UnicapgtkVideoDisplay *ugtk);

Returns the device currently used by the video display. The returned data is owned by the library and should not be freed by the application.

`ugtk` : | an UnicapgtkVideoDisplay
Returns : | an unicap_device_t

### unicapgtk_video_display_get_handle ()

    unicap_handle_t     unicapgtk_video_display_get_handle  (UnicapgtkVideoDisplay *ugkt);

Returns a handle to the device currently used by the display. This is a clone of the handle used by the display so unicap_close must be called on this handle by the calling application.

`ugkt` : |
Returns : | a cloned unicap_handle_t

### unicapgtk_video_display_set_format ()

    gboolean            unicapgtk_video_display_set_format  (UnicapgtkVideoDisplay *ugtk,
                                                             unicap_format_t *format_spec);

Sets the video format used by the display. If a handle is set on the display ( ie. the display controls a device ), the video format is also changed and only video formats supported by the device can be set.

`ugtk` : | an UnicapgtkVideoDisplay
`format_spec` : | a unicap_format_t
Returns : | TRUE when the format change was successfull.

### unicapgtk_video_display_get_format ()

    void                unicapgtk_video_display_get_format  (UnicapgtkVideoDisplay *ugtk,
                                                             unicap_format_t *format);

`ugtk` : |
`format` : |

### unicapgtk_video_display_set_pause ()

    void                unicapgtk_video_display_set_pause   (UnicapgtkVideoDisplay *ugtk,
                                                             gboolean state);

Pauses or unpauses the video display. If the display is controling a device, the device is not stopped or paused by this call. When the video display is paused, no new frames are retrieved from the device and the display is constantly updated with the last image retrieved from the device.

Buffer display events are still called. This way an application can still draw an overlay onto the image.

`ugtk` : | an UnicapgtkVideoDisplay
`state` : | TRUE to put the device into pause state; FALSE to put it into running state

### unicapgtk_video_display_get_pause ()

    gboolean            unicapgtk_video_display_get_pause   (UnicapgtkVideoDisplay *ugtk);

Retrieve current pause state

`ugtk` : | an UnicapgtkVideoDisplay
Returns : | TRUE when the display is currently paused

### unicapgtk_video_display_set_device ()

    gboolean            unicapgtk_video_display_set_device  (UnicapgtkVideoDisplay *ugtk,
                                                             unicap_device_t *device_spec);

Set a new device on the display.

`ugtk` : | an UnicapgtkVideoDisplay
`device_spec` : | an unicap_device_t
Returns : | TRUE when the new device could be successfully set.

### unicapgtk_video_display_set_handle ()

    gboolean            unicapgtk_video_display_set_handle  (UnicapgtkVideoDisplay *ugtk,
                                                             unicap_handle_t handle);

Set a new device on the display, specified by a handle. The handle gets cloned by this call.

`ugtk` : | an UnicapgtkVideoDisplay
`handle` : | a unicap_handle_t
Returns : | TRUE when the device change was successful.

### unicapgtk_video_display_get_still_image ()

    GdkPixbuf*          unicapgtk_video_display_get_still_image
                                                            (UnicapgtkVideoDisplay *ugtk);

Retrieves a still image from the live video stream.

`ugtk` : | an UnicapgtkVideoDisplay
Returns : | a new allocated GdkPixbuf

### unicapgtk_video_display_set_still_image ()

    void                unicapgtk_video_display_set_still_image
                                                            (UnicapgtkVideoDisplay *ugtk,
                                                             unicap_data_buffer_t *buffer);

Sets a still image. If the video display is currently running, it is put to pause state by this call.

`ugtk` : | an UnicapgtkVideoDisplay
`buffer` : | a data_buffer to be displayed

### unicapgtk_video_display_get_data_buffer ()

    void                unicapgtk_video_display_get_data_buffer
                                                            (UnicapgtkVideoDisplay *ugtk,
                                                             unicap_data_buffer_t **dest_buffer);

Retrieves a still image from the live video stream.

`ugtk` : | an UnicapgtkVideoDisplay
`dest_buffer` : | a pointer where to store the new data_buffer

### unicapgtk_video_display_set_crop ()

    void                unicapgtk_video_display_set_crop    (UnicapgtkVideoDisplay *ugtk,
                                                             UnicapgtkVideoDisplayCropping *crop);

Set a cropping window. The video display will only display the region specified in the cropping window.

`ugtk` : | an UnicagtkVideoDisplay
`crop` : | cropping specification

### unicapgtk_video_display_get_crop ()

    void                unicapgtk_video_display_get_crop    (UnicapgtkVideoDisplay *ugtk,
                                                             UnicapgtkVideoDisplayCropping *crop);

Retrieves the current cropping window.

`ugtk` : | an UnicapgtkVideoDisplay
`crop` : | pointer to where to store the UnicapgtkVideoDisplayCropping structure

### unicapgtk_video_display_set_size ()

    void                unicapgtk_video_display_set_size    (UnicapgtkVideoDisplay *ugtk,
                                                             gint width,
                                                             gint height);

Sets the output size of the display. Video data that is to be displayed will be scaled to this size.

`ugtk` : | an UnicapgtkVideoDisplay
`width` : | new width
`height` : | new height

### unicapgtk_video_display_set_scale_to_fit ()

    void                unicapgtk_video_display_set_scale_to_fit
                                                            (UnicapgtkVideoDisplay *ugtk,
                                                             gboolean scale);

If scale_to_fit is set, the video display will get scaled to the size allocated to the widget.

`ugtk` : | an UnicapgtkVideoDisplay
`scale` : | TRUE if the display should scale to fit

### unicapgtk_video_display_set_new_frame_callback ()

    unicap_new_frame_callback_t unicapgtk_video_display_set_new_frame_callback
                                                            (UnicapgtkVideoDisplay *ugtk,
                                                             UnicapgtkCallbackFlags flags,
                                                             unicap_new_frame_callback_t cb,
                                                             void *data);

Registers a callback function which is called in the unicap capture thread context.

`ugtk` : | an UnicapgtkVideoDisplay
`flags` : | flags
`cb` : | a callback function
`data` : | a pointer to user data that is passed to the callback function
Returns : | old callback

## Property Details

### The `"backend"` property

      "backend"                  gchar*                : Read / Write

Default value: NULL

### The `"backend-fourcc"` property

      "backend-fourcc"           guint                 : Read / Write

Default value: 0

### The `"scale-to-fit"` property

      "scale-to-fit"             gboolean              : Read / Write

Default value: FALSE

## Signal Details

### The `"unicapgtk-video-display-predisplay"` signal

    void                user_function                      (UnicapgtkVideoDisplay *unicapgtkvideodisplay,
                                                            gpointer               arg1,
                                                            gpointer               user_data)                  : Run First / Action

`unicapgtkvideodisplay` : | the object which received the signal.
`arg1` : |
`user_data` : | user data set when the signal handler was connected.