-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
feat: VR metadata support for VideoFile #7048
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Changes from all commits
aa30f73
2af451b
5b81136
c09b6fd
a460c14
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,125 @@ | ||
| package models | ||
|
|
||
| import ( | ||
| "fmt" | ||
| "io" | ||
| "strconv" | ||
| ) | ||
|
|
||
| // ProjectionEnum describes how a video frame is mapped onto a sphere | ||
| // or other projection surface. Generic naming; agnostic of any | ||
| // particular player or device. | ||
| type ProjectionEnum string | ||
|
|
||
| const ( | ||
| ProjectionEnumFlat ProjectionEnum = "FLAT" | ||
| ProjectionEnumEquirectangular ProjectionEnum = "EQUIRECTANGULAR" | ||
| ProjectionEnumFisheye ProjectionEnum = "FISHEYE" | ||
| ProjectionEnumMKX200 ProjectionEnum = "MKX200" | ||
| ProjectionEnumRF52 ProjectionEnum = "RF52" | ||
| ProjectionEnumDome ProjectionEnum = "DOME" | ||
| ProjectionEnumCubemap ProjectionEnum = "CUBEMAP" | ||
| ProjectionEnumRectilinear ProjectionEnum = "RECTILINEAR" | ||
| ) | ||
|
|
||
| var AllProjectionEnum = []ProjectionEnum{ | ||
| ProjectionEnumFlat, | ||
| ProjectionEnumEquirectangular, | ||
| ProjectionEnumFisheye, | ||
| ProjectionEnumMKX200, | ||
| ProjectionEnumRF52, | ||
| ProjectionEnumDome, | ||
| ProjectionEnumCubemap, | ||
| ProjectionEnumRectilinear, | ||
| } | ||
|
|
||
| func (e ProjectionEnum) IsValid() bool { | ||
| switch e { | ||
| case ProjectionEnumFlat, ProjectionEnumEquirectangular, ProjectionEnumFisheye, | ||
| ProjectionEnumMKX200, ProjectionEnumRF52, ProjectionEnumDome, | ||
| ProjectionEnumCubemap, ProjectionEnumRectilinear: | ||
| return true | ||
| } | ||
| return false | ||
| } | ||
|
|
||
| func (e ProjectionEnum) String() string { | ||
| return string(e) | ||
| } | ||
|
|
||
| func (e *ProjectionEnum) UnmarshalGQL(v interface{}) error { | ||
| str, ok := v.(string) | ||
| if !ok { | ||
| return fmt.Errorf("enums must be strings") | ||
| } | ||
| *e = ProjectionEnum(str) | ||
| if !e.IsValid() { | ||
| return fmt.Errorf("%s is not a valid ProjectionEnum", str) | ||
| } | ||
| return nil | ||
| } | ||
|
|
||
| func (e ProjectionEnum) MarshalGQL(w io.Writer) { | ||
| fmt.Fprint(w, strconv.Quote(e.String())) | ||
| } | ||
|
|
||
| // StereoModeEnum describes how a stereoscopic video is laid out | ||
| // across the frame. Generic naming. | ||
| type StereoModeEnum string | ||
|
|
||
| const ( | ||
| StereoModeEnumMono StereoModeEnum = "MONO" | ||
| StereoModeEnumSBS StereoModeEnum = "SBS" | ||
| StereoModeEnumTB StereoModeEnum = "TB" | ||
| StereoModeEnumCUV StereoModeEnum = "CUV" | ||
| StereoModeEnumAlternatingFrames StereoModeEnum = "AF" | ||
| StereoModeEnumInterleavedRows StereoModeEnum = "INTERLEAVED_ROWS" | ||
| ) | ||
|
|
||
| var AllStereoModeEnum = []StereoModeEnum{ | ||
| StereoModeEnumMono, | ||
| StereoModeEnumSBS, | ||
| StereoModeEnumTB, | ||
| StereoModeEnumCUV, | ||
| StereoModeEnumAlternatingFrames, | ||
| StereoModeEnumInterleavedRows, | ||
| } | ||
|
|
||
| func (e StereoModeEnum) IsValid() bool { | ||
| switch e { | ||
| case StereoModeEnumMono, StereoModeEnumSBS, StereoModeEnumTB, StereoModeEnumCUV, | ||
| StereoModeEnumAlternatingFrames, StereoModeEnumInterleavedRows: | ||
| return true | ||
| } | ||
| return false | ||
| } | ||
|
|
||
| func (e StereoModeEnum) String() string { | ||
| return string(e) | ||
| } | ||
|
|
||
| func (e *StereoModeEnum) UnmarshalGQL(v interface{}) error { | ||
| str, ok := v.(string) | ||
| if !ok { | ||
| return fmt.Errorf("enums must be strings") | ||
| } | ||
| *e = StereoModeEnum(str) | ||
| if !e.IsValid() { | ||
| return fmt.Errorf("%s is not a valid StereoModeEnum", str) | ||
| } | ||
| return nil | ||
| } | ||
|
|
||
| func (e StereoModeEnum) MarshalGQL(w io.Writer) { | ||
| fmt.Fprint(w, strconv.Quote(e.String())) | ||
| } | ||
|
|
||
| // VRCorrections holds optional per-video corrections commonly | ||
| // applied when projecting stereoscopic or 360-degree content. | ||
| // All fields are optional; nil means "unset". | ||
| // AlphaMode follows DeoVR's alpha channel specification. | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Probably needs better documentation than just referencing
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
DeoVR now has 3 passthrough modes: Chroma Key, Alpha Packing and AI Alpha. The ones we can commonly use are Chroma Key and Alpha Packing. |
||
| type VRCorrections struct { | ||
| HorizontalOffset *float64 `json:"horizontal_offset"` | ||
| VerticalOffset *float64 `json:"vertical_offset"` | ||
| AlphaMode *string `json:"alpha_mode"` | ||
| } | ||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You've added enum types to the
modelspackage, but haven't defined them in the graphql schema and aren't using them in the applicable fields.