1 /*******************************************************************************
2  vmhd.c
3 
4  libquicktime - A library for reading and writing quicktime/avi/mp4 files.
5  http://libquicktime.sourceforge.net
6 
7  Copyright (C) 2002 Heroine Virtual Ltd.
8  Copyright (C) 2002-2011 Members of the libquicktime project.
9 
10  This library is free software; you can redistribute it and/or modify it under
11  the terms of the GNU Lesser General Public License as published by the Free
12  Software Foundation; either version 2.1 of the License, or (at your option)
13  any later version.
14 
15  This library is distributed in the hope that it will be useful, but WITHOUT
16  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
17  FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
18  details.
19 
20  You should have received a copy of the GNU Lesser General Public License along
21  with this library; if not, write to the Free Software Foundation, Inc., 51
22  Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
23 *******************************************************************************/
24 
25 #include "lqt_private.h"
26 
quicktime_vmhd_init(quicktime_vmhd_t * vmhd)27 void quicktime_vmhd_init(quicktime_vmhd_t *vmhd)
28 {
29 	vmhd->version = 0;
30 	vmhd->flags = 1;
31 	vmhd->graphics_mode = 64;
32 	vmhd->opcolor[0] = 32768;
33 	vmhd->opcolor[1] = 32768;
34 	vmhd->opcolor[2] = 32768;
35 }
36 
quicktime_vmhd_init_video(quicktime_t * file,quicktime_vmhd_t * vmhd,int frame_w,int frame_h,int frame_duration,int timescale)37 void quicktime_vmhd_init_video(quicktime_t *file,
38 								quicktime_vmhd_t *vmhd,
39 								int frame_w,
40 								int frame_h,
41                                                                 int frame_duration,
42                                                                 int timescale)
43 {
44 }
45 
quicktime_vmhd_delete(quicktime_vmhd_t * vmhd)46 void quicktime_vmhd_delete(quicktime_vmhd_t *vmhd)
47 {
48 }
49 
quicktime_vmhd_dump(quicktime_vmhd_t * vmhd)50 void quicktime_vmhd_dump(quicktime_vmhd_t *vmhd)
51 {
52 	lqt_dump("    video media header (vmhd)\n");
53 	lqt_dump("     version %d\n", vmhd->version);
54 	lqt_dump("     flags %ld\n", vmhd->flags);
55 	lqt_dump("     graphics_mode %d\n", vmhd->graphics_mode);
56 	lqt_dump("     opcolor %d %d %d\n", vmhd->opcolor[0], vmhd->opcolor[1], vmhd->opcolor[2]);
57 }
58 
quicktime_read_vmhd(quicktime_t * file,quicktime_vmhd_t * vmhd)59 void quicktime_read_vmhd(quicktime_t *file, quicktime_vmhd_t *vmhd)
60 {
61 	int i;
62 	vmhd->version = quicktime_read_char(file);
63 	vmhd->flags = quicktime_read_int24(file);
64 	vmhd->graphics_mode = quicktime_read_int16(file);
65 	for(i = 0; i < 3; i++)
66 		vmhd->opcolor[i] = quicktime_read_int16(file);
67 }
68 
quicktime_write_vmhd(quicktime_t * file,quicktime_vmhd_t * vmhd)69 void quicktime_write_vmhd(quicktime_t *file, quicktime_vmhd_t *vmhd)
70 {
71 	quicktime_atom_t atom;
72 	int i;
73 	quicktime_atom_write_header(file, &atom, "vmhd");
74 
75 	quicktime_write_char(file, vmhd->version);
76 	quicktime_write_int24(file, vmhd->flags);
77 	quicktime_write_int16(file, vmhd->graphics_mode);
78 
79 	for(i = 0; i < 3; i++)
80 		quicktime_write_int16(file, vmhd->opcolor[i]);
81 
82 	quicktime_atom_write_footer(file, &atom);
83 }
84 
85