Mercurial > libedl
annotate README.md @ 4:c2408abb258a
*: add dumping to string, rename EDL_file to EDL
author | Paper <mrpapersonic@gmail.com> |
---|---|
date | Mon, 25 Dec 2023 16:24:16 -0500 |
parents | bd99b6549eb4 |
children | a6ab6d9c0dac |
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 ## Build |
bd99b6549eb4
*: expand in readme and rename src/main to src/edl
Paper <mrpapersonic@gmail.com>
parents:
2
diff
changeset
|
5 ```console |
bd99b6549eb4
*: expand in readme and rename src/main to src/edl
Paper <mrpapersonic@gmail.com>
parents:
2
diff
changeset
|
6 $ autoreconf -i |
bd99b6549eb4
*: expand in readme and rename src/main to src/edl
Paper <mrpapersonic@gmail.com>
parents:
2
diff
changeset
|
7 $ mkdir build |
bd99b6549eb4
*: expand in readme and rename src/main to src/edl
Paper <mrpapersonic@gmail.com>
parents:
2
diff
changeset
|
8 $ cd build |
bd99b6549eb4
*: expand in readme and rename src/main to src/edl
Paper <mrpapersonic@gmail.com>
parents:
2
diff
changeset
|
9 $ ../configure |
bd99b6549eb4
*: expand in readme and rename src/main to src/edl
Paper <mrpapersonic@gmail.com>
parents:
2
diff
changeset
|
10 $ make |
bd99b6549eb4
*: expand in readme and rename src/main to src/edl
Paper <mrpapersonic@gmail.com>
parents:
2
diff
changeset
|
11 $ sudo make install |
bd99b6549eb4
*: expand in readme and rename src/main to src/edl
Paper <mrpapersonic@gmail.com>
parents:
2
diff
changeset
|
12 ``` |
bd99b6549eb4
*: expand in readme and rename src/main to src/edl
Paper <mrpapersonic@gmail.com>
parents:
2
diff
changeset
|
13 |
2
d00bc412900e
*: fix up lots of stuff and make the thing actually usable
Paper <mrpapersonic@gmail.com>
parents:
0
diff
changeset
|
14 ## Usage |
d00bc412900e
*: fix up lots of stuff and make the thing actually usable
Paper <mrpapersonic@gmail.com>
parents:
0
diff
changeset
|
15 ```c |
d00bc412900e
*: fix up lots of stuff and make the thing actually usable
Paper <mrpapersonic@gmail.com>
parents:
0
diff
changeset
|
16 #include <stdio.h> |
3
bd99b6549eb4
*: expand in readme and rename src/main to src/edl
Paper <mrpapersonic@gmail.com>
parents:
2
diff
changeset
|
17 #include <stdlib.h> |
2
d00bc412900e
*: fix up lots of stuff and make the thing actually usable
Paper <mrpapersonic@gmail.com>
parents:
0
diff
changeset
|
18 #include "edl.h" |
d00bc412900e
*: fix up lots of stuff and make the thing actually usable
Paper <mrpapersonic@gmail.com>
parents:
0
diff
changeset
|
19 |
4
c2408abb258a
*: add dumping to string, rename EDL_file to EDL
Paper <mrpapersonic@gmail.com>
parents:
3
diff
changeset
|
20 int main() { |
2
d00bc412900e
*: fix up lots of stuff and make the thing actually usable
Paper <mrpapersonic@gmail.com>
parents:
0
diff
changeset
|
21 /* open the file */ |
4
c2408abb258a
*: add dumping to string, rename EDL_file to EDL
Paper <mrpapersonic@gmail.com>
parents:
3
diff
changeset
|
22 FILE* file = fopen("intensive care unit.TXT", "rb"); |
2
d00bc412900e
*: fix up lots of stuff and make the thing actually usable
Paper <mrpapersonic@gmail.com>
parents:
0
diff
changeset
|
23 if (!file) |
d00bc412900e
*: fix up lots of stuff and make the thing actually usable
Paper <mrpapersonic@gmail.com>
parents:
0
diff
changeset
|
24 return 1; |
d00bc412900e
*: fix up lots of stuff and make the thing actually usable
Paper <mrpapersonic@gmail.com>
parents:
0
diff
changeset
|
25 |
d00bc412900e
*: fix up lots of stuff and make the thing actually usable
Paper <mrpapersonic@gmail.com>
parents:
0
diff
changeset
|
26 /* get filesize */ |
d00bc412900e
*: fix up lots of stuff and make the thing actually usable
Paper <mrpapersonic@gmail.com>
parents:
0
diff
changeset
|
27 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
|
28 long fsize = ftell(file); |
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_SET); |
0 | 30 |
2
d00bc412900e
*: fix up lots of stuff and make the thing actually usable
Paper <mrpapersonic@gmail.com>
parents:
0
diff
changeset
|
31 /* grab the contents */ |
d00bc412900e
*: fix up lots of stuff and make the thing actually usable
Paper <mrpapersonic@gmail.com>
parents:
0
diff
changeset
|
32 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
|
33 if (!data) |
d00bc412900e
*: fix up lots of stuff and make the thing actually usable
Paper <mrpapersonic@gmail.com>
parents:
0
diff
changeset
|
34 return 1; |
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 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
|
37 |
4
c2408abb258a
*: add dumping to string, rename EDL_file to EDL
Paper <mrpapersonic@gmail.com>
parents:
3
diff
changeset
|
38 data[fsize] = '\0'; |
c2408abb258a
*: add dumping to string, rename EDL_file to EDL
Paper <mrpapersonic@gmail.com>
parents:
3
diff
changeset
|
39 |
2
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 */ |
4
c2408abb258a
*: add dumping to string, rename EDL_file to EDL
Paper <mrpapersonic@gmail.com>
parents:
3
diff
changeset
|
43 EDL edl = EDL_parse(data, fsize + 1); |
2
d00bc412900e
*: fix up lots of stuff and make the thing actually usable
Paper <mrpapersonic@gmail.com>
parents:
0
diff
changeset
|
44 |
4
c2408abb258a
*: add dumping to string, rename EDL_file to EDL
Paper <mrpapersonic@gmail.com>
parents:
3
diff
changeset
|
45 /* dump the EDL to */ |
c2408abb258a
*: add dumping to string, rename EDL_file to EDL
Paper <mrpapersonic@gmail.com>
parents:
3
diff
changeset
|
46 char* edl_str = EDL_dump(edl); |
c2408abb258a
*: add dumping to string, rename EDL_file to EDL
Paper <mrpapersonic@gmail.com>
parents:
3
diff
changeset
|
47 printf("%s\n", edl_str); |
c2408abb258a
*: add dumping to string, rename EDL_file to EDL
Paper <mrpapersonic@gmail.com>
parents:
3
diff
changeset
|
48 free(edl_str); |
2
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 ``` |