spa: don't use typedef for struct and enum

This commit is contained in:
Wim Taymans 2017-05-25 13:28:15 +02:00
parent 83964cec87
commit 11f23a3ffa
163 changed files with 6510 additions and 8264 deletions

View file

@ -25,7 +25,7 @@ extern "C" {
#endif
/**
* SpaVideoChromaSite:
* spa_video_chroma_site:
* @SPA_VIDEO_CHROMA_SITE_UNKNOWN: unknown cositing
* @SPA_VIDEO_CHROMA_SITE_NONE: no cositing
* @SPA_VIDEO_CHROMA_SITE_H_COSITED: chroma is horizontally cosited
@ -38,7 +38,7 @@ extern "C" {
*
* Various Chroma sitings.
*/
typedef enum {
enum spa_video_chroma_site {
SPA_VIDEO_CHROMA_SITE_UNKNOWN = 0,
SPA_VIDEO_CHROMA_SITE_NONE = (1 << 0),
SPA_VIDEO_CHROMA_SITE_H_COSITED = (1 << 1),
@ -49,7 +49,7 @@ typedef enum {
SPA_VIDEO_CHROMA_SITE_JPEG = (SPA_VIDEO_CHROMA_SITE_NONE),
SPA_VIDEO_CHROMA_SITE_MPEG2 = (SPA_VIDEO_CHROMA_SITE_H_COSITED),
SPA_VIDEO_CHROMA_SITE_DV = (SPA_VIDEO_CHROMA_SITE_COSITED | SPA_VIDEO_CHROMA_SITE_ALT_LINE),
} SpaVideoChromaSite;
};
#ifdef __cplusplus
} /* extern "C" */

View file

@ -25,7 +25,7 @@ extern "C" {
#endif
/**
* SpaVideoColorRange:
* spa_video_color_range:
* @SPA_VIDEO_COLOR_RANGE_UNKNOWN: unknown range
* @SPA_VIDEO_COLOR_RANGE_0_255: [0..255] for 8 bit components
* @SPA_VIDEO_COLOR_RANGE_16_235: [16..235] for 8 bit components. Chroma has
@ -34,14 +34,14 @@ extern "C" {
* Possible color range values. These constants are defined for 8 bit color
* values and can be scaled for other bit depths.
*/
typedef enum {
enum spa_video_color_range {
SPA_VIDEO_COLOR_RANGE_UNKNOWN = 0,
SPA_VIDEO_COLOR_RANGE_0_255,
SPA_VIDEO_COLOR_RANGE_16_235
} SpaVideoColorRange;
};
/**
* SpaVideoColorMatrix:
* spa_video_color_matrix:
* @SPA_VIDEO_COLOR_MATRIX_UNKNOWN: unknown matrix
* @SPA_VIDEO_COLOR_MATRIX_RGB: identity matrix
* @SPA_VIDEO_COLOR_MATRIX_FCC: FCC color matrix
@ -53,7 +53,7 @@ typedef enum {
* The color matrix is used to convert between Y'PbPr and
* non-linear RGB (R'G'B')
*/
typedef enum {
enum spa_video_color_matrix {
SPA_VIDEO_COLOR_MATRIX_UNKNOWN = 0,
SPA_VIDEO_COLOR_MATRIX_RGB,
SPA_VIDEO_COLOR_MATRIX_FCC,
@ -61,10 +61,10 @@ typedef enum {
SPA_VIDEO_COLOR_MATRIX_BT601,
SPA_VIDEO_COLOR_MATRIX_SMPTE240M,
SPA_VIDEO_COLOR_MATRIX_BT2020
} SpaVideoColorMatrix;
};
/**
* SpaVideoTransferFunction:
* spa_video_transfer_function:
* @SPA_VIDEO_TRANSFER_UNKNOWN: unknown transfer function
* @SPA_VIDEO_TRANSFER_GAMMA10: linear RGB, gamma 1.0 curve
* @SPA_VIDEO_TRANSFER_GAMMA18: Gamma 1.8 curve
@ -89,7 +89,7 @@ typedef enum {
* The video transfer function defines the formula for converting between
* non-linear RGB (R'G'B') and linear RGB
*/
typedef enum {
enum spa_video_transfer_function {
SPA_VIDEO_TRANSFER_UNKNOWN = 0,
SPA_VIDEO_TRANSFER_GAMMA10,
SPA_VIDEO_TRANSFER_GAMMA18,
@ -103,10 +103,10 @@ typedef enum {
SPA_VIDEO_TRANSFER_LOG316,
SPA_VIDEO_TRANSFER_BT2020_12,
SPA_VIDEO_TRANSFER_ADOBERGB
} SpaVideoTransferFunction;
};
/**
* SpaVideoColorPrimaries:
* spa_video_color_primaries:
* @SPA_VIDEO_COLOR_PRIMARIES_UNKNOWN: unknown color primaries
* @SPA_VIDEO_COLOR_PRIMARIES_BT709: BT709 primaries
* @SPA_VIDEO_COLOR_PRIMARIES_BT470M: BT470M primaries
@ -120,7 +120,7 @@ typedef enum {
* The color primaries define the how to transform linear RGB values to and from
* the CIE XYZ colorspace.
*/
typedef enum {
enum spa_video_color_primaries {
SPA_VIDEO_COLOR_PRIMARIES_UNKNOWN = 0,
SPA_VIDEO_COLOR_PRIMARIES_BT709,
SPA_VIDEO_COLOR_PRIMARIES_BT470M,
@ -130,10 +130,10 @@ typedef enum {
SPA_VIDEO_COLOR_PRIMARIES_FILM,
SPA_VIDEO_COLOR_PRIMARIES_BT2020,
SPA_VIDEO_COLOR_PRIMARIES_ADOBERGB
} SpaVideoColorPrimaries;
};
/**
* SpaVideoColorimetry:
* spa_video_colorimetry:
* @range: the color range. This is the valid range for the samples.
* It is used to convert the samples to Y'PbPr values.
* @matrix: the color matrix. Used to convert between Y'PbPr and
@ -143,12 +143,12 @@ typedef enum {
*
* Structure describing the color info.
*/
typedef struct {
SpaVideoColorRange range;
SpaVideoColorMatrix matrix;
SpaVideoTransferFunction transfer;
SpaVideoColorPrimaries primaries;
} SpaVideoColorimetry;
struct spa_video_colorimetry {
enum spa_video_color_range range;
enum spa_video_color_matrix matrix;
enum spa_video_transfer_function transfer;
enum spa_video_color_primaries primaries;
};
#ifdef __cplusplus
} /* extern "C" */

View file

@ -24,37 +24,37 @@
extern "C" {
#endif
typedef struct _SpaVideoInfoH264 SpaVideoInfoH264;
typedef struct _SpaVideoInfoMJPG SpaVideoInfoMJPG;
struct spa_video_info_h264;
struct spa_video_info_mjpg;
#include <spa/format.h>
#include <spa/video/format.h>
typedef enum {
enum spa_h264_stream_format {
SPA_H264_STREAM_FORMAT_UNKNOWN = 0,
SPA_H264_STREAM_FORMAT_AVC,
SPA_H264_STREAM_FORMAT_AVC3,
SPA_H264_STREAM_FORMAT_BYTESTREAM
} SpaH264StreamFormat;
};
typedef enum {
enum spa_h264_alignment {
SPA_H264_ALIGNMENT_UNKNOWN = 0,
SPA_H264_ALIGNMENT_AU,
SPA_H264_ALIGNMENT_NAL
} SpaH264Alignment;
struct _SpaVideoInfoH264 {
SpaRectangle size;
SpaFraction framerate;
SpaFraction max_framerate;
SpaH264StreamFormat stream_format;
SpaH264Alignment alignment;
};
struct _SpaVideoInfoMJPG {
SpaRectangle size;
SpaFraction framerate;
SpaFraction max_framerate;
struct spa_video_info_h264 {
struct spa_rectangle size;
struct spa_fraction framerate;
struct spa_fraction max_framerate;
enum spa_h264_stream_format stream_format;
enum spa_h264_alignment alignment;
};
struct spa_video_info_mjpg {
struct spa_rectangle size;
struct spa_fraction framerate;
struct spa_fraction max_framerate;
};
#ifdef __cplusplus

View file

@ -28,7 +28,7 @@ extern "C" {
#include <spa/video/format.h>
#include <spa/video/raw-utils.h>
typedef struct {
struct spa_type_format_video {
uint32_t format;
uint32_t size;
uint32_t framerate;
@ -47,10 +47,10 @@ typedef struct {
uint32_t level;
uint32_t stream_format;
uint32_t alignment;
} SpaTypeFormatVideo;
};
static inline void
spa_type_format_video_map (SpaTypeMap *map, SpaTypeFormatVideo *type)
spa_type_format_video_map (struct spa_type_map *map, struct spa_type_format_video *type)
{
if (type->format == 0) {
type->format = spa_type_map_get_id (map, SPA_TYPE_FORMAT_VIDEO__format);
@ -75,9 +75,9 @@ spa_type_format_video_map (SpaTypeMap *map, SpaTypeFormatVideo *type)
}
static inline bool
spa_format_video_raw_parse (const SpaFormat *format,
SpaVideoInfoRaw *info,
SpaTypeFormatVideo *type)
spa_format_video_raw_parse (const struct spa_format *format,
struct spa_video_info_raw *info,
struct spa_type_format_video *type)
{
spa_format_query (format,
type->format, SPA_POD_TYPE_ID, &info->format,
@ -99,9 +99,9 @@ spa_format_video_raw_parse (const SpaFormat *format,
}
static inline bool
spa_format_video_h264_parse (const SpaFormat *format,
SpaVideoInfoH264 *info,
SpaTypeFormatVideo *type)
spa_format_video_h264_parse (const struct spa_format *format,
struct spa_video_info_h264 *info,
struct spa_type_format_video *type)
{
spa_format_query (format,
type->size, SPA_POD_TYPE_RECTANGLE, &info->size,
@ -114,9 +114,9 @@ spa_format_video_h264_parse (const SpaFormat *format,
}
static inline bool
spa_format_video_mjpg_parse (const SpaFormat *format,
SpaVideoInfoMJPG *info,
SpaTypeFormatVideo *type)
spa_format_video_mjpg_parse (const struct spa_format *format,
struct spa_video_info_mjpg *info,
struct spa_type_format_video *type)
{
spa_format_query (format,
type->size, SPA_POD_TYPE_RECTANGLE, &info->size,

View file

@ -28,8 +28,6 @@ extern "C" {
#include <spa/video/raw.h>
#include <spa/video/encoded.h>
typedef struct _SpaVideoInfo SpaVideoInfo;
#define SPA_TYPE_FORMAT__Video SPA_TYPE_FORMAT_BASE "Video"
#define SPA_TYPE_FORMAT_VIDEO_BASE SPA_TYPE_FORMAT__Video ":"
@ -52,13 +50,13 @@ typedef struct _SpaVideoInfo SpaVideoInfo;
#define SPA_TYPE_FORMAT_VIDEO__streamFormat SPA_TYPE_FORMAT_VIDEO_BASE "stream-format"
#define SPA_TYPE_FORMAT_VIDEO__alignment SPA_TYPE_FORMAT_VIDEO_BASE "alignment"
struct _SpaVideoInfo {
struct spa_video_info {
uint32_t media_type;
uint32_t media_subtype;
union {
SpaVideoInfoRaw raw;
SpaVideoInfoH264 h264;
SpaVideoInfoMJPG mjpg;
struct spa_video_info_raw raw;
struct spa_video_info_h264 h264;
struct spa_video_info_mjpg mjpg;
} info;
};

View file

@ -25,9 +25,9 @@ extern "C" {
#endif
/**
* SpaVideoMultiviewMode:
* spa_video_multiview_mode:
* @SPA_VIDEO_MULTIVIEW_MODE_NONE: A special value indicating
* no multiview information. Used in SpaVideoInfo and other places to
* no multiview information. Used in spa_video_info and other places to
* indicate that no specific multiview handling has been requested or
* provided. This value is never carried on caps.
* @SPA_VIDEO_MULTIVIEW_MODE_MONO: All frames are monoscopic.
@ -53,18 +53,17 @@ extern "C" {
* @SPA_VIDEO_MULTIVIEW_MODE_MULTIVIEW_FRAME_BY_FRAME: Multiple
* independent views are provided in separate frames in sequence.
* This method only applies to raw video buffers at the moment.
* Specific view identification is via the #SpaVideoMultiviewMeta
* and #SpaVideoMeta(s) on raw video buffers.
* Specific view identification is via the #spa_video_multiview_meta
* on raw video buffers.
* @SPA_VIDEO_MULTIVIEW_MODE_SEPARATED: Multiple views are
* provided as separate #SpaMemory framebuffers attached to each
* #SpaBuffer, described by the #SpaVideoMultiviewMeta
* and #SpaVideoMeta(s)
* provided as separate #spa_data framebuffers attached to each
* #spa_buffer, described by the #spa_video_multiview_meta
*
* All possible stereoscopic 3D and multiview representations.
* In conjunction with #SpaVideoMultiviewFlags, describes how
* In conjunction with #soa_video_multiview_flags, describes how
* multiview content is being transported in the stream.
*/
typedef enum {
enum spa_video_multiview_mode {
SPA_VIDEO_MULTIVIEW_MODE_NONE = -1,
SPA_VIDEO_MULTIVIEW_MODE_MONO = 0,
/* Single view modes */
@ -84,10 +83,10 @@ typedef enum {
SPA_VIDEO_MULTIVIEW_MODE_MULTIVIEW_FRAME_BY_FRAME,
SPA_VIDEO_MULTIVIEW_MODE_SEPARATED
/* future expansion for annotated modes */
} SpaVideoMultiviewMode;
};
/**
* SpaVideoMultiviewFlags:
* spa_video_multiview_flags:
* @SPA_VIDEO_MULTIVIEW_FLAGS_NONE: No flags
* @SPA_VIDEO_MULTIVIEW_FLAGS_RIGHT_VIEW_FIRST: For stereo streams, the
* normal arrangement of left and right views is reversed.
@ -113,11 +112,11 @@ typedef enum {
* absence or presence of the @SPA_VIDEO_BUFFER_FLAG_MULTIPLE_VIEW
* buffer flag.
*
* SpaVideoMultiviewFlags are used to indicate extra properties of a
* spa_video_multiview_flags are used to indicate extra properties of a
* stereo/multiview stream beyond the frame layout and buffer mapping
* that is conveyed in the #SpaMultiviewMode.
* that is conveyed in the #spa_video_multiview_mode.
*/
typedef enum {
enum spa_video_multiview_flags {
SPA_VIDEO_MULTIVIEW_FLAGS_NONE = 0,
SPA_VIDEO_MULTIVIEW_FLAGS_RIGHT_VIEW_FIRST = (1 << 0),
SPA_VIDEO_MULTIVIEW_FLAGS_LEFT_FLIPPED = (1 << 1),
@ -126,7 +125,7 @@ typedef enum {
SPA_VIDEO_MULTIVIEW_FLAGS_RIGHT_FLOPPED = (1 << 4),
SPA_VIDEO_MULTIVIEW_FLAGS_HALF_ASPECT = (1 << 14),
SPA_VIDEO_MULTIVIEW_FLAGS_MIXED_MONO = (1 << 15)
} SpaVideoMultiviewFlags;
};
#ifdef __cplusplus

View file

@ -24,13 +24,10 @@
extern "C" {
#endif
typedef struct _SpaVideoInfoRaw SpaVideoInfoRaw;
#include <spa/type-map.h>
#include <spa/video/raw.h>
typedef struct
{
struct spa_type_video_format {
uint32_t UNKNOWN;
uint32_t ENCODED;
uint32_t I420;
@ -109,10 +106,10 @@ typedef struct
uint32_t I422_12LE;
uint32_t Y444_12BE;
uint32_t Y444_12LE;
} SpaTypeVideoFormat;
};
static inline void
spa_type_video_format_map (SpaTypeMap *map, SpaTypeVideoFormat *type)
spa_type_video_format_map (struct spa_type_map *map, struct spa_type_video_format *type)
{
if (type->ENCODED == 0) {
type->UNKNOWN = 0;

View file

@ -24,8 +24,6 @@
extern "C" {
#endif
typedef struct _SpaVideoInfoRaw SpaVideoInfoRaw;
#include <spa/props.h>
#include <spa/video/chroma.h>
#include <spa/video/color.h>
@ -116,7 +114,7 @@ typedef struct _SpaVideoInfoRaw SpaVideoInfoRaw;
#define SPA_TYPE_VIDEO_FORMAT__Y444_12LE SPA_TYPE_VIDEO_FORMAT_BASE "Y444_12LE"
/**
* SpaVideoFlags:
* spa_video_flags:
* @SPA_VIDEO_FLAG_NONE: no flags
* @SPA_VIDEO_FLAG_VARIABLE_FPS: a variable fps is selected, fps_n and fps_d
* denote the maximum fps of the video
@ -125,14 +123,14 @@ typedef struct _SpaVideoInfoRaw SpaVideoInfoRaw;
*
* Extra video flags
*/
typedef enum {
enum spa_video_flags {
SPA_VIDEO_FLAG_NONE = 0,
SPA_VIDEO_FLAG_VARIABLE_FPS = (1 << 0),
SPA_VIDEO_FLAG_PREMULTIPLIED_ALPHA = (1 << 1)
} SpaVideoFlags;
};
/**
* SpaVideoInterlaceMode:
* spa_video_interlace_mode:
* @SPA_VIDEO_INTERLACE_MODE_PROGRESSIVE: all frames are progressive
* @SPA_VIDEO_INTERLACE_MODE_INTERLEAVED: 2 fields are interleaved in one video
* frame. Extra buffer flags describe the field order.
@ -143,21 +141,21 @@ typedef enum {
* 'views' property > 1) the fields of view N can be found at frame ID
* (N * 2) and (N * 2) + 1.
* Each field has only half the amount of lines as noted in the
* height property. This mode requires multiple SpaVideoMeta metadata
* height property. This mode requires multiple spa_data
* to describe the fields.
*
* The possible values of the #SpaVideoInterlaceMode describing the interlace
* The possible values of the #spa_video_interlace_mode describing the interlace
* mode of the stream.
*/
typedef enum {
enum spa_video_interlace_mode {
SPA_VIDEO_INTERLACE_MODE_PROGRESSIVE = 0,
SPA_VIDEO_INTERLACE_MODE_INTERLEAVED,
SPA_VIDEO_INTERLACE_MODE_MIXED,
SPA_VIDEO_INTERLACE_MODE_FIELDS
} SpaVideoInterlaceMode;
};
/**
* SpaVideoInfoRaw:
* spa_video_info_raw:
* @format: the format
* @size: the frame size of the video
* @framerate: the framerate of the video 0/1 means variable rate
@ -176,21 +174,21 @@ typedef enum {
* @transfer_function: the transfer function. used to convert between R'G'B' and RGB
* @color_primaries: color primaries. used to convert between R'G'B' and CIE XYZ
*/
struct _SpaVideoInfoRaw {
uint32_t format;
SpaRectangle size;
SpaFraction framerate;
SpaFraction max_framerate;
uint32_t views;
SpaVideoInterlaceMode interlace_mode;
SpaFraction pixel_aspect_ratio;
SpaVideoMultiviewMode multiview_mode;
SpaVideoMultiviewFlags multiview_flags;
SpaVideoChromaSite chroma_site;
SpaVideoColorRange color_range;
SpaVideoColorMatrix color_matrix;
SpaVideoTransferFunction transfer_function;
SpaVideoColorPrimaries color_primaries;
struct spa_video_info_raw {
uint32_t format;
struct spa_rectangle size;
struct spa_fraction framerate;
struct spa_fraction max_framerate;
uint32_t views;
enum spa_video_interlace_mode interlace_mode;
struct spa_fraction pixel_aspect_ratio;
enum spa_video_multiview_mode multiview_mode;
enum spa_video_multiview_flags multiview_flags;
enum spa_video_chroma_site chroma_site;
enum spa_video_color_range color_range;
enum spa_video_color_matrix color_matrix;
enum spa_video_transfer_function transfer_function;
enum spa_video_color_primaries color_primaries;
};
#ifdef __cplusplus