## gstvideo

gstvideo — Support library for video operations

## Synopsis

    #include <gst/video/video.h>

    #define             GST_VIDEO_BLUE_MASK_15
    #define             GST_VIDEO_BLUE_MASK_15_INT
    #define             GST_VIDEO_BLUE_MASK_16
    #define             GST_VIDEO_BLUE_MASK_16_INT
    #define             GST_VIDEO_BYTE1_MASK_24
    #define             GST_VIDEO_BYTE1_MASK_24_INT
    #define             GST_VIDEO_BYTE1_MASK_32
    #define             GST_VIDEO_BYTE1_MASK_32_INT
    #define             GST_VIDEO_BYTE2_MASK_24
    #define             GST_VIDEO_BYTE2_MASK_24_INT
    #define             GST_VIDEO_BYTE2_MASK_32
    #define             GST_VIDEO_BYTE2_MASK_32_INT
    #define             GST_VIDEO_BYTE3_MASK_24
    #define             GST_VIDEO_BYTE3_MASK_24_INT
    #define             GST_VIDEO_BYTE3_MASK_32
    #define             GST_VIDEO_BYTE3_MASK_32_INT
    #define             GST_VIDEO_BYTE4_MASK_32
    #define             GST_VIDEO_BYTE4_MASK_32_INT
    #define             GST_VIDEO_CAPS_ABGR
    #define             GST_VIDEO_CAPS_ARGB
    #define             GST_VIDEO_CAPS_BGR
    #define             GST_VIDEO_CAPS_BGRA
    #define             GST_VIDEO_CAPS_BGRx
    #define             GST_VIDEO_CAPS_BGRx_HOST_ENDIAN
    #define             GST_VIDEO_CAPS_RGB
    #define             GST_VIDEO_CAPS_RGBA
    #define             GST_VIDEO_CAPS_RGB_15
    #define             GST_VIDEO_CAPS_RGB_16
    #define             GST_VIDEO_CAPS_RGBx
    #define             GST_VIDEO_CAPS_YUV                  (fourcc)
    #define             GST_VIDEO_CAPS_xBGR
    #define             GST_VIDEO_CAPS_xRGB
    #define             GST_VIDEO_CAPS_xRGB_HOST_ENDIAN
    #define             GST_VIDEO_CAPS_GRAY8
    #define             GST_VIDEO_CAPS_GRAY16               (endianness)
    #define             GST_VIDEO_FPS_RANGE
    #define             GST_VIDEO_GREEN_MASK_15
    #define             GST_VIDEO_GREEN_MASK_15_INT
    #define             GST_VIDEO_GREEN_MASK_16
    #define             GST_VIDEO_GREEN_MASK_16_INT
    #define             GST_VIDEO_RED_MASK_15
    #define             GST_VIDEO_RED_MASK_15_INT
    #define             GST_VIDEO_RED_MASK_16
    #define             GST_VIDEO_RED_MASK_16_INT
    #define             GST_VIDEO_SIZE_RANGE
    #define             GST_VIDEO_BUFFER_TFF
    #define             GST_VIDEO_BUFFER_RFF
    #define             GST_VIDEO_BUFFER_ONEFIELD
    enum                GstVideoFormat;
    gboolean            gst_video_calculate_display_ratio   (guint *dar_n,
                                                             guint *dar_d,
                                                             guint video_width,
                                                             guint video_height,
                                                             guint video_par_n,
                                                             guint video_par_d,
                                                             guint display_par_n,
                                                             guint display_par_d);
    const GValue *      gst_video_frame_rate                (GstPad *pad);
    gboolean            gst_video_get_size                  (GstPad *pad,
                                                             gint *width,
                                                             gint *height);
    gboolean            gst_video_format_convert            (GstVideoFormat format,
                                                             int width,
                                                             int height,
                                                             int fps_n,
                                                             int fps_d,
                                                             GstFormat src_format,
                                                             gint64 src_value,
                                                             GstFormat dest_format,
                                                             gint64 *dest_value);
    GstCaps *           gst_video_format_new_caps           (GstVideoFormat format,
                                                             int width,
                                                             int height,
                                                             int framerate_n,
                                                             int framerate_d,
                                                             int par_n,
                                                             int par_d);
    GstCaps *           gst_video_format_new_caps_interlaced
                                                            (GstVideoFormat format,
                                                             int width,
                                                             int height,
                                                             int framerate_n,
                                                             int framerate_d,
                                                             int par_n,
                                                             int par_d,
                                                             gboolean interlaced);
    int                 gst_video_format_get_component_height
                                                            (GstVideoFormat format,
                                                             int component,
                                                             int height);
    int                 gst_video_format_get_component_offset
                                                            (GstVideoFormat format,
                                                             int component,
                                                             int width,
                                                             int height);
    int                 gst_video_format_get_component_width
                                                            (GstVideoFormat format,
                                                             int component,
                                                             int width);
    int                 gst_video_format_get_pixel_stride   (GstVideoFormat format,
                                                             int component);
    int                 gst_video_format_get_row_stride     (GstVideoFormat format,
                                                             int component,
                                                             int width);
    int                 gst_video_format_get_size           (GstVideoFormat format,
                                                             int width,
                                                             int height);
    gboolean            gst_video_format_has_alpha          (GstVideoFormat format);
    gboolean            gst_video_format_is_rgb             (GstVideoFormat format);
    gboolean            gst_video_format_is_gray            (GstVideoFormat format);
    gboolean            gst_video_format_is_yuv             (GstVideoFormat format);
    guint32             gst_video_format_to_fourcc          (GstVideoFormat format);
    GstVideoFormat      gst_video_format_from_fourcc        (guint32 fourcc);
    gboolean            gst_video_format_parse_caps         (GstCaps *caps,
                                                             GstVideoFormat *format,
                                                             int *width,
                                                             int *height);
    gboolean            gst_video_format_parse_caps_interlaced
                                                            (GstCaps *caps,
                                                             gboolean *interlaced);
    gboolean            gst_video_parse_caps_framerate      (GstCaps *caps,
                                                             int *fps_n,
                                                             int *fps_d);
    gboolean            gst_video_parse_caps_pixel_aspect_ratio
                                                            (GstCaps *caps,
                                                             int *par_n,
                                                             int *par_d);
    const char *        gst_video_parse_caps_color_matrix   (GstCaps *caps);
    const char *        gst_video_parse_caps_chroma_site    (GstCaps *caps);

## Description

This library contains some helper functions and includes the videosink and videofilter base classes.

## Details

### GST_VIDEO_BLUE_MASK_15

    #define GST_VIDEO_BLUE_MASK_15 GST_VIDEO_COMP3_MASK_15

### Warning

`GST_VIDEO_BLUE_MASK_15` is deprecated and should not be used in newly-written code.

### GST_VIDEO_BLUE_MASK_15_INT

    #define GST_VIDEO_BLUE_MASK_15_INT GST_VIDEO_COMP3_MASK_15_INT

### Warning

`GST_VIDEO_BLUE_MASK_15_INT` is deprecated and should not be used in newly-written code.

### GST_VIDEO_BLUE_MASK_16

    #define GST_VIDEO_BLUE_MASK_16 GST_VIDEO_COMP3_MASK_16

### Warning

`GST_VIDEO_BLUE_MASK_16` is deprecated and should not be used in newly-written code.

### GST_VIDEO_BLUE_MASK_16_INT

    #define GST_VIDEO_BLUE_MASK_16_INT GST_VIDEO_COMP3_MASK_16_INT

### Warning

`GST_VIDEO_BLUE_MASK_16_INT` is deprecated and should not be used in newly-written code.

### GST_VIDEO_BYTE1_MASK_24

    #define GST_VIDEO_BYTE1_MASK_24  "0x00FF0000"

### GST_VIDEO_BYTE1_MASK_24_INT

    #define GST_VIDEO_BYTE1_MASK_24_INT  0x00FF0000

### GST_VIDEO_BYTE1_MASK_32

    #define GST_VIDEO_BYTE1_MASK_32  "0xFF000000"

### GST_VIDEO_BYTE1_MASK_32_INT

    #define GST_VIDEO_BYTE1_MASK_32_INT  0xFF000000

### GST_VIDEO_BYTE2_MASK_24

    #define GST_VIDEO_BYTE2_MASK_24  "0x0000FF00"

### GST_VIDEO_BYTE2_MASK_24_INT

    #define GST_VIDEO_BYTE2_MASK_24_INT  0x0000FF00

### GST_VIDEO_BYTE2_MASK_32

    #define GST_VIDEO_BYTE2_MASK_32  "0x00FF0000"

### GST_VIDEO_BYTE2_MASK_32_INT

    #define GST_VIDEO_BYTE2_MASK_32_INT  0x00FF0000

### GST_VIDEO_BYTE3_MASK_24

    #define GST_VIDEO_BYTE3_MASK_24  "0x000000FF"

### GST_VIDEO_BYTE3_MASK_24_INT

    #define GST_VIDEO_BYTE3_MASK_24_INT  0x000000FF

### GST_VIDEO_BYTE3_MASK_32

    #define GST_VIDEO_BYTE3_MASK_32  "0x0000FF00"

### GST_VIDEO_BYTE3_MASK_32_INT

    #define GST_VIDEO_BYTE3_MASK_32_INT  0x0000FF00

### GST_VIDEO_BYTE4_MASK_32

    #define GST_VIDEO_BYTE4_MASK_32  "0x000000FF"

### GST_VIDEO_BYTE4_MASK_32_INT

    #define GST_VIDEO_BYTE4_MASK_32_INT  0x000000FF

### GST_VIDEO_CAPS_ABGR

    #define             GST_VIDEO_CAPS_ABGR

### GST_VIDEO_CAPS_ARGB

    #define             GST_VIDEO_CAPS_ARGB

### GST_VIDEO_CAPS_BGR

    #define             GST_VIDEO_CAPS_BGR

### GST_VIDEO_CAPS_BGRA

    #define             GST_VIDEO_CAPS_BGRA

### GST_VIDEO_CAPS_BGRx

    #define             GST_VIDEO_CAPS_BGRx

### GST_VIDEO_CAPS_BGRx_HOST_ENDIAN

    #define             GST_VIDEO_CAPS_BGRx_HOST_ENDIAN

### GST_VIDEO_CAPS_RGB

    #define             GST_VIDEO_CAPS_RGB

### GST_VIDEO_CAPS_RGBA

    #define             GST_VIDEO_CAPS_RGBA

### GST_VIDEO_CAPS_RGB_15

    #define             GST_VIDEO_CAPS_RGB_15

### GST_VIDEO_CAPS_RGB_16

    #define             GST_VIDEO_CAPS_RGB_16

### GST_VIDEO_CAPS_RGBx

    #define             GST_VIDEO_CAPS_RGBx

### GST_VIDEO_CAPS_YUV()

    #define             GST_VIDEO_CAPS_YUV(fourcc)

Generic caps string for YUV video, for use in pad templates.

`fourcc` : | YUV fourcc format that describes the pixel layout, as string (e.g. "I420", "YV12", "YUY2", "AYUV", etc.)

### GST_VIDEO_CAPS_xBGR

    #define             GST_VIDEO_CAPS_xBGR

### GST_VIDEO_CAPS_xRGB

    #define             GST_VIDEO_CAPS_xRGB

### GST_VIDEO_CAPS_xRGB_HOST_ENDIAN

    #define             GST_VIDEO_CAPS_xRGB_HOST_ENDIAN

### GST_VIDEO_CAPS_GRAY8

    #define             GST_VIDEO_CAPS_GRAY8

Generic caps string for 8-bit grayscale video, for use in pad templates.

Since 0.10.29

### GST_VIDEO_CAPS_GRAY16()

    #define             GST_VIDEO_CAPS_GRAY16(endianness)

Generic caps string for 16-bit grayscale video, for use in pad templates.

`endianness` : | endianness as string, ie. either "1234", "4321", "BIG_ENDIAN" or "LITTLE_ENDIAN"

Since 0.10.29

### GST_VIDEO_FPS_RANGE

    #define GST_VIDEO_FPS_RANGE "(fraction) [ 0, max ]"

### GST_VIDEO_GREEN_MASK_15

    #define GST_VIDEO_GREEN_MASK_15 GST_VIDEO_COMP2_MASK_15

### Warning

`GST_VIDEO_GREEN_MASK_15` is deprecated and should not be used in newly-written code.

### GST_VIDEO_GREEN_MASK_15_INT

    #define GST_VIDEO_GREEN_MASK_15_INT GST_VIDEO_COMP2_MASK_15_INT

### Warning

`GST_VIDEO_GREEN_MASK_15_INT` is deprecated and should not be used in newly-written code.

### GST_VIDEO_GREEN_MASK_16

    #define GST_VIDEO_GREEN_MASK_16 GST_VIDEO_COMP2_MASK_16

### Warning

`GST_VIDEO_GREEN_MASK_16` is deprecated and should not be used in newly-written code.

