1 /*******************************************************************************
2 tmcd.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
27 #include <string.h>
28
quicktime_tmcd_init(quicktime_tmcd_t * tmcd)29 void quicktime_tmcd_init(quicktime_tmcd_t *tmcd)
30 {
31 quicktime_tcmi_init(&tmcd->tcmi);
32 }
33
quicktime_tmcd_delete(quicktime_tmcd_t * tmcd)34 void quicktime_tmcd_delete(quicktime_tmcd_t *tmcd)
35 {
36 quicktime_tcmi_delete(&tmcd->tcmi);
37 }
38
quicktime_tmcd_dump(quicktime_tmcd_t * tmcd)39 void quicktime_tmcd_dump(quicktime_tmcd_t *tmcd)
40 {
41 lqt_dump(" tmcd\n");
42
43 quicktime_tcmi_dump(&tmcd->tcmi);
44 }
45
quicktime_read_tmcd(quicktime_t * file,quicktime_tmcd_t * tmcd,quicktime_atom_t * parent_atom)46 void quicktime_read_tmcd(quicktime_t *file, quicktime_tmcd_t *tmcd,
47 quicktime_atom_t *parent_atom)
48 {
49 quicktime_atom_t leaf_atom;
50
51 do
52 {
53 quicktime_atom_read_header(file, &leaf_atom);
54
55 if(quicktime_atom_is(&leaf_atom, "tcmi"))
56 {
57 quicktime_read_tcmi(file, &tmcd->tcmi);
58 }
59 else
60 quicktime_atom_skip(file, &leaf_atom);
61
62 }while(quicktime_position(file) < parent_atom->end);
63 }
64
quicktime_write_tmcd(quicktime_t * file,quicktime_tmcd_t * tmcd)65 void quicktime_write_tmcd(quicktime_t *file, quicktime_tmcd_t *tmcd)
66 {
67 quicktime_atom_t atom;
68
69 quicktime_atom_write_header(file, &atom, "tmcd");
70 quicktime_write_tcmi(file, &tmcd->tcmi);
71 quicktime_atom_write_footer(file, &atom);
72 }
73
74