Open MarcinWad opened 10 months ago
That looks like JSON output from the examples in tools/
? obuparse is a C library, and intended to be used as such.
As per the doc (https://github.com/dwbuiten/obuparse/blob/master/obuparse.h#L542C40-L542C40), offset
is the OBU's offset into the buffer you pass to obp_get_next_obu()
, not the offset into whole packet. obu_size
is the size excluding the OBU header.
Each call to obp_get_next_obu()
will have a different buffer pointer, so the offset can be the same, as it points to the start of that OBU's data inside the buffer, after the OBU header. You can see that it changes here in the example file: https://github.com/dwbuiten/obuparse/blob/master/tools/obudump.c#L232.
In your example above, the first packet contains:
0
, offset of 2
. (It's empty)11
, offset of 2
.OBU of type 6, wiith size 4224
, offset of 3
.
2 + 0 + 2 + 11 + 3 + 4224 = 4242.
Example diagram of that packet:
-----------------------------------------------------------------------------------------------------------------------------------------
| Header 1 (2 bytes) | OBU Data 1 (0 bytes) | Header 2 (2 bytes) | OBU Data 2 (11 bytes) | Header 3 (3 bytes) | OBU Data 3 (4224 bytes) |
-----------------------------------------------------------------------------------------------------------------------------------------
Hi, I try to open ivf file and get raw obu data from packet. In documentation you write that parameter offset should get offet in buffer. But how to understand those values?
{"packet_number": 0, "packet_size": 4242}
{"obu_type": 2, "offset": 2, "obu_size": 0, "temporal_id": 0, "spatial_id": 0}
{"obu_type": 1, "offset": 2, "obu_size": 11, "temporal_id": 0, "spatial_id": 0}
{"obu_type": 6, "offset": 3, "obu_size": 4224, "temporal_id": 0, "spatial_id": 0}
{"packet_number": 1, "packet_size": 75}
{"obu_type": 2, "offset": 2, "obu_size": 0, "temporal_id": 0, "spatial_id": 0}
{"obu_type": 6, "offset": 2, "obu_size": 31, "temporal_id": 0, "spatial_id": 0}
{"obu_type": 6, "offset": 2, "obu_size": 38, "temporal_id": 0, "spatial_id": 0}
Packet 0 = 4224 + 11 != 4242 Why two OBUs has same offset?