### GST_VIDEO_GREEN_MASK_16_INT

    #define GST_VIDEO_GREEN_MASK_16_INT GST_VIDEO_COMP2_MASK_16_INT

### Warning

`GST_VIDEO_GREEN_MASK_16_INT` is deprecated and should not be used in newly-written code.

### GST_VIDEO_RED_MASK_15

    #define GST_VIDEO_RED_MASK_15 GST_VIDEO_COMP1_MASK_15

### Warning

`GST_VIDEO_RED_MASK_15` is deprecated and should not be used in newly-written code.

### GST_VIDEO_RED_MASK_15_INT

    #define GST_VIDEO_RED_MASK_15_INT GST_VIDEO_COMP1_MASK_15_INT

### Warning

`GST_VIDEO_RED_MASK_15_INT` is deprecated and should not be used in newly-written code.

### GST_VIDEO_RED_MASK_16

    #define GST_VIDEO_RED_MASK_16 GST_VIDEO_COMP1_MASK_16

### Warning

`GST_VIDEO_RED_MASK_16` is deprecated and should not be used in newly-written code.

### GST_VIDEO_RED_MASK_16_INT

    #define GST_VIDEO_RED_MASK_16_INT GST_VIDEO_COMP1_MASK_16_INT

### Warning

`GST_VIDEO_RED_MASK_16_INT` is deprecated and should not be used in newly-written code.

### GST_VIDEO_SIZE_RANGE

    #define GST_VIDEO_SIZE_RANGE "(int) [ 1, max ]"

### GST_VIDEO_BUFFER_TFF

    #define GST_VIDEO_BUFFER_TFF GST_BUFFER_FLAG_MEDIA1

If the GstBuffer is interlaced, then the first field in the video frame is the top field. If unset, the bottom field is first.

Since 0.10.23

### GST_VIDEO_BUFFER_RFF

    #define GST_VIDEO_BUFFER_RFF GST_BUFFER_FLAG_MEDIA2

If the GstBuffer is interlaced, then the first field (as defined by the `GST_VIDEO_BUFFER_TFF` flag setting) is repeated.

Since 0.10.23

### GST_VIDEO_BUFFER_ONEFIELD

    #define GST_VIDEO_BUFFER_ONEFIELD GST_BUFFER_FLAG_MEDIA3

If the GstBuffer is interlaced, then only the first field (as defined by the `GST_VIDEO_BUFFER_TFF` flag setting) is to be displayed.

Since 0.10.23

### enum GstVideoFormat

    typedef enum {
      GST_VIDEO_FORMAT_UNKNOWN,
      GST_VIDEO_FORMAT_I420,
      GST_VIDEO_FORMAT_YV12,
      GST_VIDEO_FORMAT_YUY2,
      GST_VIDEO_FORMAT_UYVY,
      GST_VIDEO_FORMAT_AYUV,
      GST_VIDEO_FORMAT_RGBx,
      GST_VIDEO_FORMAT_BGRx,
      GST_VIDEO_FORMAT_xRGB,
      GST_VIDEO_FORMAT_xBGR,
      GST_VIDEO_FORMAT_RGBA,
      GST_VIDEO_FORMAT_BGRA,
      GST_VIDEO_FORMAT_ARGB,
      GST_VIDEO_FORMAT_ABGR,
      GST_VIDEO_FORMAT_RGB,
      GST_VIDEO_FORMAT_BGR,
      GST_VIDEO_FORMAT_Y41B,
      GST_VIDEO_FORMAT_Y42B,
      GST_VIDEO_FORMAT_YVYU,
      GST_VIDEO_FORMAT_Y444,
      GST_VIDEO_FORMAT_v210,
      GST_VIDEO_FORMAT_v216,
      GST_VIDEO_FORMAT_NV12,
      GST_VIDEO_FORMAT_NV21,
      GST_VIDEO_FORMAT_GRAY8,
      GST_VIDEO_FORMAT_GRAY16_BE,
      GST_VIDEO_FORMAT_GRAY16_LE,
      GST_VIDEO_FORMAT_v308,
      GST_VIDEO_FORMAT_Y800,
      GST_VIDEO_FORMAT_Y16,
      GST_VIDEO_FORMAT_RGB16,
      GST_VIDEO_FORMAT_BGR16,
      GST_VIDEO_FORMAT_RGB15,
      GST_VIDEO_FORMAT_BGR15
    } GstVideoFormat;

