summaryrefslogtreecommitdiff
path: root/ptftool.cc
blob: d8084472660e0bac3a70270418c1d6745e7f25a9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
/*
    Copyright (C) 2015  Damien Zammit

    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

*/

#include "ptfformat.h"
using namespace std;
using std::string;

int main (int argc, char **argv) {
	PTFFormat ptf;
	int ok;

	if (argc == 1) {
		printf("No ptf file specified, quit\n");
		exit(0);
	}

	ok = ptf.load(argv[1]);

	switch (ok) {
	case -1:
		printf("Cannot open ptf, quit\n");
		exit(-1);
		break;
	case 0:
		if (ptf.audiofiles.size() > 0) {
			printf("Audio file @ offset:\n");
			for (vector<PTFFormat::files_t>::iterator
					a = ptf.audiofiles.begin();
					a != ptf.audiofiles.end(); ++a) {
				//printf("%s @ 0x%08x + 0x%08x, len=0x%08x\n", a->filename.c_str(),
				printf("%s @ %lu + %lu, len=%lu\n", a->filename.c_str(),
					a->posabsolute, a->sampleoffset, a->length);
			}
			printf("\nOther track @ offset:\n");
			for (vector<PTFFormat::files_t>::iterator
					a = ptf.othertracks.begin();
					a != ptf.othertracks.end(); ++a) {
				//printf("%s @ 0x%08x + 0x%08x, len=0x%08x\n", a->filename.c_str(),
				printf("%s @ %lu + %lu, len=%lu\n", a->filename.c_str(),
					a->posabsolute, a->sampleoffset, a->length);
			}
		} else {
			printf("No audio files in session, quit\n");
		}
		break;
	default:
		printf("Missing LUT 0x%02x, quit\n", ok);
		exit(ok);
		break;
	}
	exit(0);
}