ptformat: Update to upstream c0305a2
authorDamien Zammit <damien@zamaudio.com>
Sun, 22 Apr 2018 02:49:43 +0000 (12:49 +1000)
committerDamien Zammit <damien@zamaudio.com>
Sun, 22 Apr 2018 02:53:42 +0000 (12:53 +1000)
libs/ptformat/ptfformat.cc
libs/ptformat/ptfformat.h

index 38c8ddc75889444637e624db24e96bb35ee41a5c..a92f7e18cb8ddbbb7523e23f317e70935cccdf02 100644 (file)
@@ -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);
 
index 67110414d3b13001dc5bcc4ed5eba3d02231e67e..189fc0fef2d601786f0363d64b278b7e95c6bdc2 100644 (file)
@@ -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