Commit 9e08ac71 authored by Jean-Yves Avenard's avatar Jean-Yves Avenard

Make Dav1dDataProps::timestamp and offset signed.

parent 8ec9793a
...@@ -52,9 +52,9 @@ ...@@ -52,9 +52,9 @@
* used internally. * used internally.
*/ */
typedef struct Dav1dDataProps { typedef struct Dav1dDataProps {
uint64_t timestamp; ///< container timestamp of input data, default -1 int64_t timestamp; ///< container timestamp of input data, default INT64_MIN
uint64_t duration; ///< container duration of input data, default -1 uint64_t duration; ///< container duration of input data, default -1
uint64_t offset; ///< stream offset of input data, default -1 int64_t offset; ///< stream offset of input data, default INT64_MIN
size_t size; ///< packet size, default Dav1dData.sz size_t size; ///< packet size, default Dav1dData.sz
} Dav1dDataProps; } Dav1dDataProps;
......
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
#include "config.h" #include "config.h"
#include <errno.h> #include <errno.h>
#include <stdint.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
...@@ -45,7 +46,8 @@ uint8_t * dav1d_data_create(Dav1dData *const buf, const size_t sz) { ...@@ -45,7 +46,8 @@ uint8_t * dav1d_data_create(Dav1dData *const buf, const size_t sz) {
if (!buf->ref) return NULL; if (!buf->ref) return NULL;
buf->data = buf->ref->const_data; buf->data = buf->ref->const_data;
buf->sz = buf->m.size = sz; buf->sz = buf->m.size = sz;
buf->m.timestamp = buf->m.duration = buf->m.offset = ~0ULL; buf->m.timestamp = buf->m.offset = INT64_MIN;
buf->m.duration = ~0ULL;
return buf->ref->data; return buf->ref->data;
} }
...@@ -62,7 +64,8 @@ int dav1d_data_wrap(Dav1dData *const buf, const uint8_t *const ptr, const size_t ...@@ -62,7 +64,8 @@ int dav1d_data_wrap(Dav1dData *const buf, const uint8_t *const ptr, const size_t
if (!buf->ref) return -ENOMEM; if (!buf->ref) return -ENOMEM;
buf->data = ptr; buf->data = ptr;
buf->sz = buf->m.size = sz; buf->sz = buf->m.size = sz;
buf->m.timestamp = buf->m.duration = buf->m.offset = ~0ULL; buf->m.timestamp = buf->m.offset = INT64_MIN;
buf->m.duration = ~0ULL;
return 0; return 0;
} }
......
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
#include <assert.h> #include <assert.h>
#include <errno.h> #include <errno.h>
#include <stdint.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
...@@ -116,7 +117,8 @@ static int picture_alloc_with_edges(Dav1dPicture *const p, ...@@ -116,7 +117,8 @@ static int picture_alloc_with_edges(Dav1dPicture *const p,
p->p.w = w; p->p.w = w;
p->p.h = h; p->p.h = h;
p->m.timestamp = p->m.duration = p->m.offset = ~0ULL; p->m.timestamp = p->m.offset = INT64_MIN;
p->m.duration = ~0ULL;
p->p.layout = layout; p->p.layout = layout;
p->p.bpc = bpc; p->p.bpc = bpc;
int res = p_allocator->alloc_picture_callback(p, p_allocator->cookie); int res = p_allocator->alloc_picture_callback(p, p_allocator->cookie);
......
...@@ -48,7 +48,7 @@ static unsigned rl32(const uint8_t *const p) { ...@@ -48,7 +48,7 @@ static unsigned rl32(const uint8_t *const p) {
return ((uint32_t)p[3] << 24U) | (p[2] << 16U) | (p[1] << 8U) | p[0]; return ((uint32_t)p[3] << 24U) | (p[2] << 16U) | (p[1] << 8U) | p[0];
} }
static uint64_t rl64(const uint8_t *const p) { static int64_t rl64(const uint8_t *const p) {
return (((uint64_t) rl32(&p[4])) << 32) | rl32(p); return (((uint64_t) rl32(&p[4])) << 32) | rl32(p);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment