annotate src/main.c @ 1:db8b7e45ee55

license: add MIT license
author Paper <mrpapersonic@gmail.com>
date Tue, 04 Jul 2023 22:50:26 -0400
parents 0ea1ec2da443
children d00bc412900e
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
1 #include <string.h>
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
2 #include <stdbool.h>
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
3 #include <stdio.h>
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
4 #include <stdlib.h>
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
5 #include <stdint.h>
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
6 #include "edl.h"
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
7
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
8 int strings_amt = -1;
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
9
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
10 /* CRC32 hash function */
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
11 uint32_t crc32b(unsigned char* restrict message) {
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
12 int32_t i, j;
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
13 uint32_t byte, crc, mask;
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
14
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
15 crc = 0xFFFFFFFF;
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
16 for (i = 0; message[i] != 0; i++) {
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
17 byte = message[i]; // Get next byte.
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
18 crc = crc ^ byte;
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
19 for (j = 7; j >= 0; j--) { // Do eight times.
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
20 mask = -(crc & 1);
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
21 crc = (crc >> 1) ^ (0xEDB88320 & mask);
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
22 }
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
23 }
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
24 return ~crc;
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
25 }
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
26
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
27 /* This parses the first line of the EDL and
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
28 creates an array with CRC32 hashes in
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
29 the order of the strings. */
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
30 uint32_t* parse_first_line(char* first_line) {
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
31 uint32_t* hashes = calloc(32, sizeof(uint32_t));
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
32 int i = 0;
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
33 char* token;
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
34 hashes[i++] = crc32b(strtok_r(first_line, ";", &token));
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
35 for (;;i++) {
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
36 char* token = strtok_r(NULL, ";", &token);
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
37 if (token == NULL)
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
38 break;
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
39 hashes[i] = crc32b(token);
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
40 }
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
41 strings_amt = i;
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
42 free(first_line);
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
43 return hashes;
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
44 }
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
45
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
46 /* -- Functions to extract different datatypes -- */
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
47
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
48 char* get_int(char* input, int* int_return) {
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
49 char* ptr_return;
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
50 *int_return = strtol(input, &ptr_return, 10);
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
51 return ptr_return + 2;
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
52 }
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
53
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
54 char* get_double(char* input, double* double_return) {
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
55 char* ptr_return;
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
56 *double_return = strtod(input, &ptr_return);
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
57 return ptr_return + 2;
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
58 }
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
59
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
60 char* get_bool(char* input, bool* bool_return) {
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
61 switch (input[0]) {
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
62 case 'T':
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
63 *bool_return = true;
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
64 return input + 6;
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
65 case 'F':
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
66 *bool_return = false;
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
67 return input + 7;
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
68 default:
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
69 /* what */
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
70 return NULL;
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
71 }
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
72 }
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
73
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
74 char* get_media_type(char* input, MediaType* media_return) {
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
75 switch (input[0]) {
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
76 case 'V':
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
77 *media_return = video;
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
78 return input + 7;
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
79 case 'A':
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
80 *media_return = audio;
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
81 return input + 7;
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
82 default:
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
83 /* what */
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
84 return NULL;
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
85 }
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
86 }
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
87
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
88 /* lenptr is optional */
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
89 char* cut_string_at_match(char* input, char* match, int* lenptr) {
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
90 int length = strcspn(&input[1], match);
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
91 char* string = calloc(length+1, sizeof(char));
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
92 memcpy(string, &input[1], length);
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
93 string[length] = '\0';
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
94 if (lenptr != NULL)
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
95 *lenptr = length;
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
96 return string;
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
97 }
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
98
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
99 char* get_string(char* input, char** string_return) {
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
100 /* Windows filenames will *NEVER* include double quotes.
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
101 This might break with EDL files created with Reaper on Linux. */
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
102 int length;
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
103 char* string = cut_string_at_match(input, "\"", &length);
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
104 *string_return = string;
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
105 return input + length + 4;
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
106 }
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
107
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
108 /* The memory manager for EDL_file. */
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
109 void allocate_memory(EDL_file* input) {
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
110 if (input->size == 0) input->size = 16;
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
111 input->edl = realloc(input->edl, (input->size*2) * sizeof(EDL_line));
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
112 input->size *= 2;
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
113 }
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
114
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
115 /* This is the important function */
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
116 EDL_file* parse_EDL(char* text) {
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
117 EDL_file edl;
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
118 memset(&edl, '\0', sizeof(edl));
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
119 allocate_memory(&edl);
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
120 uint32_t* order = parse_first_line(strtok_r(text, "\n", NULL));
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
121 char* line = strtok(text, "\n");
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
122 while ((line = strtok(NULL, "\n")) != NULL) {
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
123 char* tmp_ptr = line;
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
124 for (int i = 0; i < strings_amt; i++) {
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
125 switch (order[i]) {
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
126 case 0x1541c503: /* ID */
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
127 tmp_ptr = get_int(tmp_ptr, &edl.edl[edl.current].id);
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
128 break;
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
129 case 0x4b211812: /* Track */
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
130 tmp_ptr = get_int(tmp_ptr, &edl.edl[edl.current].track);
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
131 break;
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
132 case 0xbb46516f: /* StartTime */
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
133 tmp_ptr = get_double(tmp_ptr, &edl.edl[edl.current].start_time);
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
134 break;
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
135 case 0xaeac5df7: /* Length */
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
136 tmp_ptr = get_double(tmp_ptr, &edl.edl[edl.current].length);
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
137 break;
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
138 case 0x03834606: /* PlayRate */
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
139 tmp_ptr = get_double(tmp_ptr, &edl.edl[edl.current].play_rate);
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
140 break;
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
141 case 0x0c2083d3: /* Locked */
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
142 tmp_ptr = get_bool(tmp_ptr, &edl.edl[edl.current].locked);
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
143 break;
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
144 case 0xe60c8b1d: /* Normalized */
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
145 tmp_ptr = get_bool(tmp_ptr, &edl.edl[edl.current].normalized);
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
146 break;
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
147 case 0xbe5802c9: /* StretchMethod */
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
148 tmp_ptr = get_int(tmp_ptr, &edl.edl[edl.current].stretch_method);
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
149 break;
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
150 case 0x4ec8be4c: /* Looped */
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
151 tmp_ptr = get_bool(tmp_ptr, &edl.edl[edl.current].looped);
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
152 break;
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
153 case 0xe6cb84d1: /* OnRuler */
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
154 tmp_ptr = get_bool(tmp_ptr, &edl.edl[edl.current].on_ruler);
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
155 break;
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
156 case 0x035f84c2: /* MediaType */
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
157 tmp_ptr = get_media_type(tmp_ptr, &edl.edl[edl.current].media_type);
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
158 break;
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
159 case 0x379d32c5: /* FileName */
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
160 tmp_ptr = get_string(tmp_ptr, &edl.edl[edl.current].file_name);
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
161 break;
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
162 case 0x9f334738: /* Stream */
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
163 tmp_ptr = get_int(tmp_ptr, &edl.edl[edl.current].stream);
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
164 break;
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
165 case 0x07b4e0e7: /* StreamStart */
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
166 tmp_ptr = get_double(tmp_ptr, &edl.edl[edl.current].stream_start);
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
167 break;
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
168 case 0x8f16c7b8: /* StreamLength */
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
169 tmp_ptr = get_double(tmp_ptr, &edl.edl[edl.current].stream_length);
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
170 break;
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
171 case 0xd2edd7e4: /* FadeTimeIn */
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
172 tmp_ptr = get_double(tmp_ptr, &edl.edl[edl.current].fade_time_in);
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
173 break;
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
174 case 0x792e8c40: /* FadeTimeOut */
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
175 tmp_ptr = get_double(tmp_ptr, &edl.edl[edl.current].fade_time_out);
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
176 break;
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
177 case 0x98374657: /* SustainGain */
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
178 tmp_ptr = get_double(tmp_ptr, &edl.edl[edl.current].sustain_gain);
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
179 break;
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
180 case 0x3e998b1f: /* CurveIn */
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
181 tmp_ptr = get_int(tmp_ptr, &edl.edl[edl.current].curve_in);
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
182 break;
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
183 case 0x82fb09c4: /* GainIn */
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
184 tmp_ptr = get_double(tmp_ptr, &edl.edl[edl.current].gain_in);
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
185 break;
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
186 case 0x53add388: /* CurveOut */
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
187 tmp_ptr = get_int(tmp_ptr, &edl.edl[edl.current].curve_out);
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
188 break;
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
189 case 0x4210ba56: /* GainOut */
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
190 tmp_ptr = get_double(tmp_ptr, &edl.edl[edl.current].gain_out);
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
191 break;
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
192 case 0x89c4df6c: /* Layer */
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
193 tmp_ptr = get_int(tmp_ptr, &edl.edl[edl.current].layer);
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
194 break;
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
195 case 0xadf2f1a3: /* Color */
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
196 tmp_ptr = get_int(tmp_ptr, &edl.edl[edl.current].color);
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
197 break;
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
198 case 0xa56b43e1: /* CurveInR */
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
199 tmp_ptr = get_int(tmp_ptr, &edl.edl[edl.current].curve_in_r);
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
200 break;
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
201 case 0xcb6d715e: /* CurveOutR */
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
202 tmp_ptr = get_int(tmp_ptr, &edl.edl[edl.current].curve_out_r);
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
203 break;
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
204 case 0x9da1b9ed: /* PlayPitch */
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
205 tmp_ptr = get_double(tmp_ptr, &edl.edl[edl.current].play_pitch);
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
206 break;
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
207 case 0x2bda6ed4: /* LockPitch */
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
208 tmp_ptr = get_bool(tmp_ptr, &edl.edl[edl.current].lock_pitch);
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
209 break;
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
210 case 0x3071a4c6: /* FirstChannel */
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
211 tmp_ptr = get_int(tmp_ptr, &edl.edl[edl.current].first_channel);
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
212 break;
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
213 case 0x7de1bd40: /* Channels */
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
214 tmp_ptr = get_int(tmp_ptr, &edl.edl[edl.current].channels);
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
215 break;
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
216 default:
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
217 /* ... what */
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
218 break;
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
219 }
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
220 }
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
221 edl.current++;
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
222 if (edl.current >= edl.size)
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
223 allocate_memory(&edl);
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
224 }
0ea1ec2da443 *: initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
225 }