Mercurial > libedl
annotate README.md @ 3:bd99b6549eb4
*: expand in readme and rename src/main to src/edl
author | Paper <mrpapersonic@gmail.com> |
---|---|
date | Sun, 24 Dec 2023 20:22:54 -0500 |
parents | d00bc412900e |
children | c2408abb258a |
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 |
3
bd99b6549eb4
*: expand in readme and rename src/main to src/edl
Paper <mrpapersonic@gmail.com>
parents:
2
diff
changeset
|
4 Currently, writing EDL files is not supported by this library. |
bd99b6549eb4
*: expand in readme and rename src/main to src/edl
Paper <mrpapersonic@gmail.com>
parents:
2
diff
changeset
|
5 |
bd99b6549eb4
*: expand in readme and rename src/main to src/edl
Paper <mrpapersonic@gmail.com>
parents:
2
diff
changeset
|
6 ## Build |
bd99b6549eb4
*: expand in readme and rename src/main to src/edl
Paper <mrpapersonic@gmail.com>
parents:
2
diff
changeset
|
7 ```console |
bd99b6549eb4
*: expand in readme and rename src/main to src/edl
Paper <mrpapersonic@gmail.com>
parents:
2
diff
changeset
|
8 $ autoreconf -i |
bd99b6549eb4
*: expand in readme and rename src/main to src/edl
Paper <mrpapersonic@gmail.com>
parents:
2
diff
changeset
|
9 $ mkdir build |
bd99b6549eb4
*: expand in readme and rename src/main to src/edl
Paper <mrpapersonic@gmail.com>
parents:
2
diff
changeset
|
10 $ cd build |
bd99b6549eb4
*: expand in readme and rename src/main to src/edl
Paper <mrpapersonic@gmail.com>
parents:
2
diff
changeset
|
11 $ ../configure |
bd99b6549eb4
*: expand in readme and rename src/main to src/edl
Paper <mrpapersonic@gmail.com>
parents:
2
diff
changeset
|
12 $ make |
bd99b6549eb4
*: expand in readme and rename src/main to src/edl
Paper <mrpapersonic@gmail.com>
parents:
2
diff
changeset
|
13 $ sudo make install |
bd99b6549eb4
*: expand in readme and rename src/main to src/edl
Paper <mrpapersonic@gmail.com>
parents:
2
diff
changeset
|
14 ``` |
bd99b6549eb4
*: expand in readme and rename src/main to src/edl
Paper <mrpapersonic@gmail.com>
parents:
2
diff
changeset
|
15 |
2
d00bc412900e
*: fix up lots of stuff and make the thing actually usable
Paper <mrpapersonic@gmail.com>
parents:
0
diff
changeset
|
16 ## Usage |
d00bc412900e
*: fix up lots of stuff and make the thing actually usable
Paper <mrpapersonic@gmail.com>
parents:
0
diff
changeset
|
17 ```c |
d00bc412900e
*: fix up lots of stuff and make the thing actually usable
Paper <mrpapersonic@gmail.com>
parents:
0
diff
changeset
|
18 #include <stdio.h> |
3
bd99b6549eb4
*: expand in readme and rename src/main to src/edl
Paper <mrpapersonic@gmail.com>
parents:
2
diff
changeset
|
19 #include <stdlib.h> |
2
d00bc412900e
*: fix up lots of stuff and make the thing actually usable
Paper <mrpapersonic@gmail.com>
parents:
0
diff
changeset
|
20 #include "edl.h" |
d00bc412900e
*: fix up lots of stuff and make the thing actually usable
Paper <mrpapersonic@gmail.com>
parents:
0
diff
changeset
|
21 |
d00bc412900e
*: fix up lots of stuff and make the thing actually usable
Paper <mrpapersonic@gmail.com>
parents:
0
diff
changeset
|
22 int main(){ |
d00bc412900e
*: fix up lots of stuff and make the thing actually usable
Paper <mrpapersonic@gmail.com>
parents:
0
diff
changeset
|
23 /* open the file */ |
3
bd99b6549eb4
*: expand in readme and rename src/main to src/edl
Paper <mrpapersonic@gmail.com>
parents:
2
diff
changeset
|
24 FILE* file = fopen("MyProject.txt", "rb"); |
2
d00bc412900e
*: fix up lots of stuff and make the thing actually usable
Paper <mrpapersonic@gmail.com>
parents:
0
diff
changeset
|
25 if (!file) |
d00bc412900e
*: fix up lots of stuff and make the thing actually usable
Paper <mrpapersonic@gmail.com>
parents:
0
diff
changeset
|
26 return 1; |
d00bc412900e
*: fix up lots of stuff and make the thing actually usable
Paper <mrpapersonic@gmail.com>
parents:
0
diff
changeset
|
27 |
d00bc412900e
*: fix up lots of stuff and make the thing actually usable
Paper <mrpapersonic@gmail.com>
parents:
0
diff
changeset
|
28 /* get filesize */ |
d00bc412900e
*: fix up lots of stuff and make the thing actually usable
Paper <mrpapersonic@gmail.com>
parents:
0
diff
changeset
|
29 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
|
30 long fsize = ftell(file); |
d00bc412900e
*: fix up lots of stuff and make the thing actually usable
Paper <mrpapersonic@gmail.com>
parents:
0
diff
changeset
|
31 fseek(file, 0L, SEEK_SET); |
0 | 32 |
2
d00bc412900e
*: fix up lots of stuff and make the thing actually usable
Paper <mrpapersonic@gmail.com>
parents:
0
diff
changeset
|
33 /* grab the contents */ |
d00bc412900e
*: fix up lots of stuff and make the thing actually usable
Paper <mrpapersonic@gmail.com>
parents:
0
diff
changeset
|
34 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
|
35 if (!data) |
d00bc412900e
*: fix up lots of stuff and make the thing actually usable
Paper <mrpapersonic@gmail.com>
parents:
0
diff
changeset
|
36 return 1; |
d00bc412900e
*: fix up lots of stuff and make the thing actually usable
Paper <mrpapersonic@gmail.com>
parents:
0
diff
changeset
|
37 |
d00bc412900e
*: fix up lots of stuff and make the thing actually usable
Paper <mrpapersonic@gmail.com>
parents:
0
diff
changeset
|
38 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
|
39 |
d00bc412900e
*: fix up lots of stuff and make the thing actually usable
Paper <mrpapersonic@gmail.com>
parents:
0
diff
changeset
|
40 fclose(file); |
d00bc412900e
*: fix up lots of stuff and make the thing actually usable
Paper <mrpapersonic@gmail.com>
parents:
0
diff
changeset
|
41 |
d00bc412900e
*: fix up lots of stuff and make the thing actually usable
Paper <mrpapersonic@gmail.com>
parents:
0
diff
changeset
|
42 /* pass it to libedl */ |
d00bc412900e
*: fix up lots of stuff and make the thing actually usable
Paper <mrpapersonic@gmail.com>
parents:
0
diff
changeset
|
43 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
|
44 |
d00bc412900e
*: fix up lots of stuff and make the thing actually usable
Paper <mrpapersonic@gmail.com>
parents:
0
diff
changeset
|
45 /* 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
|
46 for (int i = 0; i < edl.size; i++) { |
3
bd99b6549eb4
*: expand in readme and rename src/main to src/edl
Paper <mrpapersonic@gmail.com>
parents:
2
diff
changeset
|
47 printf("%s\n", edl.arr[i].filename); |
2
d00bc412900e
*: fix up lots of stuff and make the thing actually usable
Paper <mrpapersonic@gmail.com>
parents:
0
diff
changeset
|
48 } |
d00bc412900e
*: fix up lots of stuff and make the thing actually usable
Paper <mrpapersonic@gmail.com>
parents:
0
diff
changeset
|
49 |
d00bc412900e
*: fix up lots of stuff and make the thing actually usable
Paper <mrpapersonic@gmail.com>
parents:
0
diff
changeset
|
50 /* free our memory */ |
d00bc412900e
*: fix up lots of stuff and make the thing actually usable
Paper <mrpapersonic@gmail.com>
parents:
0
diff
changeset
|
51 EDL_free(edl); |
d00bc412900e
*: fix up lots of stuff and make the thing actually usable
Paper <mrpapersonic@gmail.com>
parents:
0
diff
changeset
|
52 free(data); |
d00bc412900e
*: fix up lots of stuff and make the thing actually usable
Paper <mrpapersonic@gmail.com>
parents:
0
diff
changeset
|
53 |
3
bd99b6549eb4
*: expand in readme and rename src/main to src/edl
Paper <mrpapersonic@gmail.com>
parents:
2
diff
changeset
|
54 return 0; |
2
d00bc412900e
*: fix up lots of stuff and make the thing actually usable
Paper <mrpapersonic@gmail.com>
parents:
0
diff
changeset
|
55 } |
d00bc412900e
*: fix up lots of stuff and make the thing actually usable
Paper <mrpapersonic@gmail.com>
parents:
0
diff
changeset
|
56 ``` |