Enum value describing the most common video formats.

`GST_VIDEO_FORMAT_UNKNOWN` | Unknown or unset video format id
`GST_VIDEO_FORMAT_I420` | planar 4:2:0 YUV
`GST_VIDEO_FORMAT_YV12` | planar 4:2:0 YVU (like I420 but UV planes swapped)
`GST_VIDEO_FORMAT_YUY2` | packed 4:2:2 YUV (Y0-U0-Y1-V0 Y2-U2-Y3-V2 Y4 ...)
`GST_VIDEO_FORMAT_UYVY` | packed 4:2:2 YUV (U0-Y0-V0-Y1 U2-Y2-V2-Y3 U4 ...)
`GST_VIDEO_FORMAT_AYUV` | packed 4:4:4 YUV with alpha channel (A0-Y0-U0-V0 ...)
`GST_VIDEO_FORMAT_RGBx` | sparse rgb packed into 32 bit, space last
`GST_VIDEO_FORMAT_BGRx` | sparse reverse rgb packed into 32 bit, space last
`GST_VIDEO_FORMAT_xRGB` | sparse rgb packed into 32 bit, space first
`GST_VIDEO_FORMAT_xBGR` | sparse reverse rgb packed into 32 bit, space first
`GST_VIDEO_FORMAT_RGBA` | rgb with alpha channel last
`GST_VIDEO_FORMAT_BGRA` | reverse rgb with alpha channel last
`GST_VIDEO_FORMAT_ARGB` | rgb with alpha channel first
`GST_VIDEO_FORMAT_ABGR` | reverse rgb with alpha channel first
`GST_VIDEO_FORMAT_RGB` | rgb
`GST_VIDEO_FORMAT_BGR` | reverse rgb
`GST_VIDEO_FORMAT_Y41B` | planar 4:1:1 YUV (Since: 0.10.18)
`GST_VIDEO_FORMAT_Y42B` | planar 4:2:2 YUV (Since: 0.10.18)
`GST_VIDEO_FORMAT_YVYU` | packed 4:2:2 YUV (Y0-V0-Y1-U0 Y2-V2-Y3-U2 Y4 ...) (Since: 0.10.23)
`GST_VIDEO_FORMAT_Y444` | planar 4:4:4 YUV (Since: 0.10.24)
`GST_VIDEO_FORMAT_v210` | packed 4:2:2 10-bit YUV, complex format (Since: 0.10.24)
`GST_VIDEO_FORMAT_v216` | packed 4:2:2 16-bit YUV, Y0-U0-Y1-V1 order (Since: 0.10.24)
`GST_VIDEO_FORMAT_NV12` | planar 4:2:0 YUV with interleaved UV plane (Since: 0.10.26)
`GST_VIDEO_FORMAT_NV21` | planar 4:2:0 YUV with interleaved VU plane (Since: 0.10.26)
`GST_VIDEO_FORMAT_GRAY8` | 8-bit grayscale (Since: 0.10.29)
`GST_VIDEO_FORMAT_GRAY16_BE` | 16-bit grayscale, most significant byte first (Since: 0.10.29)
`GST_VIDEO_FORMAT_GRAY16_LE` | 16-bit grayscale, least significant byte first (Since: 0.10.29)
`GST_VIDEO_FORMAT_v308` | packed 4:4:4 YUV (Since: 0.10.29)
`GST_VIDEO_FORMAT_Y800` | same as GST_VIDEO_FORMAT_GRAY8 (Since: 0.10.30)
`GST_VIDEO_FORMAT_Y16` | same as GST_VIDEO_FORMAT_GRAY16_LE (Since: 0.10.30)
`GST_VIDEO_FORMAT_RGB16` | rgb 5-6-5 bits per component (Since: 0.10.30)
`GST_VIDEO_FORMAT_BGR16` | reverse rgb 5-6-5 bits per component (Since: 0.10.30)
`GST_VIDEO_FORMAT_RGB15` | rgb 5-5-5 bits per component (Since: 0.10.30)
`GST_VIDEO_FORMAT_BGR15` | reverse rgb 5-5-5 bits per component (Since: 0.10.30)

### gst_video_calculate_display_ratio ()

    gboolean            gst_video_calculate_display_ratio   (guint *dar_n,
                                                             guint *dar_d,
                                                             guint video_width,
                                                             guint video_height,
                                                             guint video_par_n,
                                                             guint video_par_d,
                                                             guint display_par_n,
                                                             guint display_par_d);

