~ubuntu-branches/ubuntu/jaunty/xvidcap/jaunty-proposed

« back to all changes in this revision

Viewing changes to gt/parse_gt.c

  • Committer: Bazaar Package Importer
  • Author(s): John Dong
  • Date: 2008-02-25 15:47:12 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20080225154712-qvr11ekcea4c9ry8
Tags: 1.1.6-0.1ubuntu1
* Merge from debian-multimedia (LP: #120003), Ubuntu Changes:
 - For ffmpeg-related build-deps, remove cvs from package names.
 - Standards-Version 3.7.3
 - Maintainer Spec

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 * parse_gt.c
3
 
 * gnutime test program
4
 
 *
5
 
 * Copyright (C) 1998 Rasca, Berlin
6
 
 * EMail: thron@gmx.de
7
 
 *
8
 
 * This program is free software; you can redistribute it and/or modify
9
 
 * it under the terms of the GNU General Public License as published by
10
 
 * the Free Software Foundation; either version 2 of the License, or
11
 
 * (at your option) any later version.
12
 
 *
13
 
 * This program is distributed in the hope that it will be useful,
14
 
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
 
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
 
 * GNU General Public License for more details.
17
 
 *
18
 
 * You should have received a copy of the GNU General Public License
19
 
 * along with this program; if not, write to the Free Software
20
 
 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21
 
 */
22
 
 
23
 
#include <stdio.h>
24
 
#include "gnutime.h"
25
 
 
26
 
void
27
 
usage (char *pname)
28
 
{
29
 
        fprintf (stderr, "Usage: %s <file>\n", pname);
30
 
        exit(1);
31
 
}
32
 
 
33
 
int
34
 
main (int argc, char *argv[])
35
 
{
36
 
        char *file, *p;
37
 
        FILE *fp;
38
 
        gt_atom *moov, *gt;
39
 
        int type, size, i, j;
40
 
 
41
 
        if (argc < 2) {
42
 
                usage (argv[0]);
43
 
        }
44
 
        file = argv[1];
45
 
        fp = fopen (file, "rb");
46
 
        if (!fp) {
47
 
                perror (file);
48
 
                exit(2);
49
 
        }
50
 
                p = (char *) &type;
51
 
        while (1) {
52
 
                if (gt_read4byte (&size, fp) < 4)
53
 
                        break;
54
 
                if (gt_read4byte (&type, fp) < 4)
55
 
                        break;
56
 
                printf ("position: %08d, atom type: %c%c%c%c, size: %d bytes\n",
57
 
                                ftell(fp)-8, *(p+3), *(p+2), *(p+1), *(p), size);
58
 
                if (type == ATOM_movie) {
59
 
                        fseek (fp, -8, SEEK_CUR);
60
 
                        moov = gt_get_movie (fp);
61
 
                        if (moov) {
62
 
                                for (i = 0; i < moov->memb; i++) {
63
 
                                        if (moov->suba[i]->type == ATOM_track) {
64
 
                                                printf (" -> track\n");
65
 
                                                gt = moov->suba[i];
66
 
                                                for (j = 0; j < gt->memb; j++) {
67
 
                                                        if (gt->suba[j]->type == ATOM_media) {
68
 
                                                                printf ("  -> media\n");
69
 
                                                        }
70
 
                                                }
71
 
                                        }
72
 
                                }
73
 
                        }
74
 
                } else
75
 
                        fseek (fp, size-8, SEEK_CUR);
76
 
        }
77
 
        fclose (fp);
78
 
        return (0);
79
 
}
80