view 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
line wrap: on
line source

# libedl
libedl is a library for parsing Vegas Pro EDL files and translating them into usable C structures.

## Build
```console
$ autoreconf -i
$ mkdir build
$ cd build
$ ../configure
$ make
$ sudo make install
```

## Usage
```c
#include <stdio.h>
#include <stdlib.h>
#include "edl.h"

int main() {
    /* open the file */
    FILE* file = fopen("intensive care unit.TXT", "rb");
    if (!file)
        return 1;

    /* get filesize */
    fseek(file, 0L, SEEK_END);
    long fsize = ftell(file);
    fseek(file, 0L, SEEK_SET);

    /* grab the contents */
    char* data = malloc(fsize + 1);
    if (!data)
        return 1;

    fread(data, fsize, 1, file);

    data[fsize] = '\0';

    fclose(file);

    /* pass it to libedl */
    EDL edl = EDL_parse(data, fsize + 1);

    /* dump the EDL to */
    char* edl_str = EDL_dump(edl);
    printf("%s\n", edl_str);
    free(edl_str);

    /* free our memory */
    EDL_free(edl);
    free(data);

    return 0;
}
```