Mercurial > libedl
annotate src/edl.c @ 12:0cc2555db371
*: make our string functions not stupid
strncat() made everything slow!
new addition internally: an EDL_header structure to make things
not stupid. if we were using C++ it wouldn't really be necessary,
but alas :)
author | Paper <paper@paper.us.eu.org> |
---|---|
date | Wed, 27 Mar 2024 13:38:30 -0400 |
parents | 0c98b46eaf73 |
children | 41b74137e201 |
rev | line source |
---|---|
3
bd99b6549eb4
*: expand in readme and rename src/main to src/edl
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
1 #include <string.h> |
bd99b6549eb4
*: expand in readme and rename src/main to src/edl
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
2 #include <stdbool.h> |
bd99b6549eb4
*: expand in readme and rename src/main to src/edl
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
3 #include <stdio.h> |
bd99b6549eb4
*: expand in readme and rename src/main to src/edl
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
4 #include <stdlib.h> |
bd99b6549eb4
*: expand in readme and rename src/main to src/edl
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
5 #include <stdint.h> |
8
0c98b46eaf73
*: update API to 2.0, big changes
Paper <paper@paper.us.eu.org>
parents:
6
diff
changeset
|
6 |
3
bd99b6549eb4
*: expand in readme and rename src/main to src/edl
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
7 #include "edl.h" |
4
c2408abb258a
*: add dumping to string, rename EDL_file to EDL
Paper <mrpapersonic@gmail.com>
parents:
3
diff
changeset
|
8 #include "str.h" |
8
0c98b46eaf73
*: update API to 2.0, big changes
Paper <paper@paper.us.eu.org>
parents:
6
diff
changeset
|
9 #include "datatypes.h" |
0c98b46eaf73
*: update API to 2.0, big changes
Paper <paper@paper.us.eu.org>
parents:
6
diff
changeset
|
10 #include "util.h" |
3
bd99b6549eb4
*: expand in readme and rename src/main to src/edl
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
11 |
8
0c98b46eaf73
*: update API to 2.0, big changes
Paper <paper@paper.us.eu.org>
parents:
6
diff
changeset
|
12 /* CRC32 hashes of EDL headers */ |
0c98b46eaf73
*: update API to 2.0, big changes
Paper <paper@paper.us.eu.org>
parents:
6
diff
changeset
|
13 #define EDL_HEADER_ID 0x1541c503 |
0c98b46eaf73
*: update API to 2.0, big changes
Paper <paper@paper.us.eu.org>
parents:
6
diff
changeset
|
14 #define EDL_HEADER_TRACK 0x4b211812 |
0c98b46eaf73
*: update API to 2.0, big changes
Paper <paper@paper.us.eu.org>
parents:
6
diff
changeset
|
15 #define EDL_HEADER_STARTTIME 0xbb46516f |
0c98b46eaf73
*: update API to 2.0, big changes
Paper <paper@paper.us.eu.org>
parents:
6
diff
changeset
|
16 #define EDL_HEADER_LENGTH 0xaeac5df7 |
0c98b46eaf73
*: update API to 2.0, big changes
Paper <paper@paper.us.eu.org>
parents:
6
diff
changeset
|
17 #define EDL_HEADER_PLAYRATE 0x03834606 |
0c98b46eaf73
*: update API to 2.0, big changes
Paper <paper@paper.us.eu.org>
parents:
6
diff
changeset
|
18 #define EDL_HEADER_LOCKED 0x0c2083d3 |
0c98b46eaf73
*: update API to 2.0, big changes
Paper <paper@paper.us.eu.org>
parents:
6
diff
changeset
|
19 #define EDL_HEADER_NORMALIZED 0xe60c8b1d |
0c98b46eaf73
*: update API to 2.0, big changes
Paper <paper@paper.us.eu.org>
parents:
6
diff
changeset
|
20 #define EDL_HEADER_STRETCHMETHOD 0xbe5802c9 |
0c98b46eaf73
*: update API to 2.0, big changes
Paper <paper@paper.us.eu.org>
parents:
6
diff
changeset
|
21 #define EDL_HEADER_LOOPED 0x4ec8be4c |
0c98b46eaf73
*: update API to 2.0, big changes
Paper <paper@paper.us.eu.org>
parents:
6
diff
changeset
|
22 #define EDL_HEADER_ONRULER 0xe6cb84d1 |
0c98b46eaf73
*: update API to 2.0, big changes
Paper <paper@paper.us.eu.org>
parents:
6
diff
changeset
|
23 #define EDL_HEADER_MEDIATYPE 0x035f84c2 |
0c98b46eaf73
*: update API to 2.0, big changes
Paper <paper@paper.us.eu.org>
parents:
6
diff
changeset
|
24 #define EDL_HEADER_FILENAME 0x379d32c5 |
0c98b46eaf73
*: update API to 2.0, big changes
Paper <paper@paper.us.eu.org>
parents:
6
diff
changeset
|
25 #define EDL_HEADER_STREAM 0x9f334738 |
0c98b46eaf73
*: update API to 2.0, big changes
Paper <paper@paper.us.eu.org>
parents:
6
diff
changeset
|
26 #define EDL_HEADER_STREAMSTART 0x07b4e0e7 |
0c98b46eaf73
*: update API to 2.0, big changes
Paper <paper@paper.us.eu.org>
parents:
6
diff
changeset
|
27 #define EDL_HEADER_STREAMLENGTH 0x8f16c7b8 |
0c98b46eaf73
*: update API to 2.0, big changes
Paper <paper@paper.us.eu.org>
parents:
6
diff
changeset
|
28 #define EDL_HEADER_FADETIMEIN 0xd2edd7e4 |
0c98b46eaf73
*: update API to 2.0, big changes
Paper <paper@paper.us.eu.org>
parents:
6
diff
changeset
|
29 #define EDL_HEADER_FADETIMEOUT 0x792e8c40 |
0c98b46eaf73
*: update API to 2.0, big changes
Paper <paper@paper.us.eu.org>
parents:
6
diff
changeset
|
30 #define EDL_HEADER_SUSTAINGAIN 0x98374657 |
0c98b46eaf73
*: update API to 2.0, big changes
Paper <paper@paper.us.eu.org>
parents:
6
diff
changeset
|
31 #define EDL_HEADER_CURVEIN 0x3e998b1f |
0c98b46eaf73
*: update API to 2.0, big changes
Paper <paper@paper.us.eu.org>
parents:
6
diff
changeset
|
32 #define EDL_HEADER_GAININ 0x82fb09c4 |
0c98b46eaf73
*: update API to 2.0, big changes
Paper <paper@paper.us.eu.org>
parents:
6
diff
changeset
|
33 #define EDL_HEADER_CURVEOUT 0x53add388 |
0c98b46eaf73
*: update API to 2.0, big changes
Paper <paper@paper.us.eu.org>
parents:
6
diff
changeset
|
34 #define EDL_HEADER_GAINOUT 0x4210ba56 |
0c98b46eaf73
*: update API to 2.0, big changes
Paper <paper@paper.us.eu.org>
parents:
6
diff
changeset
|
35 #define EDL_HEADER_LAYER 0x89c4df6c |
0c98b46eaf73
*: update API to 2.0, big changes
Paper <paper@paper.us.eu.org>
parents:
6
diff
changeset
|
36 #define EDL_HEADER_COLOR 0xadf2f1a3 |
0c98b46eaf73
*: update API to 2.0, big changes
Paper <paper@paper.us.eu.org>
parents:
6
diff
changeset
|
37 #define EDL_HEADER_CURVEINR 0xa56b43e1 |
0c98b46eaf73
*: update API to 2.0, big changes
Paper <paper@paper.us.eu.org>
parents:
6
diff
changeset
|
38 #define EDL_HEADER_CURVEOUTR 0xcb6d715e |
0c98b46eaf73
*: update API to 2.0, big changes
Paper <paper@paper.us.eu.org>
parents:
6
diff
changeset
|
39 #define EDL_HEADER_PLAYPITCH 0x9da1b9ed |
0c98b46eaf73
*: update API to 2.0, big changes
Paper <paper@paper.us.eu.org>
parents:
6
diff
changeset
|
40 #define EDL_HEADER_LOCKPITCH 0x2bda6ed4 |
0c98b46eaf73
*: update API to 2.0, big changes
Paper <paper@paper.us.eu.org>
parents:
6
diff
changeset
|
41 #define EDL_HEADER_FIRSTCHANNEL 0x3071a4c6 |
0c98b46eaf73
*: update API to 2.0, big changes
Paper <paper@paper.us.eu.org>
parents:
6
diff
changeset
|
42 #define EDL_HEADER_CHANNELS 0xe94981a4 |
0c98b46eaf73
*: update API to 2.0, big changes
Paper <paper@paper.us.eu.org>
parents:
6
diff
changeset
|
43 |
12
0cc2555db371
*: make our string functions not stupid
Paper <paper@paper.us.eu.org>
parents:
8
diff
changeset
|
44 typedef struct { |
0cc2555db371
*: make our string functions not stupid
Paper <paper@paper.us.eu.org>
parents:
8
diff
changeset
|
45 uint32_t* order; |
0cc2555db371
*: make our string functions not stupid
Paper <paper@paper.us.eu.org>
parents:
8
diff
changeset
|
46 size_t size; |
0cc2555db371
*: make our string functions not stupid
Paper <paper@paper.us.eu.org>
parents:
8
diff
changeset
|
47 size_t capacity; |
0cc2555db371
*: make our string functions not stupid
Paper <paper@paper.us.eu.org>
parents:
8
diff
changeset
|
48 } EDL_header; |
0cc2555db371
*: make our string functions not stupid
Paper <paper@paper.us.eu.org>
parents:
8
diff
changeset
|
49 |
8
0c98b46eaf73
*: update API to 2.0, big changes
Paper <paper@paper.us.eu.org>
parents:
6
diff
changeset
|
50 /* use a CRC32 hash function to process the headers */ |
0c98b46eaf73
*: update API to 2.0, big changes
Paper <paper@paper.us.eu.org>
parents:
6
diff
changeset
|
51 static uint32_t EDL_internal_crcn32b(const unsigned char* message, size_t length) { |
0c98b46eaf73
*: update API to 2.0, big changes
Paper <paper@paper.us.eu.org>
parents:
6
diff
changeset
|
52 uint32_t crc = 0xffffffff; |
3
bd99b6549eb4
*: expand in readme and rename src/main to src/edl
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
53 size_t i; |
8
0c98b46eaf73
*: update API to 2.0, big changes
Paper <paper@paper.us.eu.org>
parents:
6
diff
changeset
|
54 |
3
bd99b6549eb4
*: expand in readme and rename src/main to src/edl
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
55 for (i = 0; i < length && message[i]; i++) { |
8
0c98b46eaf73
*: update API to 2.0, big changes
Paper <paper@paper.us.eu.org>
parents:
6
diff
changeset
|
56 size_t j; |
0c98b46eaf73
*: update API to 2.0, big changes
Paper <paper@paper.us.eu.org>
parents:
6
diff
changeset
|
57 |
3
bd99b6549eb4
*: expand in readme and rename src/main to src/edl
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
58 crc = crc ^ message[i]; |
bd99b6549eb4
*: expand in readme and rename src/main to src/edl
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
59 for (j = 0; j < 8; j++) |
8
0c98b46eaf73
*: update API to 2.0, big changes
Paper <paper@paper.us.eu.org>
parents:
6
diff
changeset
|
60 crc = (crc >> 1) ^ (0xedb88320 & -(crc & 1)); |
3
bd99b6549eb4
*: expand in readme and rename src/main to src/edl
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
61 } |
bd99b6549eb4
*: expand in readme and rename src/main to src/edl
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
62 |
bd99b6549eb4
*: expand in readme and rename src/main to src/edl
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
63 return ~crc; |
bd99b6549eb4
*: expand in readme and rename src/main to src/edl
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
64 } |
bd99b6549eb4
*: expand in readme and rename src/main to src/edl
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
65 |
8
0c98b46eaf73
*: update API to 2.0, big changes
Paper <paper@paper.us.eu.org>
parents:
6
diff
changeset
|
66 static size_t EDL_internal_size_t_min(size_t a, size_t b) { |
0c98b46eaf73
*: update API to 2.0, big changes
Paper <paper@paper.us.eu.org>
parents:
6
diff
changeset
|
67 return (a < b) ? a : b; |
0c98b46eaf73
*: update API to 2.0, big changes
Paper <paper@paper.us.eu.org>
parents:
6
diff
changeset
|
68 } |
0c98b46eaf73
*: update API to 2.0, big changes
Paper <paper@paper.us.eu.org>
parents:
6
diff
changeset
|
69 |
12
0cc2555db371
*: make our string functions not stupid
Paper <paper@paper.us.eu.org>
parents:
8
diff
changeset
|
70 static int EDL_internal_header_reallocate(EDL_header* header, size_t new_capacity) { |
0cc2555db371
*: make our string functions not stupid
Paper <paper@paper.us.eu.org>
parents:
8
diff
changeset
|
71 header->order = realloc(header->order, new_capacity * sizeof(*header->order)); |
0cc2555db371
*: make our string functions not stupid
Paper <paper@paper.us.eu.org>
parents:
8
diff
changeset
|
72 if (!header->order) |
0cc2555db371
*: make our string functions not stupid
Paper <paper@paper.us.eu.org>
parents:
8
diff
changeset
|
73 return -1; |
0cc2555db371
*: make our string functions not stupid
Paper <paper@paper.us.eu.org>
parents:
8
diff
changeset
|
74 |
0cc2555db371
*: make our string functions not stupid
Paper <paper@paper.us.eu.org>
parents:
8
diff
changeset
|
75 if (new_capacity > header->capacity) |
0cc2555db371
*: make our string functions not stupid
Paper <paper@paper.us.eu.org>
parents:
8
diff
changeset
|
76 memset(&header->order[header->capacity], 0, (new_capacity - header->capacity) * sizeof(*header->order)); |
0cc2555db371
*: make our string functions not stupid
Paper <paper@paper.us.eu.org>
parents:
8
diff
changeset
|
77 |
0cc2555db371
*: make our string functions not stupid
Paper <paper@paper.us.eu.org>
parents:
8
diff
changeset
|
78 header->capacity = new_capacity; |
8
0c98b46eaf73
*: update API to 2.0, big changes
Paper <paper@paper.us.eu.org>
parents:
6
diff
changeset
|
79 |
12
0cc2555db371
*: make our string functions not stupid
Paper <paper@paper.us.eu.org>
parents:
8
diff
changeset
|
80 return header->capacity; |
0cc2555db371
*: make our string functions not stupid
Paper <paper@paper.us.eu.org>
parents:
8
diff
changeset
|
81 } |
0cc2555db371
*: make our string functions not stupid
Paper <paper@paper.us.eu.org>
parents:
8
diff
changeset
|
82 |
0cc2555db371
*: make our string functions not stupid
Paper <paper@paper.us.eu.org>
parents:
8
diff
changeset
|
83 static int EDL_internal_parse_header_item(EDL_header* header, const char* data, size_t offset, size_t length) { |
0cc2555db371
*: make our string functions not stupid
Paper <paper@paper.us.eu.org>
parents:
8
diff
changeset
|
84 if (header->capacity <= header->size) |
0cc2555db371
*: make our string functions not stupid
Paper <paper@paper.us.eu.org>
parents:
8
diff
changeset
|
85 if (EDL_internal_header_reallocate(header, header->capacity * 2) < 0) |
0cc2555db371
*: make our string functions not stupid
Paper <paper@paper.us.eu.org>
parents:
8
diff
changeset
|
86 return -1; |
0cc2555db371
*: make our string functions not stupid
Paper <paper@paper.us.eu.org>
parents:
8
diff
changeset
|
87 |
0cc2555db371
*: make our string functions not stupid
Paper <paper@paper.us.eu.org>
parents:
8
diff
changeset
|
88 header->order[header->size++] = EDL_internal_crcn32b((const unsigned char*)&data[offset], length); |
3
bd99b6549eb4
*: expand in readme and rename src/main to src/edl
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
89 |
12
0cc2555db371
*: make our string functions not stupid
Paper <paper@paper.us.eu.org>
parents:
8
diff
changeset
|
90 return header->size; |
0cc2555db371
*: make our string functions not stupid
Paper <paper@paper.us.eu.org>
parents:
8
diff
changeset
|
91 } |
0cc2555db371
*: make our string functions not stupid
Paper <paper@paper.us.eu.org>
parents:
8
diff
changeset
|
92 |
0cc2555db371
*: make our string functions not stupid
Paper <paper@paper.us.eu.org>
parents:
8
diff
changeset
|
93 /* EDL_header MUST be zero-initialized. */ |
0cc2555db371
*: make our string functions not stupid
Paper <paper@paper.us.eu.org>
parents:
8
diff
changeset
|
94 static int EDL_internal_parse_header(EDL_header* header, const char* data, size_t offset, size_t length) { |
0cc2555db371
*: make our string functions not stupid
Paper <paper@paper.us.eu.org>
parents:
8
diff
changeset
|
95 size_t newline = 0, overall = 0, column = 0; |
0cc2555db371
*: make our string functions not stupid
Paper <paper@paper.us.eu.org>
parents:
8
diff
changeset
|
96 { |
0cc2555db371
*: make our string functions not stupid
Paper <paper@paper.us.eu.org>
parents:
8
diff
changeset
|
97 const char* ln = memchr(&data[offset], '\n', length - offset); |
0cc2555db371
*: make our string functions not stupid
Paper <paper@paper.us.eu.org>
parents:
8
diff
changeset
|
98 if (!ln) |
0cc2555db371
*: make our string functions not stupid
Paper <paper@paper.us.eu.org>
parents:
8
diff
changeset
|
99 return -1; |
8
0c98b46eaf73
*: update API to 2.0, big changes
Paper <paper@paper.us.eu.org>
parents:
6
diff
changeset
|
100 |
12
0cc2555db371
*: make our string functions not stupid
Paper <paper@paper.us.eu.org>
parents:
8
diff
changeset
|
101 newline = ln - &data[offset]; |
0cc2555db371
*: make our string functions not stupid
Paper <paper@paper.us.eu.org>
parents:
8
diff
changeset
|
102 } |
0cc2555db371
*: make our string functions not stupid
Paper <paper@paper.us.eu.org>
parents:
8
diff
changeset
|
103 |
0cc2555db371
*: make our string functions not stupid
Paper <paper@paper.us.eu.org>
parents:
8
diff
changeset
|
104 EDL_internal_header_reallocate(header, 32); |
8
0c98b46eaf73
*: update API to 2.0, big changes
Paper <paper@paper.us.eu.org>
parents:
6
diff
changeset
|
105 |
12
0cc2555db371
*: make our string functions not stupid
Paper <paper@paper.us.eu.org>
parents:
8
diff
changeset
|
106 for (; overall <= newline; overall++) { |
0cc2555db371
*: make our string functions not stupid
Paper <paper@paper.us.eu.org>
parents:
8
diff
changeset
|
107 if (data[offset + overall] == ';' || data[offset + overall] == ':') { |
0cc2555db371
*: make our string functions not stupid
Paper <paper@paper.us.eu.org>
parents:
8
diff
changeset
|
108 if (EDL_internal_parse_header_item(header, data, overall - column, column) < 0) |
0cc2555db371
*: make our string functions not stupid
Paper <paper@paper.us.eu.org>
parents:
8
diff
changeset
|
109 return -1; |
0cc2555db371
*: make our string functions not stupid
Paper <paper@paper.us.eu.org>
parents:
8
diff
changeset
|
110 |
8
0c98b46eaf73
*: update API to 2.0, big changes
Paper <paper@paper.us.eu.org>
parents:
6
diff
changeset
|
111 column = 0; /* reset */ |
0c98b46eaf73
*: update API to 2.0, big changes
Paper <paper@paper.us.eu.org>
parents:
6
diff
changeset
|
112 } else column++; |
3
bd99b6549eb4
*: expand in readme and rename src/main to src/edl
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
113 } |
bd99b6549eb4
*: expand in readme and rename src/main to src/edl
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
114 |
12
0cc2555db371
*: make our string functions not stupid
Paper <paper@paper.us.eu.org>
parents:
8
diff
changeset
|
115 return overall; |
0cc2555db371
*: make our string functions not stupid
Paper <paper@paper.us.eu.org>
parents:
8
diff
changeset
|
116 } |
3
bd99b6549eb4
*: expand in readme and rename src/main to src/edl
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
117 |
12
0cc2555db371
*: make our string functions not stupid
Paper <paper@paper.us.eu.org>
parents:
8
diff
changeset
|
118 static int EDL_internal_free_header(EDL_header* header) { |
0cc2555db371
*: make our string functions not stupid
Paper <paper@paper.us.eu.org>
parents:
8
diff
changeset
|
119 free(header->order); |
3
bd99b6549eb4
*: expand in readme and rename src/main to src/edl
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
120 } |
bd99b6549eb4
*: expand in readme and rename src/main to src/edl
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
121 |
8
0c98b46eaf73
*: update API to 2.0, big changes
Paper <paper@paper.us.eu.org>
parents:
6
diff
changeset
|
122 int EDL_reallocate(EDL* edl, size_t new_capacity) { |
0c98b46eaf73
*: update API to 2.0, big changes
Paper <paper@paper.us.eu.org>
parents:
6
diff
changeset
|
123 edl->arr = realloc(edl->arr, new_capacity * sizeof(EDL_line)); |
0c98b46eaf73
*: update API to 2.0, big changes
Paper <paper@paper.us.eu.org>
parents:
6
diff
changeset
|
124 if (!edl->arr) |
12
0cc2555db371
*: make our string functions not stupid
Paper <paper@paper.us.eu.org>
parents:
8
diff
changeset
|
125 return -1; |
3
bd99b6549eb4
*: expand in readme and rename src/main to src/edl
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
126 |
8
0c98b46eaf73
*: update API to 2.0, big changes
Paper <paper@paper.us.eu.org>
parents:
6
diff
changeset
|
127 if (new_capacity > edl->capacity) |
0c98b46eaf73
*: update API to 2.0, big changes
Paper <paper@paper.us.eu.org>
parents:
6
diff
changeset
|
128 memset(&edl->arr[edl->capacity], 0, (new_capacity - edl->capacity) * sizeof(EDL_line)); |
3
bd99b6549eb4
*: expand in readme and rename src/main to src/edl
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
129 |
8
0c98b46eaf73
*: update API to 2.0, big changes
Paper <paper@paper.us.eu.org>
parents:
6
diff
changeset
|
130 edl->capacity = new_capacity; |
3
bd99b6549eb4
*: expand in readme and rename src/main to src/edl
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
131 |
12
0cc2555db371
*: make our string functions not stupid
Paper <paper@paper.us.eu.org>
parents:
8
diff
changeset
|
132 return edl->capacity; |
3
bd99b6549eb4
*: expand in readme and rename src/main to src/edl
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
133 } |
bd99b6549eb4
*: expand in readme and rename src/main to src/edl
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
134 |
8
0c98b46eaf73
*: update API to 2.0, big changes
Paper <paper@paper.us.eu.org>
parents:
6
diff
changeset
|
135 int EDL_append(EDL* edl, EDL_line line) { |
0c98b46eaf73
*: update API to 2.0, big changes
Paper <paper@paper.us.eu.org>
parents:
6
diff
changeset
|
136 if (edl->size + 1 < edl->capacity && !EDL_reallocate(edl, edl->capacity)) |
0c98b46eaf73
*: update API to 2.0, big changes
Paper <paper@paper.us.eu.org>
parents:
6
diff
changeset
|
137 return 0; |
3
bd99b6549eb4
*: expand in readme and rename src/main to src/edl
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
138 |
8
0c98b46eaf73
*: update API to 2.0, big changes
Paper <paper@paper.us.eu.org>
parents:
6
diff
changeset
|
139 edl->arr[++edl->size] = line; |
0c98b46eaf73
*: update API to 2.0, big changes
Paper <paper@paper.us.eu.org>
parents:
6
diff
changeset
|
140 return 1; |
0c98b46eaf73
*: update API to 2.0, big changes
Paper <paper@paper.us.eu.org>
parents:
6
diff
changeset
|
141 } |
0c98b46eaf73
*: update API to 2.0, big changes
Paper <paper@paper.us.eu.org>
parents:
6
diff
changeset
|
142 |
0c98b46eaf73
*: update API to 2.0, big changes
Paper <paper@paper.us.eu.org>
parents:
6
diff
changeset
|
143 /* the big important function */ |
0c98b46eaf73
*: update API to 2.0, big changes
Paper <paper@paper.us.eu.org>
parents:
6
diff
changeset
|
144 EDL_parse_error_t EDL_parse(EDL* edl, const char* data, size_t length) { |
4
c2408abb258a
*: add dumping to string, rename EDL_file to EDL
Paper <mrpapersonic@gmail.com>
parents:
3
diff
changeset
|
145 size_t offset = 0; |
12
0cc2555db371
*: make our string functions not stupid
Paper <paper@paper.us.eu.org>
parents:
8
diff
changeset
|
146 EDL_header header = {0}; |
8
0c98b46eaf73
*: update API to 2.0, big changes
Paper <paper@paper.us.eu.org>
parents:
6
diff
changeset
|
147 |
12
0cc2555db371
*: make our string functions not stupid
Paper <paper@paper.us.eu.org>
parents:
8
diff
changeset
|
148 if (EDL_reallocate(edl, 16) < 0) |
8
0c98b46eaf73
*: update API to 2.0, big changes
Paper <paper@paper.us.eu.org>
parents:
6
diff
changeset
|
149 return EDL_PARSE_ERROR_OUT_OF_MEMORY; |
0c98b46eaf73
*: update API to 2.0, big changes
Paper <paper@paper.us.eu.org>
parents:
6
diff
changeset
|
150 |
12
0cc2555db371
*: make our string functions not stupid
Paper <paper@paper.us.eu.org>
parents:
8
diff
changeset
|
151 if (EDL_internal_parse_header(&header, data, offset, length) < 0) |
0cc2555db371
*: make our string functions not stupid
Paper <paper@paper.us.eu.org>
parents:
8
diff
changeset
|
152 return EDL_PARSE_ERROR_HEADER; |
3
bd99b6549eb4
*: expand in readme and rename src/main to src/edl
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
153 |
12
0cc2555db371
*: make our string functions not stupid
Paper <paper@paper.us.eu.org>
parents:
8
diff
changeset
|
154 while ((offset = (const char*)memchr(&data[offset], '\n', length - offset) - data + 1) < length) { |
8
0c98b46eaf73
*: update API to 2.0, big changes
Paper <paper@paper.us.eu.org>
parents:
6
diff
changeset
|
155 size_t local_offset = offset; /* original offset stays intact */ |
3
bd99b6549eb4
*: expand in readme and rename src/main to src/edl
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
156 bool ok = true; |
8
0c98b46eaf73
*: update API to 2.0, big changes
Paper <paper@paper.us.eu.org>
parents:
6
diff
changeset
|
157 int i; |
3
bd99b6549eb4
*: expand in readme and rename src/main to src/edl
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
158 |
12
0cc2555db371
*: make our string functions not stupid
Paper <paper@paper.us.eu.org>
parents:
8
diff
changeset
|
159 for (i = 0; i < header.size; i++) { |
3
bd99b6549eb4
*: expand in readme and rename src/main to src/edl
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
160 #define ADD_TO_OFFSET(x, a) \ |
bd99b6549eb4
*: expand in readme and rename src/main to src/edl
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
161 { \ |
8
0c98b46eaf73
*: update API to 2.0, big changes
Paper <paper@paper.us.eu.org>
parents:
6
diff
changeset
|
162 size_t o = a(data, local_offset, length, &edl->arr[edl->size].x); \ |
3
bd99b6549eb4
*: expand in readme and rename src/main to src/edl
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
163 if (!o) \ |
bd99b6549eb4
*: expand in readme and rename src/main to src/edl
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
164 ok = false; \ |
bd99b6549eb4
*: expand in readme and rename src/main to src/edl
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
165 local_offset += o; \ |
bd99b6549eb4
*: expand in readme and rename src/main to src/edl
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
166 } |
12
0cc2555db371
*: make our string functions not stupid
Paper <paper@paper.us.eu.org>
parents:
8
diff
changeset
|
167 switch (header.order[i]) { |
8
0c98b46eaf73
*: update API to 2.0, big changes
Paper <paper@paper.us.eu.org>
parents:
6
diff
changeset
|
168 case EDL_HEADER_ID: |
0c98b46eaf73
*: update API to 2.0, big changes
Paper <paper@paper.us.eu.org>
parents:
6
diff
changeset
|
169 ADD_TO_OFFSET(id, EDL_internal_parse_int); |
3
bd99b6549eb4
*: expand in readme and rename src/main to src/edl
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
170 break; |
8
0c98b46eaf73
*: update API to 2.0, big changes
Paper <paper@paper.us.eu.org>
parents:
6
diff
changeset
|
171 case EDL_HEADER_TRACK: |
0c98b46eaf73
*: update API to 2.0, big changes
Paper <paper@paper.us.eu.org>
parents:
6
diff
changeset
|
172 ADD_TO_OFFSET(track, EDL_internal_parse_int); |
3
bd99b6549eb4
*: expand in readme and rename src/main to src/edl
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
173 break; |
8
0c98b46eaf73
*: update API to 2.0, big changes
Paper <paper@paper.us.eu.org>
parents:
6
diff
changeset
|
174 case EDL_HEADER_STARTTIME: |
0c98b46eaf73
*: update API to 2.0, big changes
Paper <paper@paper.us.eu.org>
parents:
6
diff
changeset
|
175 ADD_TO_OFFSET(start_time, EDL_internal_parse_double); |
3
bd99b6549eb4
*: expand in readme and rename src/main to src/edl
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
176 break; |
8
0c98b46eaf73
*: update API to 2.0, big changes
Paper <paper@paper.us.eu.org>
parents:
6
diff
changeset
|
177 case EDL_HEADER_LENGTH: |
0c98b46eaf73
*: update API to 2.0, big changes
Paper <paper@paper.us.eu.org>
parents:
6
diff
changeset
|
178 ADD_TO_OFFSET(length, EDL_internal_parse_double); |
3
bd99b6549eb4
*: expand in readme and rename src/main to src/edl
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
179 break; |
8
0c98b46eaf73
*: update API to 2.0, big changes
Paper <paper@paper.us.eu.org>
parents:
6
diff
changeset
|
180 case EDL_HEADER_PLAYRATE: |
0c98b46eaf73
*: update API to 2.0, big changes
Paper <paper@paper.us.eu.org>
parents:
6
diff
changeset
|
181 ADD_TO_OFFSET(play_rate, EDL_internal_parse_double); |
3
bd99b6549eb4
*: expand in readme and rename src/main to src/edl
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
182 break; |
8
0c98b46eaf73
*: update API to 2.0, big changes
Paper <paper@paper.us.eu.org>
parents:
6
diff
changeset
|
183 case EDL_HEADER_LOCKED: |
0c98b46eaf73
*: update API to 2.0, big changes
Paper <paper@paper.us.eu.org>
parents:
6
diff
changeset
|
184 ADD_TO_OFFSET(locked, EDL_internal_parse_bool); |
3
bd99b6549eb4
*: expand in readme and rename src/main to src/edl
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
185 break; |
8
0c98b46eaf73
*: update API to 2.0, big changes
Paper <paper@paper.us.eu.org>
parents:
6
diff
changeset
|
186 case EDL_HEADER_NORMALIZED: |
0c98b46eaf73
*: update API to 2.0, big changes
Paper <paper@paper.us.eu.org>
parents:
6
diff
changeset
|
187 ADD_TO_OFFSET(normalized, EDL_internal_parse_bool); |
3
bd99b6549eb4
*: expand in readme and rename src/main to src/edl
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
188 break; |
8
0c98b46eaf73
*: update API to 2.0, big changes
Paper <paper@paper.us.eu.org>
parents:
6
diff
changeset
|
189 case EDL_HEADER_STRETCHMETHOD: |
0c98b46eaf73
*: update API to 2.0, big changes
Paper <paper@paper.us.eu.org>
parents:
6
diff
changeset
|
190 ADD_TO_OFFSET(stretch_method, EDL_internal_parse_int); |
3
bd99b6549eb4
*: expand in readme and rename src/main to src/edl
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
191 break; |
8
0c98b46eaf73
*: update API to 2.0, big changes
Paper <paper@paper.us.eu.org>
parents:
6
diff
changeset
|
192 case EDL_HEADER_LOOPED: |
0c98b46eaf73
*: update API to 2.0, big changes
Paper <paper@paper.us.eu.org>
parents:
6
diff
changeset
|
193 ADD_TO_OFFSET(looped, EDL_internal_parse_bool); |
3
bd99b6549eb4
*: expand in readme and rename src/main to src/edl
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
194 break; |
8
0c98b46eaf73
*: update API to 2.0, big changes
Paper <paper@paper.us.eu.org>
parents:
6
diff
changeset
|
195 case EDL_HEADER_ONRULER: |
0c98b46eaf73
*: update API to 2.0, big changes
Paper <paper@paper.us.eu.org>
parents:
6
diff
changeset
|
196 ADD_TO_OFFSET(on_ruler, EDL_internal_parse_bool); |
3
bd99b6549eb4
*: expand in readme and rename src/main to src/edl
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
197 break; |
8
0c98b46eaf73
*: update API to 2.0, big changes
Paper <paper@paper.us.eu.org>
parents:
6
diff
changeset
|
198 case EDL_HEADER_MEDIATYPE: |
0c98b46eaf73
*: update API to 2.0, big changes
Paper <paper@paper.us.eu.org>
parents:
6
diff
changeset
|
199 ADD_TO_OFFSET(media_type, EDL_internal_parse_media_type); |
3
bd99b6549eb4
*: expand in readme and rename src/main to src/edl
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
200 break; |
8
0c98b46eaf73
*: update API to 2.0, big changes
Paper <paper@paper.us.eu.org>
parents:
6
diff
changeset
|
201 case EDL_HEADER_FILENAME: |
0c98b46eaf73
*: update API to 2.0, big changes
Paper <paper@paper.us.eu.org>
parents:
6
diff
changeset
|
202 ADD_TO_OFFSET(filename, EDL_internal_parse_string); |
3
bd99b6549eb4
*: expand in readme and rename src/main to src/edl
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
203 break; |
8
0c98b46eaf73
*: update API to 2.0, big changes
Paper <paper@paper.us.eu.org>
parents:
6
diff
changeset
|
204 case EDL_HEADER_STREAM: |
0c98b46eaf73
*: update API to 2.0, big changes
Paper <paper@paper.us.eu.org>
parents:
6
diff
changeset
|
205 ADD_TO_OFFSET(stream, EDL_internal_parse_int); |
3
bd99b6549eb4
*: expand in readme and rename src/main to src/edl
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
206 break; |
8
0c98b46eaf73
*: update API to 2.0, big changes
Paper <paper@paper.us.eu.org>
parents:
6
diff
changeset
|
207 case EDL_HEADER_STREAMSTART: |
0c98b46eaf73
*: update API to 2.0, big changes
Paper <paper@paper.us.eu.org>
parents:
6
diff
changeset
|
208 ADD_TO_OFFSET(stream_start, EDL_internal_parse_double); |
3
bd99b6549eb4
*: expand in readme and rename src/main to src/edl
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
209 break; |
8
0c98b46eaf73
*: update API to 2.0, big changes
Paper <paper@paper.us.eu.org>
parents:
6
diff
changeset
|
210 case EDL_HEADER_STREAMLENGTH: |
0c98b46eaf73
*: update API to 2.0, big changes
Paper <paper@paper.us.eu.org>
parents:
6
diff
changeset
|
211 ADD_TO_OFFSET(stream_length, EDL_internal_parse_double); |
3
bd99b6549eb4
*: expand in readme and rename src/main to src/edl
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
212 break; |
8
0c98b46eaf73
*: update API to 2.0, big changes
Paper <paper@paper.us.eu.org>
parents:
6
diff
changeset
|
213 case EDL_HEADER_FADETIMEIN: |
0c98b46eaf73
*: update API to 2.0, big changes
Paper <paper@paper.us.eu.org>
parents:
6
diff
changeset
|
214 ADD_TO_OFFSET(fade_time_in, EDL_internal_parse_double); |
3
bd99b6549eb4
*: expand in readme and rename src/main to src/edl
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
215 break; |
8
0c98b46eaf73
*: update API to 2.0, big changes
Paper <paper@paper.us.eu.org>
parents:
6
diff
changeset
|
216 case EDL_HEADER_FADETIMEOUT: |
0c98b46eaf73
*: update API to 2.0, big changes
Paper <paper@paper.us.eu.org>
parents:
6
diff
changeset
|
217 ADD_TO_OFFSET(fade_time_out, EDL_internal_parse_double); |
3
bd99b6549eb4
*: expand in readme and rename src/main to src/edl
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
218 break; |
8
0c98b46eaf73
*: update API to 2.0, big changes
Paper <paper@paper.us.eu.org>
parents:
6
diff
changeset
|
219 case EDL_HEADER_SUSTAINGAIN: |
0c98b46eaf73
*: update API to 2.0, big changes
Paper <paper@paper.us.eu.org>
parents:
6
diff
changeset
|
220 ADD_TO_OFFSET(sustain_gain, EDL_internal_parse_double); |
3
bd99b6549eb4
*: expand in readme and rename src/main to src/edl
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
221 break; |
8
0c98b46eaf73
*: update API to 2.0, big changes
Paper <paper@paper.us.eu.org>
parents:
6
diff
changeset
|
222 case EDL_HEADER_CURVEIN: |
0c98b46eaf73
*: update API to 2.0, big changes
Paper <paper@paper.us.eu.org>
parents:
6
diff
changeset
|
223 ADD_TO_OFFSET(curve_in, EDL_internal_parse_int); |
3
bd99b6549eb4
*: expand in readme and rename src/main to src/edl
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
224 break; |
8
0c98b46eaf73
*: update API to 2.0, big changes
Paper <paper@paper.us.eu.org>
parents:
6
diff
changeset
|
225 case EDL_HEADER_GAININ: |
0c98b46eaf73
*: update API to 2.0, big changes
Paper <paper@paper.us.eu.org>
parents:
6
diff
changeset
|
226 ADD_TO_OFFSET(gain_in, EDL_internal_parse_double); |
3
bd99b6549eb4
*: expand in readme and rename src/main to src/edl
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
227 break; |
8
0c98b46eaf73
*: update API to 2.0, big changes
Paper <paper@paper.us.eu.org>
parents:
6
diff
changeset
|
228 case EDL_HEADER_CURVEOUT: |
0c98b46eaf73
*: update API to 2.0, big changes
Paper <paper@paper.us.eu.org>
parents:
6
diff
changeset
|
229 ADD_TO_OFFSET(curve_out, EDL_internal_parse_int); |
3
bd99b6549eb4
*: expand in readme and rename src/main to src/edl
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
230 break; |
8
0c98b46eaf73
*: update API to 2.0, big changes
Paper <paper@paper.us.eu.org>
parents:
6
diff
changeset
|
231 case EDL_HEADER_GAINOUT: |
0c98b46eaf73
*: update API to 2.0, big changes
Paper <paper@paper.us.eu.org>
parents:
6
diff
changeset
|
232 ADD_TO_OFFSET(gain_out, EDL_internal_parse_double); |
3
bd99b6549eb4
*: expand in readme and rename src/main to src/edl
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
233 break; |
8
0c98b46eaf73
*: update API to 2.0, big changes
Paper <paper@paper.us.eu.org>
parents:
6
diff
changeset
|
234 case EDL_HEADER_LAYER: |
0c98b46eaf73
*: update API to 2.0, big changes
Paper <paper@paper.us.eu.org>
parents:
6
diff
changeset
|
235 ADD_TO_OFFSET(layer, EDL_internal_parse_int); |
3
bd99b6549eb4
*: expand in readme and rename src/main to src/edl
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
236 break; |
8
0c98b46eaf73
*: update API to 2.0, big changes
Paper <paper@paper.us.eu.org>
parents:
6
diff
changeset
|
237 case EDL_HEADER_COLOR: |
0c98b46eaf73
*: update API to 2.0, big changes
Paper <paper@paper.us.eu.org>
parents:
6
diff
changeset
|
238 ADD_TO_OFFSET(color, EDL_internal_parse_int); |
3
bd99b6549eb4
*: expand in readme and rename src/main to src/edl
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
239 break; |
8
0c98b46eaf73
*: update API to 2.0, big changes
Paper <paper@paper.us.eu.org>
parents:
6
diff
changeset
|
240 case EDL_HEADER_CURVEINR: |
0c98b46eaf73
*: update API to 2.0, big changes
Paper <paper@paper.us.eu.org>
parents:
6
diff
changeset
|
241 ADD_TO_OFFSET(curve_in_r, EDL_internal_parse_int); |
3
bd99b6549eb4
*: expand in readme and rename src/main to src/edl
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
242 break; |
8
0c98b46eaf73
*: update API to 2.0, big changes
Paper <paper@paper.us.eu.org>
parents:
6
diff
changeset
|
243 case EDL_HEADER_CURVEOUTR: |
0c98b46eaf73
*: update API to 2.0, big changes
Paper <paper@paper.us.eu.org>
parents:
6
diff
changeset
|
244 ADD_TO_OFFSET(curve_out_r, EDL_internal_parse_int); |
3
bd99b6549eb4
*: expand in readme and rename src/main to src/edl
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
245 break; |
8
0c98b46eaf73
*: update API to 2.0, big changes
Paper <paper@paper.us.eu.org>
parents:
6
diff
changeset
|
246 case EDL_HEADER_PLAYPITCH: |
0c98b46eaf73
*: update API to 2.0, big changes
Paper <paper@paper.us.eu.org>
parents:
6
diff
changeset
|
247 ADD_TO_OFFSET(play_pitch, EDL_internal_parse_double); |
3
bd99b6549eb4
*: expand in readme and rename src/main to src/edl
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
248 break; |
8
0c98b46eaf73
*: update API to 2.0, big changes
Paper <paper@paper.us.eu.org>
parents:
6
diff
changeset
|
249 case EDL_HEADER_LOCKPITCH: |
0c98b46eaf73
*: update API to 2.0, big changes
Paper <paper@paper.us.eu.org>
parents:
6
diff
changeset
|
250 ADD_TO_OFFSET(lock_pitch, EDL_internal_parse_bool); |
3
bd99b6549eb4
*: expand in readme and rename src/main to src/edl
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
251 break; |
8
0c98b46eaf73
*: update API to 2.0, big changes
Paper <paper@paper.us.eu.org>
parents:
6
diff
changeset
|
252 case EDL_HEADER_FIRSTCHANNEL: |
0c98b46eaf73
*: update API to 2.0, big changes
Paper <paper@paper.us.eu.org>
parents:
6
diff
changeset
|
253 ADD_TO_OFFSET(first_channel, EDL_internal_parse_int); |
3
bd99b6549eb4
*: expand in readme and rename src/main to src/edl
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
254 break; |
8
0c98b46eaf73
*: update API to 2.0, big changes
Paper <paper@paper.us.eu.org>
parents:
6
diff
changeset
|
255 case EDL_HEADER_CHANNELS: |
0c98b46eaf73
*: update API to 2.0, big changes
Paper <paper@paper.us.eu.org>
parents:
6
diff
changeset
|
256 ADD_TO_OFFSET(channels, EDL_internal_parse_int); |
3
bd99b6549eb4
*: expand in readme and rename src/main to src/edl
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
257 break; |
bd99b6549eb4
*: expand in readme and rename src/main to src/edl
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
258 default: |
bd99b6549eb4
*: expand in readme and rename src/main to src/edl
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
259 /* ... what */ |
bd99b6549eb4
*: expand in readme and rename src/main to src/edl
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
260 break; |
4
c2408abb258a
*: add dumping to string, rename EDL_file to EDL
Paper <mrpapersonic@gmail.com>
parents:
3
diff
changeset
|
261 #undef ADD_TO_OFFSET |
3
bd99b6549eb4
*: expand in readme and rename src/main to src/edl
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
262 } |
bd99b6549eb4
*: expand in readme and rename src/main to src/edl
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
263 } |
bd99b6549eb4
*: expand in readme and rename src/main to src/edl
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
264 |
bd99b6549eb4
*: expand in readme and rename src/main to src/edl
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
265 if (!ok) |
bd99b6549eb4
*: expand in readme and rename src/main to src/edl
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
266 break; |
bd99b6549eb4
*: expand in readme and rename src/main to src/edl
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
267 |
8
0c98b46eaf73
*: update API to 2.0, big changes
Paper <paper@paper.us.eu.org>
parents:
6
diff
changeset
|
268 if (++edl->size >= edl->capacity) |
12
0cc2555db371
*: make our string functions not stupid
Paper <paper@paper.us.eu.org>
parents:
8
diff
changeset
|
269 if (EDL_reallocate(edl, edl->capacity * 2) < 0) |
0cc2555db371
*: make our string functions not stupid
Paper <paper@paper.us.eu.org>
parents:
8
diff
changeset
|
270 return EDL_PARSE_ERROR_OUT_OF_MEMORY; |
3
bd99b6549eb4
*: expand in readme and rename src/main to src/edl
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
271 } |
bd99b6549eb4
*: expand in readme and rename src/main to src/edl
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
272 |
12
0cc2555db371
*: make our string functions not stupid
Paper <paper@paper.us.eu.org>
parents:
8
diff
changeset
|
273 EDL_internal_free_header(&header); |
0cc2555db371
*: make our string functions not stupid
Paper <paper@paper.us.eu.org>
parents:
8
diff
changeset
|
274 |
8
0c98b46eaf73
*: update API to 2.0, big changes
Paper <paper@paper.us.eu.org>
parents:
6
diff
changeset
|
275 /* put on the shrinkwrap */ |
12
0cc2555db371
*: make our string functions not stupid
Paper <paper@paper.us.eu.org>
parents:
8
diff
changeset
|
276 if (EDL_reallocate(edl, edl->size) < 0) |
0cc2555db371
*: make our string functions not stupid
Paper <paper@paper.us.eu.org>
parents:
8
diff
changeset
|
277 return EDL_PARSE_ERROR_OUT_OF_MEMORY; |
3
bd99b6549eb4
*: expand in readme and rename src/main to src/edl
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
278 |
8
0c98b46eaf73
*: update API to 2.0, big changes
Paper <paper@paper.us.eu.org>
parents:
6
diff
changeset
|
279 return EDL_PARSE_ERROR_SUCCESS; |
4
c2408abb258a
*: add dumping to string, rename EDL_file to EDL
Paper <mrpapersonic@gmail.com>
parents:
3
diff
changeset
|
280 } |
c2408abb258a
*: add dumping to string, rename EDL_file to EDL
Paper <mrpapersonic@gmail.com>
parents:
3
diff
changeset
|
281 |
12
0cc2555db371
*: make our string functions not stupid
Paper <paper@paper.us.eu.org>
parents:
8
diff
changeset
|
282 static void EDL_dump_line(EDL_internal_string* str, const EDL_line* line, const EDL_header* header) { |
8
0c98b46eaf73
*: update API to 2.0, big changes
Paper <paper@paper.us.eu.org>
parents:
6
diff
changeset
|
283 size_t i; |
4
c2408abb258a
*: add dumping to string, rename EDL_file to EDL
Paper <mrpapersonic@gmail.com>
parents:
3
diff
changeset
|
284 |
12
0cc2555db371
*: make our string functions not stupid
Paper <paper@paper.us.eu.org>
parents:
8
diff
changeset
|
285 for (i = 0; i < header->size; i++) { |
0cc2555db371
*: make our string functions not stupid
Paper <paper@paper.us.eu.org>
parents:
8
diff
changeset
|
286 switch (header->order[i]) { |
8
0c98b46eaf73
*: update API to 2.0, big changes
Paper <paper@paper.us.eu.org>
parents:
6
diff
changeset
|
287 case EDL_HEADER_ID: |
12
0cc2555db371
*: make our string functions not stupid
Paper <paper@paper.us.eu.org>
parents:
8
diff
changeset
|
288 EDL_internal_append_integer_to_string(str, line->id); |
4
c2408abb258a
*: add dumping to string, rename EDL_file to EDL
Paper <mrpapersonic@gmail.com>
parents:
3
diff
changeset
|
289 break; |
8
0c98b46eaf73
*: update API to 2.0, big changes
Paper <paper@paper.us.eu.org>
parents:
6
diff
changeset
|
290 case EDL_HEADER_TRACK: |
12
0cc2555db371
*: make our string functions not stupid
Paper <paper@paper.us.eu.org>
parents:
8
diff
changeset
|
291 EDL_internal_append_integer_to_string(str, line->track); |
4
c2408abb258a
*: add dumping to string, rename EDL_file to EDL
Paper <mrpapersonic@gmail.com>
parents:
3
diff
changeset
|
292 break; |
8
0c98b46eaf73
*: update API to 2.0, big changes
Paper <paper@paper.us.eu.org>
parents:
6
diff
changeset
|
293 case EDL_HEADER_STARTTIME: |
12
0cc2555db371
*: make our string functions not stupid
Paper <paper@paper.us.eu.org>
parents:
8
diff
changeset
|
294 EDL_internal_append_double_to_string(str, line->start_time); |
4
c2408abb258a
*: add dumping to string, rename EDL_file to EDL
Paper <mrpapersonic@gmail.com>
parents:
3
diff
changeset
|
295 break; |
8
0c98b46eaf73
*: update API to 2.0, big changes
Paper <paper@paper.us.eu.org>
parents:
6
diff
changeset
|
296 case EDL_HEADER_LENGTH: |
12
0cc2555db371
*: make our string functions not stupid
Paper <paper@paper.us.eu.org>
parents:
8
diff
changeset
|
297 EDL_internal_append_double_to_string(str, line->length); |
4
c2408abb258a
*: add dumping to string, rename EDL_file to EDL
Paper <mrpapersonic@gmail.com>
parents:
3
diff
changeset
|
298 break; |
8
0c98b46eaf73
*: update API to 2.0, big changes
Paper <paper@paper.us.eu.org>
parents:
6
diff
changeset
|
299 case EDL_HEADER_PLAYRATE: |
12
0cc2555db371
*: make our string functions not stupid
Paper <paper@paper.us.eu.org>
parents:
8
diff
changeset
|
300 EDL_internal_append_double_to_string(str, line->play_rate); |
4
c2408abb258a
*: add dumping to string, rename EDL_file to EDL
Paper <mrpapersonic@gmail.com>
parents:
3
diff
changeset
|
301 break; |
8
0c98b46eaf73
*: update API to 2.0, big changes
Paper <paper@paper.us.eu.org>
parents:
6
diff
changeset
|
302 case EDL_HEADER_LOCKED: |
12
0cc2555db371
*: make our string functions not stupid
Paper <paper@paper.us.eu.org>
parents:
8
diff
changeset
|
303 EDL_internal_append_bool_to_string(str, line->locked); |
4
c2408abb258a
*: add dumping to string, rename EDL_file to EDL
Paper <mrpapersonic@gmail.com>
parents:
3
diff
changeset
|
304 break; |
8
0c98b46eaf73
*: update API to 2.0, big changes
Paper <paper@paper.us.eu.org>
parents:
6
diff
changeset
|
305 case EDL_HEADER_NORMALIZED: |
12
0cc2555db371
*: make our string functions not stupid
Paper <paper@paper.us.eu.org>
parents:
8
diff
changeset
|
306 EDL_internal_append_bool_to_string(str, line->normalized); |
4
c2408abb258a
*: add dumping to string, rename EDL_file to EDL
Paper <mrpapersonic@gmail.com>
parents:
3
diff
changeset
|
307 break; |
8
0c98b46eaf73
*: update API to 2.0, big changes
Paper <paper@paper.us.eu.org>
parents:
6
diff
changeset
|
308 case EDL_HEADER_STRETCHMETHOD: |
12
0cc2555db371
*: make our string functions not stupid
Paper <paper@paper.us.eu.org>
parents:
8
diff
changeset
|
309 EDL_internal_append_integer_to_string(str, line->stretch_method); |
4
c2408abb258a
*: add dumping to string, rename EDL_file to EDL
Paper <mrpapersonic@gmail.com>
parents:
3
diff
changeset
|
310 break; |
8
0c98b46eaf73
*: update API to 2.0, big changes
Paper <paper@paper.us.eu.org>
parents:
6
diff
changeset
|
311 case EDL_HEADER_LOOPED: |
12
0cc2555db371
*: make our string functions not stupid
Paper <paper@paper.us.eu.org>
parents:
8
diff
changeset
|
312 EDL_internal_append_bool_to_string(str, line->looped); |
4
c2408abb258a
*: add dumping to string, rename EDL_file to EDL
Paper <mrpapersonic@gmail.com>
parents:
3
diff
changeset
|
313 break; |
8
0c98b46eaf73
*: update API to 2.0, big changes
Paper <paper@paper.us.eu.org>
parents:
6
diff
changeset
|
314 case EDL_HEADER_ONRULER: |
12
0cc2555db371
*: make our string functions not stupid
Paper <paper@paper.us.eu.org>
parents:
8
diff
changeset
|
315 EDL_internal_append_bool_to_string(str, line->on_ruler); |
4
c2408abb258a
*: add dumping to string, rename EDL_file to EDL
Paper <mrpapersonic@gmail.com>
parents:
3
diff
changeset
|
316 break; |
8
0c98b46eaf73
*: update API to 2.0, big changes
Paper <paper@paper.us.eu.org>
parents:
6
diff
changeset
|
317 case EDL_HEADER_MEDIATYPE: |
12
0cc2555db371
*: make our string functions not stupid
Paper <paper@paper.us.eu.org>
parents:
8
diff
changeset
|
318 EDL_internal_append_media_type_to_string(str, line->media_type); |
4
c2408abb258a
*: add dumping to string, rename EDL_file to EDL
Paper <mrpapersonic@gmail.com>
parents:
3
diff
changeset
|
319 break; |
8
0c98b46eaf73
*: update API to 2.0, big changes
Paper <paper@paper.us.eu.org>
parents:
6
diff
changeset
|
320 case EDL_HEADER_FILENAME: |
4
c2408abb258a
*: add dumping to string, rename EDL_file to EDL
Paper <mrpapersonic@gmail.com>
parents:
3
diff
changeset
|
321 EDL_internal_string_append(str, "\"", 1); |
8
0c98b46eaf73
*: update API to 2.0, big changes
Paper <paper@paper.us.eu.org>
parents:
6
diff
changeset
|
322 EDL_internal_string_append(str, line->filename, strlen(line->filename)); |
4
c2408abb258a
*: add dumping to string, rename EDL_file to EDL
Paper <mrpapersonic@gmail.com>
parents:
3
diff
changeset
|
323 EDL_internal_string_append(str, "\"", 1); |
c2408abb258a
*: add dumping to string, rename EDL_file to EDL
Paper <mrpapersonic@gmail.com>
parents:
3
diff
changeset
|
324 break; |
8
0c98b46eaf73
*: update API to 2.0, big changes
Paper <paper@paper.us.eu.org>
parents:
6
diff
changeset
|
325 case EDL_HEADER_STREAM: |
12
0cc2555db371
*: make our string functions not stupid
Paper <paper@paper.us.eu.org>
parents:
8
diff
changeset
|
326 EDL_internal_append_integer_to_string(str, line->stream); |
4
c2408abb258a
*: add dumping to string, rename EDL_file to EDL
Paper <mrpapersonic@gmail.com>
parents:
3
diff
changeset
|
327 break; |
8
0c98b46eaf73
*: update API to 2.0, big changes
Paper <paper@paper.us.eu.org>
parents:
6
diff
changeset
|
328 case EDL_HEADER_STREAMSTART: |
12
0cc2555db371
*: make our string functions not stupid
Paper <paper@paper.us.eu.org>
parents:
8
diff
changeset
|
329 EDL_internal_append_double_to_string(str, line->stream_start); |
4
c2408abb258a
*: add dumping to string, rename EDL_file to EDL
Paper <mrpapersonic@gmail.com>
parents:
3
diff
changeset
|
330 break; |
8
0c98b46eaf73
*: update API to 2.0, big changes
Paper <paper@paper.us.eu.org>
parents:
6
diff
changeset
|
331 case EDL_HEADER_STREAMLENGTH: |
12
0cc2555db371
*: make our string functions not stupid
Paper <paper@paper.us.eu.org>
parents:
8
diff
changeset
|
332 EDL_internal_append_double_to_string(str, line->stream_length); |
4
c2408abb258a
*: add dumping to string, rename EDL_file to EDL
Paper <mrpapersonic@gmail.com>
parents:
3
diff
changeset
|
333 break; |
8
0c98b46eaf73
*: update API to 2.0, big changes
Paper <paper@paper.us.eu.org>
parents:
6
diff
changeset
|
334 case EDL_HEADER_FADETIMEIN: |
12
0cc2555db371
*: make our string functions not stupid
Paper <paper@paper.us.eu.org>
parents:
8
diff
changeset
|
335 EDL_internal_append_double_to_string(str, line->fade_time_in); |
4
c2408abb258a
*: add dumping to string, rename EDL_file to EDL
Paper <mrpapersonic@gmail.com>
parents:
3
diff
changeset
|
336 break; |
8
0c98b46eaf73
*: update API to 2.0, big changes
Paper <paper@paper.us.eu.org>
parents:
6
diff
changeset
|
337 case EDL_HEADER_FADETIMEOUT: |
12
0cc2555db371
*: make our string functions not stupid
Paper <paper@paper.us.eu.org>
parents:
8
diff
changeset
|
338 EDL_internal_append_double_to_string(str, line->fade_time_out); |
4
c2408abb258a
*: add dumping to string, rename EDL_file to EDL
Paper <mrpapersonic@gmail.com>
parents:
3
diff
changeset
|
339 break; |
8
0c98b46eaf73
*: update API to 2.0, big changes
Paper <paper@paper.us.eu.org>
parents:
6
diff
changeset
|
340 case EDL_HEADER_SUSTAINGAIN: |
12
0cc2555db371
*: make our string functions not stupid
Paper <paper@paper.us.eu.org>
parents:
8
diff
changeset
|
341 EDL_internal_append_double_to_string(str, line->sustain_gain); |
4
c2408abb258a
*: add dumping to string, rename EDL_file to EDL
Paper <mrpapersonic@gmail.com>
parents:
3
diff
changeset
|
342 break; |
8
0c98b46eaf73
*: update API to 2.0, big changes
Paper <paper@paper.us.eu.org>
parents:
6
diff
changeset
|
343 case EDL_HEADER_CURVEIN: |
12
0cc2555db371
*: make our string functions not stupid
Paper <paper@paper.us.eu.org>
parents:
8
diff
changeset
|
344 EDL_internal_append_integer_to_string(str, line->curve_in); |
4
c2408abb258a
*: add dumping to string, rename EDL_file to EDL
Paper <mrpapersonic@gmail.com>
parents:
3
diff
changeset
|
345 break; |
8
0c98b46eaf73
*: update API to 2.0, big changes
Paper <paper@paper.us.eu.org>
parents:
6
diff
changeset
|
346 case EDL_HEADER_GAININ: |
12
0cc2555db371
*: make our string functions not stupid
Paper <paper@paper.us.eu.org>
parents:
8
diff
changeset
|
347 EDL_internal_append_double_to_string(str, line->gain_in); |
4
c2408abb258a
*: add dumping to string, rename EDL_file to EDL
Paper <mrpapersonic@gmail.com>
parents:
3
diff
changeset
|
348 break; |
8
0c98b46eaf73
*: update API to 2.0, big changes
Paper <paper@paper.us.eu.org>
parents:
6
diff
changeset
|
349 case EDL_HEADER_CURVEOUT: |
12
0cc2555db371
*: make our string functions not stupid
Paper <paper@paper.us.eu.org>
parents:
8
diff
changeset
|
350 EDL_internal_append_integer_to_string(str, line->curve_out); |
4
c2408abb258a
*: add dumping to string, rename EDL_file to EDL
Paper <mrpapersonic@gmail.com>
parents:
3
diff
changeset
|
351 break; |
8
0c98b46eaf73
*: update API to 2.0, big changes
Paper <paper@paper.us.eu.org>
parents:
6
diff
changeset
|
352 case EDL_HEADER_GAINOUT: |
12
0cc2555db371
*: make our string functions not stupid
Paper <paper@paper.us.eu.org>
parents:
8
diff
changeset
|
353 EDL_internal_append_double_to_string(str, line->gain_out); |
4
c2408abb258a
*: add dumping to string, rename EDL_file to EDL
Paper <mrpapersonic@gmail.com>
parents:
3
diff
changeset
|
354 break; |
8
0c98b46eaf73
*: update API to 2.0, big changes
Paper <paper@paper.us.eu.org>
parents:
6
diff
changeset
|
355 case EDL_HEADER_LAYER: |
12
0cc2555db371
*: make our string functions not stupid
Paper <paper@paper.us.eu.org>
parents:
8
diff
changeset
|
356 EDL_internal_append_integer_to_string(str, line->layer); |
4
c2408abb258a
*: add dumping to string, rename EDL_file to EDL
Paper <mrpapersonic@gmail.com>
parents:
3
diff
changeset
|
357 break; |
8
0c98b46eaf73
*: update API to 2.0, big changes
Paper <paper@paper.us.eu.org>
parents:
6
diff
changeset
|
358 case EDL_HEADER_COLOR: |
12
0cc2555db371
*: make our string functions not stupid
Paper <paper@paper.us.eu.org>
parents:
8
diff
changeset
|
359 EDL_internal_append_integer_to_string(str, line->color); |
4
c2408abb258a
*: add dumping to string, rename EDL_file to EDL
Paper <mrpapersonic@gmail.com>
parents:
3
diff
changeset
|
360 break; |
8
0c98b46eaf73
*: update API to 2.0, big changes
Paper <paper@paper.us.eu.org>
parents:
6
diff
changeset
|
361 case EDL_HEADER_CURVEINR: |
12
0cc2555db371
*: make our string functions not stupid
Paper <paper@paper.us.eu.org>
parents:
8
diff
changeset
|
362 EDL_internal_append_integer_to_string(str, line->curve_in_r); |
4
c2408abb258a
*: add dumping to string, rename EDL_file to EDL
Paper <mrpapersonic@gmail.com>
parents:
3
diff
changeset
|
363 break; |
8
0c98b46eaf73
*: update API to 2.0, big changes
Paper <paper@paper.us.eu.org>
parents:
6
diff
changeset
|
364 case EDL_HEADER_CURVEOUTR: |
12
0cc2555db371
*: make our string functions not stupid
Paper <paper@paper.us.eu.org>
parents:
8
diff
changeset
|
365 EDL_internal_append_integer_to_string(str, line->curve_out_r); |
4
c2408abb258a
*: add dumping to string, rename EDL_file to EDL
Paper <mrpapersonic@gmail.com>
parents:
3
diff
changeset
|
366 break; |
8
0c98b46eaf73
*: update API to 2.0, big changes
Paper <paper@paper.us.eu.org>
parents:
6
diff
changeset
|
367 case EDL_HEADER_PLAYPITCH: |
12
0cc2555db371
*: make our string functions not stupid
Paper <paper@paper.us.eu.org>
parents:
8
diff
changeset
|
368 EDL_internal_append_double_to_string(str, line->play_pitch); |
4
c2408abb258a
*: add dumping to string, rename EDL_file to EDL
Paper <mrpapersonic@gmail.com>
parents:
3
diff
changeset
|
369 break; |
8
0c98b46eaf73
*: update API to 2.0, big changes
Paper <paper@paper.us.eu.org>
parents:
6
diff
changeset
|
370 case EDL_HEADER_LOCKPITCH: |
12
0cc2555db371
*: make our string functions not stupid
Paper <paper@paper.us.eu.org>
parents:
8
diff
changeset
|
371 EDL_internal_append_bool_to_string(str, line->lock_pitch); |
4
c2408abb258a
*: add dumping to string, rename EDL_file to EDL
Paper <mrpapersonic@gmail.com>
parents:
3
diff
changeset
|
372 break; |
8
0c98b46eaf73
*: update API to 2.0, big changes
Paper <paper@paper.us.eu.org>
parents:
6
diff
changeset
|
373 case EDL_HEADER_FIRSTCHANNEL: |
12
0cc2555db371
*: make our string functions not stupid
Paper <paper@paper.us.eu.org>
parents:
8
diff
changeset
|
374 EDL_internal_append_integer_to_string(str, line->first_channel); |
4
c2408abb258a
*: add dumping to string, rename EDL_file to EDL
Paper <mrpapersonic@gmail.com>
parents:
3
diff
changeset
|
375 break; |
8
0c98b46eaf73
*: update API to 2.0, big changes
Paper <paper@paper.us.eu.org>
parents:
6
diff
changeset
|
376 case EDL_HEADER_CHANNELS: |
12
0cc2555db371
*: make our string functions not stupid
Paper <paper@paper.us.eu.org>
parents:
8
diff
changeset
|
377 EDL_internal_append_integer_to_string(str, line->channels); |
4
c2408abb258a
*: add dumping to string, rename EDL_file to EDL
Paper <mrpapersonic@gmail.com>
parents:
3
diff
changeset
|
378 break; |
c2408abb258a
*: add dumping to string, rename EDL_file to EDL
Paper <mrpapersonic@gmail.com>
parents:
3
diff
changeset
|
379 default: |
c2408abb258a
*: add dumping to string, rename EDL_file to EDL
Paper <mrpapersonic@gmail.com>
parents:
3
diff
changeset
|
380 /* ... what */ |
c2408abb258a
*: add dumping to string, rename EDL_file to EDL
Paper <mrpapersonic@gmail.com>
parents:
3
diff
changeset
|
381 break; |
c2408abb258a
*: add dumping to string, rename EDL_file to EDL
Paper <mrpapersonic@gmail.com>
parents:
3
diff
changeset
|
382 } |
c2408abb258a
*: add dumping to string, rename EDL_file to EDL
Paper <mrpapersonic@gmail.com>
parents:
3
diff
changeset
|
383 |
12
0cc2555db371
*: make our string functions not stupid
Paper <paper@paper.us.eu.org>
parents:
8
diff
changeset
|
384 if (i < header->size - 1) |
4
c2408abb258a
*: add dumping to string, rename EDL_file to EDL
Paper <mrpapersonic@gmail.com>
parents:
3
diff
changeset
|
385 EDL_internal_string_append(str, ";\t", 2); |
c2408abb258a
*: add dumping to string, rename EDL_file to EDL
Paper <mrpapersonic@gmail.com>
parents:
3
diff
changeset
|
386 else |
c2408abb258a
*: add dumping to string, rename EDL_file to EDL
Paper <mrpapersonic@gmail.com>
parents:
3
diff
changeset
|
387 EDL_internal_string_append(str, ";", 1); |
c2408abb258a
*: add dumping to string, rename EDL_file to EDL
Paper <mrpapersonic@gmail.com>
parents:
3
diff
changeset
|
388 } |
c2408abb258a
*: add dumping to string, rename EDL_file to EDL
Paper <mrpapersonic@gmail.com>
parents:
3
diff
changeset
|
389 |
c2408abb258a
*: add dumping to string, rename EDL_file to EDL
Paper <mrpapersonic@gmail.com>
parents:
3
diff
changeset
|
390 EDL_internal_string_append(str, "\n", 1); |
c2408abb258a
*: add dumping to string, rename EDL_file to EDL
Paper <mrpapersonic@gmail.com>
parents:
3
diff
changeset
|
391 } |
c2408abb258a
*: add dumping to string, rename EDL_file to EDL
Paper <mrpapersonic@gmail.com>
parents:
3
diff
changeset
|
392 |
8
0c98b46eaf73
*: update API to 2.0, big changes
Paper <paper@paper.us.eu.org>
parents:
6
diff
changeset
|
393 /* this gets progressively slower and slower... oops */ |
0c98b46eaf73
*: update API to 2.0, big changes
Paper <paper@paper.us.eu.org>
parents:
6
diff
changeset
|
394 char* EDL_dump(const EDL* edl) { |
0c98b46eaf73
*: update API to 2.0, big changes
Paper <paper@paper.us.eu.org>
parents:
6
diff
changeset
|
395 static const char order_str[] = |
0c98b46eaf73
*: update API to 2.0, big changes
Paper <paper@paper.us.eu.org>
parents:
6
diff
changeset
|
396 "\"ID\";\"Track\";\"StartTime\";\"Length\";\"PlayRate\";\"Locked\";\"Normalized\";\"StretchMethod\";" |
0c98b46eaf73
*: update API to 2.0, big changes
Paper <paper@paper.us.eu.org>
parents:
6
diff
changeset
|
397 "\"Looped\";\"OnRuler\";\"MediaType\";\"FileName\";\"Stream\";\"StreamStart\";\"StreamLength\";" |
0c98b46eaf73
*: update API to 2.0, big changes
Paper <paper@paper.us.eu.org>
parents:
6
diff
changeset
|
398 "\"FadeTimeIn\";\"FadeTimeOut\";\"SustainGain\";\"CurveIn\";\"GainIn\";\"CurveOut\";\"GainOut\";" |
0c98b46eaf73
*: update API to 2.0, big changes
Paper <paper@paper.us.eu.org>
parents:
6
diff
changeset
|
399 "\"Layer\";\"Color\";\"CurveInR\";\"CurveOutR\":\"PlayPitch\";\"LockPitch\";\"FirstChannel\";\"Channels\"\n"; |
0c98b46eaf73
*: update API to 2.0, big changes
Paper <paper@paper.us.eu.org>
parents:
6
diff
changeset
|
400 |
4
c2408abb258a
*: add dumping to string, rename EDL_file to EDL
Paper <mrpapersonic@gmail.com>
parents:
3
diff
changeset
|
401 EDL_internal_string ret; |
c2408abb258a
*: add dumping to string, rename EDL_file to EDL
Paper <mrpapersonic@gmail.com>
parents:
3
diff
changeset
|
402 EDL_internal_string_init(&ret); |
c2408abb258a
*: add dumping to string, rename EDL_file to EDL
Paper <mrpapersonic@gmail.com>
parents:
3
diff
changeset
|
403 |
c2408abb258a
*: add dumping to string, rename EDL_file to EDL
Paper <mrpapersonic@gmail.com>
parents:
3
diff
changeset
|
404 EDL_internal_string_append(&ret, order_str, strlen(order_str)); |
c2408abb258a
*: add dumping to string, rename EDL_file to EDL
Paper <mrpapersonic@gmail.com>
parents:
3
diff
changeset
|
405 |
8
0c98b46eaf73
*: update API to 2.0, big changes
Paper <paper@paper.us.eu.org>
parents:
6
diff
changeset
|
406 { |
12
0cc2555db371
*: make our string functions not stupid
Paper <paper@paper.us.eu.org>
parents:
8
diff
changeset
|
407 /* how? */ |
0cc2555db371
*: make our string functions not stupid
Paper <paper@paper.us.eu.org>
parents:
8
diff
changeset
|
408 EDL_header header = {0}; |
0cc2555db371
*: make our string functions not stupid
Paper <paper@paper.us.eu.org>
parents:
8
diff
changeset
|
409 if (EDL_internal_parse_header(&header, order_str, 0, strlen(order_str)) < 0) |
0cc2555db371
*: make our string functions not stupid
Paper <paper@paper.us.eu.org>
parents:
8
diff
changeset
|
410 return NULL; |
4
c2408abb258a
*: add dumping to string, rename EDL_file to EDL
Paper <mrpapersonic@gmail.com>
parents:
3
diff
changeset
|
411 |
8
0c98b46eaf73
*: update API to 2.0, big changes
Paper <paper@paper.us.eu.org>
parents:
6
diff
changeset
|
412 size_t i; |
0c98b46eaf73
*: update API to 2.0, big changes
Paper <paper@paper.us.eu.org>
parents:
6
diff
changeset
|
413 for (i = 0; i < edl->size; i++) |
12
0cc2555db371
*: make our string functions not stupid
Paper <paper@paper.us.eu.org>
parents:
8
diff
changeset
|
414 EDL_dump_line(&ret, &edl->arr[i], &header); |
4
c2408abb258a
*: add dumping to string, rename EDL_file to EDL
Paper <mrpapersonic@gmail.com>
parents:
3
diff
changeset
|
415 |
12
0cc2555db371
*: make our string functions not stupid
Paper <paper@paper.us.eu.org>
parents:
8
diff
changeset
|
416 EDL_internal_free_header(&header); |
8
0c98b46eaf73
*: update API to 2.0, big changes
Paper <paper@paper.us.eu.org>
parents:
6
diff
changeset
|
417 } |
4
c2408abb258a
*: add dumping to string, rename EDL_file to EDL
Paper <mrpapersonic@gmail.com>
parents:
3
diff
changeset
|
418 |
c2408abb258a
*: add dumping to string, rename EDL_file to EDL
Paper <mrpapersonic@gmail.com>
parents:
3
diff
changeset
|
419 return ret.data; |
c2408abb258a
*: add dumping to string, rename EDL_file to EDL
Paper <mrpapersonic@gmail.com>
parents:
3
diff
changeset
|
420 } |
c2408abb258a
*: add dumping to string, rename EDL_file to EDL
Paper <mrpapersonic@gmail.com>
parents:
3
diff
changeset
|
421 |
8
0c98b46eaf73
*: update API to 2.0, big changes
Paper <paper@paper.us.eu.org>
parents:
6
diff
changeset
|
422 void EDL_free(EDL* edl) { |
4
c2408abb258a
*: add dumping to string, rename EDL_file to EDL
Paper <mrpapersonic@gmail.com>
parents:
3
diff
changeset
|
423 size_t i; |
8
0c98b46eaf73
*: update API to 2.0, big changes
Paper <paper@paper.us.eu.org>
parents:
6
diff
changeset
|
424 for (i = 0; i < edl->size; i++) { |
0c98b46eaf73
*: update API to 2.0, big changes
Paper <paper@paper.us.eu.org>
parents:
6
diff
changeset
|
425 if (edl->arr[i].filename) |
0c98b46eaf73
*: update API to 2.0, big changes
Paper <paper@paper.us.eu.org>
parents:
6
diff
changeset
|
426 free(edl->arr[i].filename); |
3
bd99b6549eb4
*: expand in readme and rename src/main to src/edl
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
427 } |
8
0c98b46eaf73
*: update API to 2.0, big changes
Paper <paper@paper.us.eu.org>
parents:
6
diff
changeset
|
428 free(edl->arr); |
3
bd99b6549eb4
*: expand in readme and rename src/main to src/edl
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
429 } |