1 /*******************************************************************************
2  vrsc.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_vrsc_init(quicktime_vrsc_t * vrsc)27 int quicktime_vrsc_init(quicktime_vrsc_t *vrsc)
28 {
29 	vrsc->version = 2;
30 	vrsc->revision = 0;
31 	vrsc->DefaultNodeID = 1;
32 	return 0;
33 }
34 
quicktime_vrsc_delete(quicktime_vrsc_t * vrsc)35 int quicktime_vrsc_delete(quicktime_vrsc_t *vrsc)
36 {
37     return 0;
38 }
39 
quicktime_vrsc_dump(quicktime_vrsc_t * vrsc)40 void quicktime_vrsc_dump(quicktime_vrsc_t *vrsc)
41 {
42 	lqt_dump("        world header (vrsc)\n");
43 	lqt_dump("         version %i\n",  vrsc->version);
44 	lqt_dump("         revision %i\n",  vrsc->revision);
45 	lqt_dump("         name atom id %ld\n",  vrsc->NameAtomID);
46 	lqt_dump("         default node %ld\n", vrsc->DefaultNodeID);
47 	lqt_dump("         world flags %ld\n", vrsc->flags);
48 }
49 
quicktime_read_vrsc(quicktime_t * file,quicktime_vrsc_t * vrsc,quicktime_qtatom_t * vrsc_atom)50 int quicktime_read_vrsc(quicktime_t *file, quicktime_vrsc_t *vrsc, quicktime_qtatom_t *vrsc_atom)
51 {
52 	vrsc->version =  quicktime_read_int16(file);
53 	vrsc->revision = quicktime_read_int16(file);
54 	vrsc->NameAtomID = quicktime_read_int32(file);
55 	vrsc->DefaultNodeID = quicktime_read_int32(file);
56 	vrsc->flags = quicktime_read_int32(file);
57 	vrsc->reserved1 = quicktime_read_int32(file);
58 	vrsc->reserved2 = quicktime_read_int32(file);
59 	return 0;
60 }
61 
quicktime_write_vrsc(quicktime_t * file,quicktime_vrsc_t * vrsc)62 void quicktime_write_vrsc(quicktime_t *file, quicktime_vrsc_t *vrsc)
63 {
64 	quicktime_qtatom_t atom;
65 	quicktime_qtatom_write_header(file, &atom, "vrsc", 1);
66 	quicktime_write_int16(file, vrsc->version);
67 	quicktime_write_int16(file, vrsc->revision);
68 	quicktime_write_int32(file, vrsc->NameAtomID);
69 	quicktime_write_int32(file, vrsc->DefaultNodeID);
70 	quicktime_write_int32(file, vrsc->flags);
71 	quicktime_write_int32(file, vrsc->reserved1);
72 	quicktime_write_int32(file, vrsc->reserved2);
73 	quicktime_qtatom_write_footer(file, &atom);
74 }
75 
76