Given the Pixel Aspect Ratio and size of an input video frame, and the pixel aspect ratio of the intended display device, calculates the actual display ratio the video will be rendered with.

`dar_n` : | Numerator of the calculated display_ratio
`dar_d` : | Denominator of the calculated display_ratio
`video_width` : | Width of the video frame in pixels
`video_height` : | Height of the video frame in pixels
`video_par_n` : | Numerator of the pixel aspect ratio of the input video.
`video_par_d` : | Denominator of the pixel aspect ratio of the input video.
`display_par_n` : | Numerator of the pixel aspect ratio of the display device
`display_par_d` : | Denominator of the pixel aspect ratio of the display device
Returns : | A boolean indicating success and a calculated Display Ratio in the dar_n and dar_d parameters. The return value is FALSE in the case of integer overflow or other error.

Since 0.10.7

### gst_video_frame_rate ()

    const GValue *      gst_video_frame_rate                (GstPad *pad);

A convenience function to retrieve a GValue holding the framerate from the caps on a pad.

The pad needs to have negotiated caps containing a framerate property.

`pad` : | pointer to a GstPad
Returns : | NULL if the pad has no configured caps or the configured caps do not contain a framerate.

### gst_video_get_size ()

    gboolean            gst_video_get_size                  (GstPad *pad,
                                                             gint *width,
                                                             gint *height);

Inspect the caps of the provided pad and retrieve the width and height of the video frames it is configured for.

The pad needs to have negotiated caps containing width and height properties.

`pad` : | pointer to a GstPad
`width` : | pointer to integer to hold pixel width of the video frames (output)
`height` : | pointer to integer to hold pixel height of the video frames (output)
Returns : | TRUE if the width and height could be retrieved.

### gst_video_format_convert ()

    gboolean            gst_video_format_convert            (GstVideoFormat format,
                                                             int width,
                                                             int height,
                                                             int fps_n,
                                                             int fps_d,
                                                             GstFormat src_format,
                                                             gint64 src_value,
                                                             GstFormat dest_format,
                                                             gint64 *dest_value);

Converts among various GstFormat types. This function handles GST_FORMAT_BYTES, GST_FORMAT_TIME, and GST_FORMAT_DEFAULT. For raw video, GST_FORMAT_DEFAULT corresponds to video frames. This function can be to handle pad queries of the type GST_QUERY_CONVERT.

`format` : | a GstVideoFormat
`width` : | the width of video
`height` : | the height of video
`fps_n` : | frame rate numerator
`fps_d` : | frame rate denominator
`src_format` : | GstFormat of the `src_value`
`src_value` : | value to convert
`dest_format` : | GstFormat of the `dest_value`
`dest_value` : | pointer to destination value
Returns : | TRUE if the conversion was successful.

Since 0.10.16

### gst_video_format_new_caps ()

    GstCaps *           gst_video_format_new_caps           (GstVideoFormat format,
                                                             int width,
                                                             int height,
                                                             int framerate_n,
                                                             int framerate_d,
                                                             int par_n,
                                                             int par_d);

Creates a new GstCaps object based on the parameters provided.

`format` : | the GstVideoFormat describing the raw video format
`width` : | width of video
`height` : | height of video
`framerate_n` : | numerator of frame rate
`framerate_d` : | denominator of frame rate
`par_n` : | numerator of pixel aspect ratio
`par_d` : | denominator of pixel aspect ratio
Returns : | a new GstCaps object, or NULL if there was an error

Since 0.10.16

### gst_video_format_new_caps_interlaced ()

    GstCaps *           gst_video_format_new_caps_interlaced
                                                            (GstVideoFormat format,
                                                             int width,
                                                             int height,
                                                             int framerate_n,
                                                             int framerate_d,
                                                             int par_n,
                                                             int par_d,
                                                             gboolean interlaced);

Creates a new GstCaps object based on the parameters provided.

`format` : | the GstVideoFormat describing the raw video format
`width` : | width of video
`height` : | height of video
`framerate_n` : | numerator of frame rate
`framerate_d` : | denominator of frame rate
`par_n` : | numerator of pixel aspect ratio
`par_d` : | denominator of pixel aspect ratio
`interlaced` : | TRUE if the format is interlaced
Returns : | a new GstCaps object, or NULL if there was an error

Since 0.10.23

