Mercurial > libedl
comparison 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 |
comparison
equal
deleted
inserted
replaced
| 1:db8b7e45ee55 | 2:d00bc412900e |
|---|---|
| 1 # edl-parser | 1 # libedl |
| 2 edl-parser is a parser library for Vegas Pro EDL files and translates them into a usable format for manipulation in C/C++. | 2 libedl is a library for parsing Vegas Pro EDL files and translating them into usable C structures. |
| 3 | 3 |
| 4 # How do I use this? | 4 ## Usage |
| 5 Drag it into your C/C++ project and adjust your compiler flags accordingly. Then you can call `parse_EDL` with a `char*` containing the entire contents of any EDL file. | 5 ```c |
| 6 #include <stdio.h> | |
| 7 #include "edl.h" | |
| 8 | |
| 9 int main(){ | |
| 10 /* open the file */ | |
| 11 FILE* file = fopen("MyProject.txt", "rb"); | |
| 12 if (!file) | |
| 13 return 1; | |
| 14 | |
| 15 /* get filesize */ | |
| 16 fseek(file, 0L, SEEK_END); | |
| 17 long fsize = ftell(file); | |
| 18 fseek(file, 0L, SEEK_SET); | |
| 19 | |
| 20 /* grab the contents */ | |
| 21 char* data = malloc(fsize + 1); | |
| 22 if (!data) | |
| 23 return 1; | |
| 24 | |
| 25 fread(data, fsize, 1, file); | |
| 26 | |
| 27 fclose(file); | |
| 28 | |
| 29 /* pass it to libedl */ | |
| 30 EDL_file edl = EDL_parse(data, fsize + 1); | |
| 31 | |
| 32 /* do what we have to do with it */ | |
| 33 for (int i = 0; i < edl.size; i++) { | |
| 34 printf("%s", edl.arr[i].filename); | |
| 35 } | |
| 36 | |
| 37 /* free our memory */ | |
| 38 EDL_free(edl); | |
| 39 free(data); | |
| 40 | |
| 41 return 0; | |
| 42 } | |
| 43 ``` |
