1 /*
2    mkvmerge -- utility for splicing together matroska files
3    from component media subtypes
4 
5    Distributed under the GPL v2
6    see the file COPYING for details
7    or visit https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
8 
9    definitions and helper functions for IVF data
10 
11    Written by Moritz Bunkus <moritz@bunkus.org>.
12 */
13 
14 #pragma once
15 
16 #include "common/common_pch.h"
17 
18 #include "common/codec.h"
19 
20 /* All integers are little endian. */
21 
22 namespace ivf {
23 
24 #if defined(COMP_MSC)
25 #pragma pack(push,1)
26 #endif
27 struct PACKED_STRUCTURE file_header_t {
28   unsigned char file_magic[4];  // "DKIF"
29   uint16_t      version;
30   uint16_t      header_size;
31   unsigned char fourcc[4];      // "VP80"
32   uint16_t      width;
33   uint16_t      height;
34   uint32_t      frame_rate_num;
35   uint32_t      frame_rate_den;
36   uint32_t      frame_count;
37   uint32_t      unused;
38 
39   file_header_t();
40   codec_c get_codec() const;
41 };
42 
43 struct PACKED_STRUCTURE frame_header_t {
44   uint32_t frame_size;
45   uint64_t timestamp;
46 
47   frame_header_t();
48 };
49 
50 bool is_keyframe(const memory_cptr &buffer, codec_c::type_e codec);
51 
52 #if defined(COMP_MSC)
53 #pragma pack(pop)
54 #endif
55 }
56