### gst_video_format_get_component_height ()

    int                 gst_video_format_get_component_height
                                                            (GstVideoFormat format,
                                                             int component,
                                                             int height);

Calculates the height of the component. See `gst_video_format_get_row_stride` for a description of the component index.

`format` : | a GstVideoFormat
`component` : | the component index
`height` : | the height of video
Returns : | height of component `component`

Since 0.10.16

### gst_video_format_get_component_offset ()

    int                 gst_video_format_get_component_offset
                                                            (GstVideoFormat format,
                                                             int component,
                                                             int width,
                                                             int height);

Calculates the offset (in bytes) of the first pixel of the component with index `component`. For packed formats, this will typically be a small integer (0, 1, 2, 3). For planar formats, this will be a (relatively) large offset to the beginning of the second or third component planes. See `gst_video_format_get_row_stride` for a description of the component index.

`format` : | a GstVideoFormat
`component` : | the component index
`width` : | the width of video
`height` : | the height of video
Returns : | offset of component `component`

Since 0.10.16

### gst_video_format_get_component_width ()

    int                 gst_video_format_get_component_width
                                                            (GstVideoFormat format,
                                                             int component,
                                                             int width);

Calculates the width of the component. See `gst_video_format_get_row_stride` for a description of the component index.

`format` : | a GstVideoFormat
`component` : | the component index
`width` : | the width of video
Returns : | width of component `component`

Since 0.10.16

### gst_video_format_get_pixel_stride ()

    int                 gst_video_format_get_pixel_stride   (GstVideoFormat format,
                                                             int component);

Calculates the pixel stride (number of bytes from one pixel to the pixel to its immediate left) for the video component with an index of `component`. See `gst_video_format_get_row_stride` for a description of the component index.

`format` : | a GstVideoFormat
`component` : | the component index
Returns : | pixel stride of component `component`

Since 0.10.16

### gst_video_format_get_row_stride ()

    int                 gst_video_format_get_row_stride     (GstVideoFormat format,
                                                             int component,
                                                             int width);

Calculates the row stride (number of bytes from one row of pixels to the next) for the video component with an index of `component`. For YUV video, Y, U, and V have component indices of 0, 1, and 2, respectively. For RGB video, R, G, and B have component indicies of 0, 1, and 2, respectively. Alpha channels, if present, have a component index of 3. The `width` parameter always represents the width of the video, not the component.

`format` : | a GstVideoFormat
`component` : | the component index
`width` : | the width of video
Returns : | row stride of component `component`

Since 0.10.16

### gst_video_format_get_size ()

    int                 gst_video_format_get_size           (GstVideoFormat format,
                                                             int width,
                                                             int height);

Calculates the total number of bytes in the raw video format. This number should be used when allocating a buffer for raw video.

`format` : | a GstVideoFormat
`width` : | the width of video
`height` : | the height of video
Returns : | size (in bytes) of raw video format

Since 0.10.16

### gst_video_format_has_alpha ()

    gboolean            gst_video_format_has_alpha          (GstVideoFormat format);

Returns TRUE or FALSE depending on if the video format provides an alpha channel.

`format` : | a GstVideoFormat
Returns : | TRUE if `format` has an alpha channel

Since 0.10.16

### gst_video_format_is_rgb ()

    gboolean            gst_video_format_is_rgb             (GstVideoFormat format);

Determine whether the video format is an RGB format.

`format` : | a GstVideoFormat
Returns : | TRUE if `format` represents RGB video

Since 0.10.16

### gst_video_format_is_gray ()

    gboolean            gst_video_format_is_gray            (GstVideoFormat format);

Determine whether the video format is a grayscale format.

`format` : | a GstVideoFormat
Returns : | TRUE if `format` represents grayscale video

Since 0.10.29

### gst_video_format_is_yuv ()

    gboolean            gst_video_format_is_yuv             (GstVideoFormat format);

Determine whether the video format is a YUV format.

`format` : | a GstVideoFormat
Returns : | TRUE if `format` represents YUV video

Since 0.10.16

### gst_video_format_to_fourcc ()

    guint32             gst_video_format_to_fourcc          (GstVideoFormat format);

Converts a GstVideoFormat value into the corresponding FOURCC. Only a few YUV formats have corresponding FOURCC values. If `format` has no corresponding FOURCC value, 0 is returned.

`format` : | a GstVideoFormat video format
Returns : | the FOURCC corresponding to `format`

