2fa8ea87f239d42a93f585164c36d9df4572a69d
[framework/multimedia/gst-plugins-ext0.10.git] / piffdemux / src / piffdemux_types.c
1 /* GStreamer
2  * Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Library General Public
6  * License as published by the Free Software Foundation; either
7  * version 2 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Library General Public License for more details.
13  *
14  * You should have received a copy of the GNU Library General Public
15  * License along with this library; if not, write to the
16  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17  * Boston, MA 02111-1307, USA.
18  */
19
20 #include "piffdemux_types.h"
21 #include "piffdemux_dump.h"
22 #include "piffdemux_fourcc.h"
23
24 static const PiffNodeType piff_node_types[] = {
25   {FOURCC_vide, "video media", 0},
26   {FOURCC_hint, "hint", 0,},
27   {FOURCC_mp4a, "mp4a", 0,},
28   {FOURCC_mp4v, "mp4v", 0,},
29   {FOURCC_alac, "alac", 0,},
30   {FOURCC_meta, "meta", 0, piffdemux_dump_unknown},
31   {FOURCC_____, "----", PIFF_FLAG_CONTAINER,},
32   {FOURCC_free, "free", 0,},
33   {FOURCC_mfra, "movie fragment random access",
34       PIFF_FLAG_CONTAINER,},
35   {FOURCC_tfra, "track fragment random access", 0,
36       piffdemux_dump_tfra},
37   {FOURCC_mfro, "movie fragment random access offset", 0,
38       piffdemux_dump_mfro},
39   {FOURCC_moof, "movie fragment", PIFF_FLAG_CONTAINER,},
40   {FOURCC_mfhd, "movie fragment header", 0,},
41   {FOURCC_traf, "track fragment", PIFF_FLAG_CONTAINER,},
42   {FOURCC_tfhd, "track fragment header", 0,
43       piffdemux_dump_tfhd},
44   {FOURCC_sdtp, "independent and disposable samples", 0,
45       piffdemux_dump_sdtp},
46   {FOURCC_trun, "track fragment run", 0, piffdemux_dump_trun},
47   {FOURCC_mdat, "moovie data", 0, piffdemux_dump_unknown},
48   {FOURCC_trex, "moovie data", 0, piffdemux_dump_trex},
49   {FOURCC_mvex, "mvex", PIFF_FLAG_CONTAINER,},
50   {FOURCC_ovc1, "ovc1", 0},
51   {FOURCC_owma, "owma", 0},
52   {FOURCC_tfxd, "tfxd", 0},
53   {FOURCC_tfrf, "tfrf", 0},
54   {FOURCC_uuid, "uuid", 0},
55
56   {0, "unknown", 0,},
57 };
58
59 static const int n_piff_node_types =
60     sizeof (piff_node_types) / sizeof (piff_node_types[0]);
61
62 const PiffNodeType *
63 piffdemux_type_get (guint32 fourcc)
64 {
65   int i;
66
67   for (i = 0; i < n_piff_node_types; i++) {
68     if (G_UNLIKELY (piff_node_types[i].fourcc == fourcc))
69       return piff_node_types + i;
70   }
71
72   GST_WARNING ("unknown QuickTime node type %" GST_FOURCC_FORMAT,
73       GST_FOURCC_ARGS (fourcc));
74
75   return piff_node_types + n_piff_node_types - 1;
76 }