summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDamien Zammit <damien@zamaudio.com>2018-04-22 12:49:43 +1000
committerDamien Zammit <damien@zamaudio.com>2018-04-22 12:53:42 +1000
commitffd88553919dc007eeac3a7809f0d23447eda7e6 (patch)
tree17ee92494c56ca308e12cba0eec9cca6e8b5827e
parent8473cdb086d9dca859786ea8188c67c27f3a92e5 (diff)
ptformat: Update to upstream c0305a2
-rw-r--r--libs/ptformat/ptfformat.cc69
-rw-r--r--libs/ptformat/ptfformat.h32
2 files changed, 55 insertions, 46 deletions
diff --git a/libs/ptformat/ptfformat.cc b/libs/ptformat/ptfformat.cc
index 38c8ddc758..a92f7e18cb 100644
--- a/libs/ptformat/ptfformat.cc
+++ b/libs/ptformat/ptfformat.cc
@@ -1,18 +1,24 @@
/*
- Copyright (C) 2015 Damien Zammit
- Copyright (C) 2015 Robin Gareus
-
- 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.
-
-*/
+ * libptformat - a library to read ProTools sessions
+ *
+ * Copyright (C) 2015 Damien Zammit
+ * Copyright (C) 2015 Robin Gareus
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
#include <stdio.h>
#include <stdlib.h>
@@ -1509,12 +1515,12 @@ PTFFormat::parserest12(void) {
if (!jumpback(&k, ptfunxored, len, (const unsigned char *)"\x5a", 1))
return;
- jumpto(&k, ptfunxored, k+0x500, (const unsigned char *)"\x5a\x03", 2);
+ jumpto(&k, ptfunxored, k+0x2000, (const unsigned char *)"\x5a\x03", 2);
k++;
groupcount = 0;
- for (i = k; i < len - 0x500; i++) {
- if (!jumpto(&i, ptfunxored, i+0x500, (const unsigned char *)"\x5a\x03", 2))
+ for (i = k; i < len; i++) {
+ if (!jumpto(&i, ptfunxored, len, (const unsigned char *)"\x5a\x03", 2))
break;
groupcount++;
}
@@ -1619,13 +1625,16 @@ nocustom:
if (!jumpto(&k, ptfunxored, len, (const unsigned char *)"\x5a\x06", 2))
return;
- for (l = 0; l < 11; l++) {
- if (!jumpto(&k, ptfunxored, len, (const unsigned char *)"\x5a", 1))
- return;
- k++;
- }
+ k++;
+
+ if (!jumpto(&k, ptfunxored, len, (const unsigned char *)"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0", 16))
+ return;
+ k++;
+
+ if (!jumpto(&k, ptfunxored, len, (const unsigned char *)"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0", 16))
+ return;
+ k++;
- /*
// Hack to find actual start of region group information
while (k < len) {
if ((ptfunxored[k+13] == 0x5a) && (ptfunxored[k+14] & 0xf)) {
@@ -1641,19 +1650,13 @@ nocustom:
break;
k++;
}
- */
verbose_printf("hack region groups k=0x%x\n", k);
- groupcount = 0;
compoundcount = 0;
j = k;
- if (!jumpto(&j, ptfunxored, j+100, (const unsigned char *)"\x5a\x09", 2)) {
- groupmax = 0;
- } else {
- groupmax = ptfunxored[j+3] | ptfunxored[j+4] << 8;
- }
- i = k;
- for (; (groupcount < groupmax) && (i < len-70); i++) {
+ groupmax = groupcount == 0 ? 0 : ptfunxored[j+3] | ptfunxored[j+4] << 8;
+ groupcount = 0;
+ for (i = k; (groupcount < groupmax) && (i < len-70); i++) {
if ( (ptfunxored[i ] == 0x5a) &&
(ptfunxored[i+1] == 0x03)) {
break;
@@ -1923,7 +1926,7 @@ nocustom:
// Start pure regions
k = m != 0 ? m : k - 1;
if (!jumpto(&k, ptfunxored, k+64, (const unsigned char *)"\x5a\x05", 2))
- jumpto(&k, ptfunxored, k+128, (const unsigned char *)"\x5a\x02", 2);
+ jumpto(&k, ptfunxored, k+0x400, (const unsigned char *)"\x5a\x02", 2);
verbose_printf("pure regions k=0x%x\n", k);
diff --git a/libs/ptformat/ptfformat.h b/libs/ptformat/ptfformat.h
index 67110414d3..189fc0fef2 100644
--- a/libs/ptformat/ptfformat.h
+++ b/libs/ptformat/ptfformat.h
@@ -1,17 +1,23 @@
/*
- 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.
-
-*/
+ * libptformat - a library to read ProTools sessions
+ *
+ * Copyright (C) 2015 Damien Zammit
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
#ifndef PTFFORMAT_H
#define PTFFORMAT_H