Since 0.10.16

### gst_video_format_from_fourcc ()

    GstVideoFormat      gst_video_format_from_fourcc        (guint32 fourcc);

Converts a FOURCC value into the corresponding GstVideoFormat. If the FOURCC cannot be represented by GstVideoFormat, GST_VIDEO_FORMAT_UNKNOWN is returned.

`fourcc` : | a FOURCC value representing raw YUV video
Returns : | the GstVideoFormat describing the FOURCC value

Since 0.10.16

### gst_video_format_parse_caps ()

    gboolean            gst_video_format_parse_caps         (GstCaps *caps,
                                                             GstVideoFormat *format,
                                                             int *width,
                                                             int *height);

Determines the GstVideoFormat of `caps` and places it in the location pointed to by `format`. Extracts the size of the video and places it in the location pointed to by `width` and `height`. If `caps` does not represent one of the raw video formats listed in GstVideoFormat, the function will fail and return FALSE.

`caps` : | the GstCaps to parse
`format` : | the GstVideoFormat of the video represented by `caps` (output)
`width` : | the width of the video represented by `caps`, may be NULL (output)
`height` : | the height of the video represented by `caps`, may be NULL (output)
Returns : | TRUE if `caps` was parsed correctly.

Since 0.10.16

### gst_video_format_parse_caps_interlaced ()

    gboolean            gst_video_format_parse_caps_interlaced
                                                            (GstCaps *caps,
                                                             gboolean *interlaced);

Extracts whether the caps represents interlaced content or not and places it in `interlaced`.

`caps` : | the fixed GstCaps to parse
`interlaced` : | whether `caps` represents interlaced video or not, may be NULL (output)
Returns : | TRUE if `caps` was parsed correctly.

Since 0.10.23

### gst_video_parse_caps_framerate ()

    gboolean            gst_video_parse_caps_framerate      (GstCaps *caps,
                                                             int *fps_n,
                                                             int *fps_d);

Extracts the frame rate from `caps` and places the values in the locations pointed to by `fps_n` and `fps_d`. Returns TRUE if the values could be parsed correctly, FALSE if not.

This function can be used with GstCaps that have any media type; it is not limited to formats handled by GstVideoFormat.

`caps` : | pointer to a GstCaps instance
`fps_n` : | pointer to integer to hold numerator of frame rate (output)
`fps_d` : | pointer to integer to hold denominator of frame rate (output)
Returns : | TRUE if `caps` was parsed correctly.

Since 0.10.16

### gst_video_parse_caps_pixel_aspect_ratio ()

    gboolean            gst_video_parse_caps_pixel_aspect_ratio
                                                            (GstCaps *caps,
                                                             int *par_n,
                                                             int *par_d);

Extracts the pixel aspect ratio from `caps` and places the values in the locations pointed to by `par_n` and `par_d`. Returns TRUE if the values could be parsed correctly, FALSE if not.

This function can be used with GstCaps that have any media type; it is not limited to formats handled by GstVideoFormat.

`caps` : | pointer to a GstCaps instance
`par_n` : | pointer to numerator of pixel aspect ratio (output)
`par_d` : | pointer to denominator of pixel aspect ratio (output)
Returns : | TRUE if `caps` was parsed correctly.

Since 0.10.16

### gst_video_parse_caps_color_matrix ()

    const char *        gst_video_parse_caps_color_matrix   (GstCaps *caps);

Extracts the color matrix used by the caps. Possible values are "sdtv" for the standard definition color matrix (as specified in Rec. ITU-R BT.470-6) or "hdtv" for the high definition color matrix (as specified in Rec. ITU-R BT.709)

`caps` : | the fixed GstCaps to parse
Returns : | a color matrix string, or NULL if no color matrix could be determined.

Since 0.10.29

### gst_video_parse_caps_chroma_site ()

    const char *        gst_video_parse_caps_chroma_site    (GstCaps *caps);

Extracts the chroma site used by the caps. Possible values are "mpeg2" for MPEG-2 style chroma siting (co-sited horizontally, halfway-sited vertically), "jpeg" for JPEG and Theora style chroma siting (halfway-sited both horizontally and vertically). Other chroma site values are possible, but uncommon.

When no chroma site is specified in the caps, it should be assumed to be "mpeg2".

`caps` : | the fixed GstCaps to parse
Returns : | a chroma site string, or NULL if no chroma site could be determined.

Since 0.10.29