Mercurial > libedl
comparison 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 |
comparison
equal
deleted
inserted
replaced
3:bd99b6549eb4 | 4:c2408abb258a |
---|---|
1 # libedl | 1 # libedl |
2 libedl is a library for parsing Vegas Pro EDL files and translating them into usable C structures. | 2 libedl is a library for parsing Vegas Pro EDL files and translating them into usable C structures. |
3 | |
4 Currently, writing EDL files is not supported by this library. | |
5 | 3 |
6 ## Build | 4 ## Build |
7 ```console | 5 ```console |
8 $ autoreconf -i | 6 $ autoreconf -i |
9 $ mkdir build | 7 $ mkdir build |
17 ```c | 15 ```c |
18 #include <stdio.h> | 16 #include <stdio.h> |
19 #include <stdlib.h> | 17 #include <stdlib.h> |
20 #include "edl.h" | 18 #include "edl.h" |
21 | 19 |
22 int main(){ | 20 int main() { |
23 /* open the file */ | 21 /* open the file */ |
24 FILE* file = fopen("MyProject.txt", "rb"); | 22 FILE* file = fopen("intensive care unit.TXT", "rb"); |
25 if (!file) | 23 if (!file) |
26 return 1; | 24 return 1; |
27 | 25 |
28 /* get filesize */ | 26 /* get filesize */ |
29 fseek(file, 0L, SEEK_END); | 27 fseek(file, 0L, SEEK_END); |
35 if (!data) | 33 if (!data) |
36 return 1; | 34 return 1; |
37 | 35 |
38 fread(data, fsize, 1, file); | 36 fread(data, fsize, 1, file); |
39 | 37 |
38 data[fsize] = '\0'; | |
39 | |
40 fclose(file); | 40 fclose(file); |
41 | 41 |
42 /* pass it to libedl */ | 42 /* pass it to libedl */ |
43 EDL_file edl = EDL_parse(data, fsize + 1); | 43 EDL edl = EDL_parse(data, fsize + 1); |
44 | 44 |
45 /* do what we have to do with it */ | 45 /* dump the EDL to */ |
46 for (int i = 0; i < edl.size; i++) { | 46 char* edl_str = EDL_dump(edl); |
47 printf("%s\n", edl.arr[i].filename); | 47 printf("%s\n", edl_str); |
48 } | 48 free(edl_str); |
49 | 49 |
50 /* free our memory */ | 50 /* free our memory */ |
51 EDL_free(edl); | 51 EDL_free(edl); |
52 free(data); | 52 free(data); |
53 | 53 |