Commit 37e7d741 authored by Wim Taymans's avatar Wim Taymans

video: add pack and unpack functions

Add pack and unpack function to handle complex formats in the future.
parent 68088f79
......@@ -165,6 +165,44 @@ typedef enum
#define GST_VIDEO_COMP_A 3
/**
* GstVideoFormatUnpack:
* @info: a #GstVideoFormatInfo
* @dest: a destination array
* @data: pointers to the data planes
* @stride: strides of the planes
* @x: the x position in the image to start from
* @y: the y position in the image to start from
* @width: the amount of pixels to unpack.
*
* Unpacks @width pixels from the given planes and strides containing data of
* format @info. The pixels will be unpacked into @dest which each component
* interleaved. @dest should at least be big enough to hold @width *
* n_components * unpack_size bytes.
*/
typedef void (*GstVideoFormatUnpack) (GstVideoFormatInfo *info, gpointer dest,
const gpointer data[GST_VIDEO_MAX_PLANES],
const gint stride[GST_VIDEO_MAX_PLANES],
gint x, gint y, gint width);
/**
* GstVideoFormatPack:
* @info: a #GstVideoFormatInfo
* @src: a source array
* @data: pointers to the destination data planes
* @stride: strides of the destination planes
* @x: the x position in the image to pack to
* @y: the y position in the image to pack to
* @width: the amount of pixels to pack.
*
* Packs @width pixels from @src to the given planes and strides in the
* format @info. The pixels from source have each component interleaved
* and will be packed into @src.
*/
typedef void (*GstVideoFormatPack) (GstVideoFormatInfo *info, const gpointer src,
gpointer data[GST_VIDEO_MAX_PLANES],
const gint stride[GST_VIDEO_MAX_PLANES],
gint x, gint y, gint width);
/**
* GstVideoFormatInfo:
* @format: #GstVideoFormat
......@@ -189,6 +227,10 @@ typedef enum
* GST_VIDEO_SUB_SCALE to scale a width.
* @h_sub: subsampling factor of the height for the component. Use
* GST_VIDEO_SUB_SCALE to scale a height.
* @unpack_size: the size in bytes of each component item in the unpacked
* format.
* @unpack_func: an unpack function for this format
* @pack_func: an pack function for this format
*
* Information for a video format.
*/
......@@ -206,6 +248,10 @@ struct _GstVideoFormatInfo {
guint offset[GST_VIDEO_MAX_COMPONENTS];
guint w_sub[GST_VIDEO_MAX_COMPONENTS];
guint h_sub[GST_VIDEO_MAX_COMPONENTS];
guint unpack_size;
GstVideoFormatUnpack unpack_func;
GstVideoFormatPack pack_func;
};
#define GST_VIDEO_FORMAT_INFO_FORMAT(info) ((info)->format)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment