Mercurial > libedl
annotate README.md @ 2:d00bc412900e
*: fix up lots of stuff and make the thing actually usable
author | Paper <mrpapersonic@gmail.com> |
---|---|
date | Sun, 24 Dec 2023 20:01:30 -0500 |
parents | 0ea1ec2da443 |
children | bd99b6549eb4 |
rev | line source |
---|---|
2
d00bc412900e
*: fix up lots of stuff and make the thing actually usable
Paper <mrpapersonic@gmail.com>
parents:
0
diff
changeset
|
1 # libedl |
d00bc412900e
*: fix up lots of stuff and make the thing actually usable
Paper <mrpapersonic@gmail.com>
parents:
0
diff
changeset
|
2 libedl is a library for parsing Vegas Pro EDL files and translating them into usable C structures. |
d00bc412900e
*: fix up lots of stuff and make the thing actually usable
Paper <mrpapersonic@gmail.com>
parents:
0
diff
changeset
|
3 |
d00bc412900e
*: fix up lots of stuff and make the thing actually usable
Paper <mrpapersonic@gmail.com>
parents:
0
diff
changeset
|
4 ## Usage |
d00bc412900e
*: fix up lots of stuff and make the thing actually usable
Paper <mrpapersonic@gmail.com>
parents:
0
diff
changeset
|
5 ```c |
d00bc412900e
*: fix up lots of stuff and make the thing actually usable
Paper <mrpapersonic@gmail.com>
parents:
0
diff
changeset
|
6 #include <stdio.h> |
d00bc412900e
*: fix up lots of stuff and make the thing actually usable
Paper <mrpapersonic@gmail.com>
parents:
0
diff
changeset
|
7 #include "edl.h" |
d00bc412900e
*: fix up lots of stuff and make the thing actually usable
Paper <mrpapersonic@gmail.com>
parents:
0
diff
changeset
|
8 |
d00bc412900e
*: fix up lots of stuff and make the thing actually usable
Paper <mrpapersonic@gmail.com>
parents:
0
diff
changeset
|
9 int main(){ |
d00bc412900e
*: fix up lots of stuff and make the thing actually usable
Paper <mrpapersonic@gmail.com>
parents:
0
diff
changeset
|
10 /* open the file */ |
d00bc412900e
*: fix up lots of stuff and make the thing actually usable
Paper <mrpapersonic@gmail.com>
parents:
0
diff
changeset
|
11 FILE* file = fopen("MyProject.txt", "rb"); |
d00bc412900e
*: fix up lots of stuff and make the thing actually usable
Paper <mrpapersonic@gmail.com>
parents:
0
diff
changeset
|
12 if (!file) |
d00bc412900e
*: fix up lots of stuff and make the thing actually usable
Paper <mrpapersonic@gmail.com>
parents:
0
diff
changeset
|
13 return 1; |
d00bc412900e
*: fix up lots of stuff and make the thing actually usable
Paper <mrpapersonic@gmail.com>
parents:
0
diff
changeset
|
14 |
d00bc412900e
*: fix up lots of stuff and make the thing actually usable
Paper <mrpapersonic@gmail.com>
parents:
0
diff
changeset
|
15 /* get filesize */ |
d00bc412900e
*: fix up lots of stuff and make the thing actually usable
Paper <mrpapersonic@gmail.com>
parents:
0
diff
changeset
|
16 fseek(file, 0L, SEEK_END); |
d00bc412900e
*: fix up lots of stuff and make the thing actually usable
Paper <mrpapersonic@gmail.com>
parents:
0
diff
changeset
|
17 long fsize = ftell(file); |
d00bc412900e
*: fix up lots of stuff and make the thing actually usable
Paper <mrpapersonic@gmail.com>
parents:
0
diff
changeset
|
18 fseek(file, 0L, SEEK_SET); |
0 | 19 |
2
d00bc412900e
*: fix up lots of stuff and make the thing actually usable
Paper <mrpapersonic@gmail.com>
parents:
0
diff
changeset
|
20 /* grab the contents */ |
d00bc412900e
*: fix up lots of stuff and make the thing actually usable
Paper <mrpapersonic@gmail.com>
parents:
0
diff
changeset
|
21 char* data = malloc(fsize + 1); |
d00bc412900e
*: fix up lots of stuff and make the thing actually usable
Paper <mrpapersonic@gmail.com>
parents:
0
diff
changeset
|
22 if (!data) |
d00bc412900e
*: fix up lots of stuff and make the thing actually usable
Paper <mrpapersonic@gmail.com>
parents:
0
diff
changeset
|
23 return 1; |
d00bc412900e
*: fix up lots of stuff and make the thing actually usable
Paper <mrpapersonic@gmail.com>
parents:
0
diff
changeset
|
24 |
d00bc412900e
*: fix up lots of stuff and make the thing actually usable
Paper <mrpapersonic@gmail.com>
parents:
0
diff
changeset
|
25 fread(data, fsize, 1, file); |
d00bc412900e
*: fix up lots of stuff and make the thing actually usable
Paper <mrpapersonic@gmail.com>
parents:
0
diff
changeset
|
26 |
d00bc412900e
*: fix up lots of stuff and make the thing actually usable
Paper <mrpapersonic@gmail.com>
parents:
0
diff
changeset
|
27 fclose(file); |
d00bc412900e
*: fix up lots of stuff and make the thing actually usable
Paper <mrpapersonic@gmail.com>
parents:
0
diff
changeset
|
28 |
d00bc412900e
*: fix up lots of stuff and make the thing actually usable
Paper <mrpapersonic@gmail.com>
parents:
0
diff
changeset
|
29 /* pass it to libedl */ |
d00bc412900e
*: fix up lots of stuff and make the thing actually usable
Paper <mrpapersonic@gmail.com>
parents:
0
diff
changeset
|
30 EDL_file edl = EDL_parse(data, fsize + 1); |
d00bc412900e
*: fix up lots of stuff and make the thing actually usable
Paper <mrpapersonic@gmail.com>
parents:
0
diff
changeset
|
31 |
d00bc412900e
*: fix up lots of stuff and make the thing actually usable
Paper <mrpapersonic@gmail.com>
parents:
0
diff
changeset
|
32 /* do what we have to do with it */ |
d00bc412900e
*: fix up lots of stuff and make the thing actually usable
Paper <mrpapersonic@gmail.com>
parents:
0
diff
changeset
|
33 for (int i = 0; i < edl.size; i++) { |
d00bc412900e
*: fix up lots of stuff and make the thing actually usable
Paper <mrpapersonic@gmail.com>
parents:
0
diff
changeset
|
34 printf("%s", edl.arr[i].filename); |
d00bc412900e
*: fix up lots of stuff and make the thing actually usable
Paper <mrpapersonic@gmail.com>
parents:
0
diff
changeset
|
35 } |
d00bc412900e
*: fix up lots of stuff and make the thing actually usable
Paper <mrpapersonic@gmail.com>
parents:
0
diff
changeset
|
36 |
d00bc412900e
*: fix up lots of stuff and make the thing actually usable
Paper <mrpapersonic@gmail.com>
parents:
0
diff
changeset
|
37 /* free our memory */ |
d00bc412900e
*: fix up lots of stuff and make the thing actually usable
Paper <mrpapersonic@gmail.com>
parents:
0
diff
changeset
|
38 EDL_free(edl); |
d00bc412900e
*: fix up lots of stuff and make the thing actually usable
Paper <mrpapersonic@gmail.com>
parents:
0
diff
changeset
|
39 free(data); |
d00bc412900e
*: fix up lots of stuff and make the thing actually usable
Paper <mrpapersonic@gmail.com>
parents:
0
diff
changeset
|
40 |
d00bc412900e
*: fix up lots of stuff and make the thing actually usable
Paper <mrpapersonic@gmail.com>
parents:
0
diff
changeset
|
41 return 0; |
d00bc412900e
*: fix up lots of stuff and make the thing actually usable
Paper <mrpapersonic@gmail.com>
parents:
0
diff
changeset
|
42 } |
d00bc412900e
*: fix up lots of stuff and make the thing actually usable
Paper <mrpapersonic@gmail.com>
parents:
0
diff
changeset
|
43 ``` |