avcodec/cbs_h265: fix storage type for time_offset_value in Time Code SEI
authorJames Almer <jamrial@gmail.com>
Mon, 15 Apr 2019 20:51:49 +0000 (17:51 -0300)
committerJames Almer <jamrial@gmail.com>
Tue, 16 Apr 2019 23:33:10 +0000 (20:33 -0300)
The spec defines it as an array of signed values, inferred to 0 when not
present.

Reviewed-by: Mark Thompson <sw@jkqxz.net>
Signed-off-by: James Almer <jamrial@gmail.com>
libavcodec/cbs_h265.h
libavcodec/cbs_h265_syntax_template.c

index d216cac..0c0e4f8 100644 (file)
@@ -659,7 +659,7 @@ typedef struct H265RawSEITimeCode {
     uint8_t  minutes_flag[3];
     uint8_t  hours_flag[3];
     uint8_t  time_offset_length[3];
-    uint32_t time_offset_value[3];
+    int32_t  time_offset_value[3];
 } H265RawSEITimeCode;
 
 typedef struct H265RawSEIMasteringDisplayColourVolume {
index f1e1bb0..bbd363a 100644 (file)
@@ -1986,8 +1986,11 @@ static int FUNC(sei_time_code)(CodedBitstreamContext *ctx, RWContext *rw,
 
             us(5, time_offset_length[i], 0, 31, 1, i);
             if (current->time_offset_length[i] > 0)
-                us(current->time_offset_length[i], time_offset_value[i],
-                   0, MAX_UINT_BITS(current->time_offset_length[i]), 1, i);
+                is(current->time_offset_length[i], time_offset_value[i],
+                   MIN_INT_BITS(current->time_offset_length[i]),
+                   MAX_INT_BITS(current->time_offset_length[i]), 1, i);
+            else
+                infer(time_offset_value[i], 0);
         }
     }