forked from duiniuluantanqin/mp4
-
Notifications
You must be signed in to change notification settings - Fork 0
/
vmhd.c
71 lines (54 loc) · 1.63 KB
/
vmhd.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#include "quicktime.h"
#include "funcprotos.h"
int quicktime_vmhd_init(quicktime_vmhd_t *vmhd)
{
vmhd->version = 0;
vmhd->flags = 1;
vmhd->graphics_mode = 64;
vmhd->opcolor[0] = 32768;
vmhd->opcolor[1] = 32768;
vmhd->opcolor[2] = 32768;
return 0;
}
int quicktime_vmhd_init_video(quicktime_t *file,
quicktime_vmhd_t *vmhd,
int frame_w,
int frame_h,
float frame_rate)
{
return 0;
}
int quicktime_vmhd_delete(quicktime_vmhd_t *vmhd)
{
return 0;
}
int quicktime_vmhd_dump(quicktime_vmhd_t *vmhd)
{
printf(" video media header\n");
printf(" version %d\n", vmhd->version);
printf(" flags %d\n", vmhd->flags);
printf(" graphics_mode %d\n", vmhd->graphics_mode);
printf(" opcolor %d %d %d\n", vmhd->opcolor[0], vmhd->opcolor[1], vmhd->opcolor[2]);
return 0;
}
int quicktime_read_vmhd(quicktime_t *file, quicktime_vmhd_t *vmhd)
{
int i;
vmhd->version = quicktime_read_char(file);
vmhd->flags = quicktime_read_int24(file);
vmhd->graphics_mode = quicktime_read_int16(file);
for(i = 0; i < 3; i++)
vmhd->opcolor[i] = quicktime_read_int16(file);
return 0;
}
int quicktime_write_vmhd(quicktime_t *file, quicktime_vmhd_t *vmhd)
{
quicktime_atom_t atom;
int i = 0;
quicktime_atom_write_header(file, &atom, "vmhd");
quicktime_write_char(file, vmhd->version);
quicktime_write_int24(file, vmhd->flags);
quicktime_write_int64(file, (u_int64_t)0);
quicktime_atom_write_footer(file, &atom);
return 0;
}