spa: Add buffer meta information VideoTransform

This metadata can be used to signal that a buffer is transformed.
The values are intentionally choosen to coincide with
wl_output::transform from the wayland windowsystem.
This commit is contained in:
columbarius 2022-10-23 21:32:34 +02:00 committed by Wim Taymans
parent f038e3f238
commit 01b2552b71
2 changed files with 32 additions and 10 deletions

View file

@ -39,16 +39,17 @@ extern "C" {
enum spa_meta_type {
SPA_META_Invalid,
SPA_META_Header, /**< struct spa_meta_header */
SPA_META_VideoCrop, /**< struct spa_meta_region with cropping data */
SPA_META_VideoDamage, /**< array of struct spa_meta_region with damage, where an invalid entry or end-of-array marks the end. */
SPA_META_Bitmap, /**< struct spa_meta_bitmap */
SPA_META_Cursor, /**< struct spa_meta_cursor */
SPA_META_Control, /**< metadata contains a spa_meta_control
* associated with the data */
SPA_META_Busy, /**< don't write to buffer when count > 0 */
SPA_META_Header, /**< struct spa_meta_header */
SPA_META_VideoCrop, /**< struct spa_meta_region with cropping data */
SPA_META_VideoDamage, /**< array of struct spa_meta_region with damage, where an invalid entry or end-of-array marks the end. */
SPA_META_Bitmap, /**< struct spa_meta_bitmap */
SPA_META_Cursor, /**< struct spa_meta_cursor */
SPA_META_Control, /**< metadata contains a spa_meta_control
* associated with the data */
SPA_META_Busy, /**< don't write to buffer when count > 0 */
SPA_META_VideoTransform, /**< struct spa_meta_transform */
_SPA_META_LAST, /**< not part of ABI/API */
_SPA_META_LAST, /**< not part of ABI/API */
};
/**
@ -161,6 +162,24 @@ struct spa_meta_busy {
uint32_t count; /**< number of users busy with the buffer */
};
enum spa_meta_videotransform_value {
SPA_META_TRANSFORMATION_None = 0, /**< no transform */
SPA_META_TRANSFORMATION_90, /**< 90 degree counter-clockwise */
SPA_META_TRANSFORMATION_180, /**< 180 degree counter-clockwise */
SPA_META_TRANSFORMATION_270, /**< 270 degree counter-clockwise */
SPA_META_TRANSFORMATION_Flipped, /**< 180 degree flipped around the vertical axis. Equivalent
* to a reflexion through the vertical line splitting the
* bufffer in two equal sized parts */
SPA_META_TRANSFORMATION_Flipped90, /**< flip then rotate around 90 degree counter-clockwise */
SPA_META_TRANSFORMATION_Flipped180, /**< flip then rotate around 180 degree counter-clockwise */
SPA_META_TRANSFORMATION_Flipped270, /**< flip then rotate around 270 degree counter-clockwise */
};
/** a transformation of the buffer */
struct spa_meta_videotransform {
uint32_t transform; /**< orientation transformation that was applied to the buffer */
};
/**
* \}
*/

View file

@ -47,7 +47,8 @@ PWTEST(buffer_abi_types)
pwtest_int_eq(SPA_META_Cursor, 5);
pwtest_int_eq(SPA_META_Control, 6);
pwtest_int_eq(SPA_META_Busy, 7);
pwtest_int_eq(_SPA_META_LAST, 8);
pwtest_int_eq(SPA_META_VideoTransform, 8);
pwtest_int_eq(_SPA_META_LAST, 9);
return PWTEST_PASS;
}
@ -64,6 +65,7 @@ PWTEST(buffer_abi_sizes)
pwtest_int_eq(sizeof(struct spa_meta_region), 16U);
pwtest_int_eq(sizeof(struct spa_meta_bitmap), 20U);
pwtest_int_eq(sizeof(struct spa_meta_cursor), 28U);
pwtest_int_eq(sizeof(struct spa_meta_videotransform), 4U);
return PWTEST_PASS;
#else
@ -75,6 +77,7 @@ PWTEST(buffer_abi_sizes)
fprintf(stderr, "%zd\n", sizeof(struct spa_meta_region));
fprintf(stderr, "%zd\n", sizeof(struct spa_meta_bitmap));
fprintf(stderr, "%zd\n", sizeof(struct spa_meta_cursor));
fprintf(stderr, "%zd\n", sizeof(struct spa_meta_videotransform));
return PWTEST_SKIP;
#endif
}