Commit 68088f79 authored by Wim Taymans's avatar Wim Taymans

video: add more info in the format structure

Add a field to describe how many bits are used to pack items.
Specify the shift for each component.
Add some more flags to better describe the format.
parent 4fb67fb0
......@@ -36,17 +36,17 @@ typedef struct
GstVideoFormatInfo info;
} VideoFormat;
/* depths */
#define DPTH0 0, { 0, 0, 0, 0 }
#define DPTH8 1, { 8, 0, 0, 0 }
#define DPTH888 3, { 8, 8, 8, 0 }
#define DPTH8888 4, { 8, 8, 8, 8 }
#define DPTH10_10_10 3, { 10, 10, 10, 0 }
#define DPTH16 1, { 16, 0, 0, 0 }
#define DPTH16_16_16 3, { 16, 16, 16, 0 }
#define DPTH16_16_16_16 4, { 16, 16, 16, 16 }
#define DPTH555 3, { 5, 5, 5, 0 }
#define DPTH565 3, { 5, 6, 5, 0 }
/* depths: bits, n_components, shift, depth */
#define DPTH0 0, 0, { 0, 0, 0, 0 }, { 0, 0, 0, 0 }
#define DPTH8 8, 1, { 0, 0, 0, 0 }, { 8, 0, 0, 0 }
#define DPTH888 8, 3, { 0, 0, 0, 0 }, { 8, 8, 8, 0 }
#define DPTH8888 8, 4, { 0, 0, 0, 0 }, { 8, 8, 8, 8 }
#define DPTH10_10_10 10, 3, { 0, 0, 0, 0 }, { 10, 10, 10, 0 }
#define DPTH16 16, 1, { 0, 0, 0, 0 }, { 16, 0, 0, 0 }
#define DPTH16_16_16 16, 3, { 0, 0, 0, 0 }, { 16, 16, 16, 0 }
#define DPTH16_16_16_16 16, 4, { 0, 0, 0, 0 }, { 16, 16, 16, 16 }
#define DPTH555 16, 3, { 10, 5, 0, 0 }, { 5, 5, 5, 0 }
#define DPTH565 16, 3, { 11, 5, 0, 0 }, { 5, 6, 5, 0 }
/* pixel strides */
#define PSTR0 { 0, 0, 0, 0 }
......
......@@ -136,15 +136,23 @@ typedef struct _GstVideoFormatInfo GstVideoFormatInfo;
* with index 0.
* @GST_VIDEO_FORMAT_FLAG_ALPHA: The video format has an alpha components with
* the number 3.
* @GST_VIDEO_FORMAT_FLAG_LE: The video format has data stored in little
* endianness.
* @GST_VIDEO_FORMAT_FLAG_PALETTE: The video format has a palette.
* @GST_VIDEO_FORMAT_FLAG_COMPLEX: The video format has a complex layout that
* can't be described with the usual information in the #GstVideoFormatInfo.
*
* The different video flags that a format info can have.
*/
typedef enum
{
GST_VIDEO_FORMAT_FLAG_YUV = (1 << 0),
GST_VIDEO_FORMAT_FLAG_RGB = (1 << 1),
GST_VIDEO_FORMAT_FLAG_GRAY = (1 << 2),
GST_VIDEO_FORMAT_FLAG_ALPHA = (1 << 3)
GST_VIDEO_FORMAT_FLAG_YUV = (1 << 0),
GST_VIDEO_FORMAT_FLAG_RGB = (1 << 1),
GST_VIDEO_FORMAT_FLAG_GRAY = (1 << 2),
GST_VIDEO_FORMAT_FLAG_ALPHA = (1 << 3),
GST_VIDEO_FORMAT_FLAG_LE = (1 << 4),
GST_VIDEO_FORMAT_FLAG_PALETTE = (1 << 5),
GST_VIDEO_FORMAT_FLAG_COMPLEX = (1 << 6)
} GstVideoFormatFlags;
#define GST_VIDEO_COMP_Y 0
......@@ -162,16 +170,21 @@ typedef enum
* @format: #GstVideoFormat
* @name: string representation of the format
* @flags: #GstVideoFormatFlags
* @bits: The number of bits used to pack data items. This can be 8 when the
* pixels are stored in bytes. for values > 8 multiple bytes should be read
* according to the endianness flag before applying the shift and mask.
* @n_components: the number of components in the video format.
* @depth: the depth for each component
* @shift: the number of bits to shift away to get the component data
* @depth: the depth in bits for each component
* @pixel_stride: the pixel stride of each component. This is the amount of
* bytes to the pixel immediately to the right.
* bytes to the pixel immediately to the right. When bits < 8, the stride is
* expressed in bits.
* @n_planes: the number of planes for this format. The number of planes can be
* less than the amount of components when multiple componets are packed into
* less than the amount of components when multiple components are packed into
* one plane.
* @plane: the plane number where a component can be found
* @offset: the offset in the plane where the first pixel of the components
* can be found.
* can be found. If bits < 8 the amount is specified in bits.
* @w_sub: subsampling factor of the width for the component. Use
* GST_VIDEO_SUB_SCALE to scale a width.
* @h_sub: subsampling factor of the height for the component. Use
......@@ -183,7 +196,9 @@ struct _GstVideoFormatInfo {
GstVideoFormat format;
const gchar *name;
GstVideoFormatFlags flags;
guint bits;
guint n_components;
guint shift[GST_VIDEO_MAX_COMPONENTS];
guint depth[GST_VIDEO_MAX_COMPONENTS];
gint pixel_stride[GST_VIDEO_MAX_COMPONENTS];
guint n_planes;
......
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