Add support for the Projection element

It's a part of the Google Spatial Media V2 spec:
https://github.com/google/spatial-media/blob/master/docs/spherical-video-v2-rfc.md

Change-Id: I52f05e34b19239af09774da2f88eb584a0bfa628
This commit is contained in:
Michael Bradshaw
2016-08-25 12:00:05 -07:00
parent dae3d48a6f
commit 676a7135d1
8 changed files with 339 additions and 2 deletions

View File

@@ -883,6 +883,66 @@ struct Colour {
}
};
/**
A parsed \WebMID{ProjectionType} element.
*/
enum class ProjectionType : std::uint64_t {
/**
Rectangular.
*/
kRectangular = 0,
/**
Equirectangular.
*/
kEquirectangular = 1,
/**
Cube map.
*/
kCubeMap = 2,
};
/**
A parsed \WebMID{Projection} element.
*/
struct Projection {
/**
A parsed \WebMID{ProjectionType} element.
*/
Element<ProjectionType> type;
/**
A parsed \WebMID{ProjectionPrivate} element.
*/
Element<std::vector<std::uint8_t>> projection_private;
/**
A parsed \WebMID{ProjectionPoseYaw} element.
*/
Element<double> pose_yaw;
/**
A parsed \WebMID{ProjectionPosePitch} element.
*/
Element<double> pose_pitch;
/**
A parsed \WebMID{ProjectionPoseRoll} element.
*/
Element<double> pose_roll;
/**
Returns true if every member within the two objects are equal.
*/
bool operator==(const Projection& other) const {
return type == other.type &&
projection_private == other.projection_private &&
pose_yaw == other.pose_yaw && pose_pitch == other.pose_pitch &&
pose_roll == other.pose_roll;
}
};
/**
A parsed \WebMID{FlagInterlaced} element.
*/
@@ -1113,6 +1173,11 @@ struct Video {
*/
Element<Colour> colour;
/**
A parsed \WebMID{Projection} element.
*/
Element<Projection> projection;
/**
Returns true if every member within the two objects are equal.
*/
@@ -1128,7 +1193,8 @@ struct Video {
display_height == other.display_height &&
display_unit == other.display_unit &&
aspect_ratio_type == other.aspect_ratio_type &&
frame_rate == other.frame_rate && colour == other.colour;
frame_rate == other.frame_rate && colour == other.colour &&
projection == other.projection;
}
};

View File

@@ -704,6 +704,48 @@ enum class Id : std::uint32_t {
*/
kLuminanceMin = 0x55DA,
/**
\WebMID{Projection} element ID.
\WebMTable{Master, 5, No, No, No, , }
*/
kProjection = 0x7670,
/**
\WebMID{ProjectionType} element ID.
\WebMTable{Unsigned integer, 6, Yes, No, No, , 0}
*/
kProjectionType = 0x7671,
/**
\WebMID{ProjectionPrivate} element ID.
\WebMTable{Binary, 6, No, No, No, , }
*/
kProjectionPrivate = 0x7672,
/**
\WebMID{ProjectionPoseYaw} element ID.
\WebMTable{Float, 6, Yes, No, No, , 0}
*/
kProjectionPoseYaw = 0x7673,
/**
\WebMID{ProjectionPosePitch} element ID.
\WebMTable{Float, 6, Yes, No, No, , 0}
*/
kProjectionPosePitch = 0x7674,
/**
\WebMID{ProjectionPoseRoll} element ID.
\WebMTable{Float, 6, Yes, No, No, , 0}
*/
kProjectionPoseRoll = 0x7675,
/**
\MatroskaID{Audio} element ID.