V210 issue fix + correct packing
This commit is contained in:
@@ -132,8 +132,8 @@ func (v Video) Validate() error {
|
||||
if v.ColorSpace != ColorSpaceBT709 {
|
||||
return fmt.Errorf("colorspace must be %q, got %q", ColorSpaceBT709, v.ColorSpace)
|
||||
}
|
||||
if v.FrameWidth == 0 || v.FrameWidth%6 != 0 {
|
||||
return fmt.Errorf("frame_width must be greater than zero and divisible by 6, got %d", v.FrameWidth)
|
||||
if v.FrameWidth == 0 || v.FrameWidth%2 != 0 {
|
||||
return fmt.Errorf("frame_width must be greater than zero and even for 4:2:2 video, got %d", v.FrameWidth)
|
||||
}
|
||||
if v.FrameHeight == 0 {
|
||||
return fmt.Errorf("frame_height must be greater than zero")
|
||||
|
||||
@@ -28,10 +28,10 @@ func TestNewV210Video(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestNewV210VideoRejectsInvalidWidth(t *testing.T) {
|
||||
func TestNewV210VideoRejectsOddWidth(t *testing.T) {
|
||||
_, err := NewV210Video(testVideoID, 1919, 1080, Rational{Numerator: 25, Denominator: 1})
|
||||
if err == nil || !strings.Contains(err.Error(), "divisible by 6") {
|
||||
t.Fatalf("error = %v, want width divisibility error", err)
|
||||
if err == nil || !strings.Contains(err.Error(), "even") {
|
||||
t.Fatalf("error = %v, want even-width error", err)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user