aboutsummaryrefslogtreecommitdiffstats
path: root/src/ffmpeg.h
blob: 6fa4007e9d93e438d59213b1e5bcb74dd7502c48 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#include <assert.h>
#include <stdint.h>

#include <sys/types.h>
#include <sys/wait.h>
#include <unistd.h>

#include <raylib.h>

// stolen code:
// https://github.com/tsoding/musializer/blob/master/src/ffmpeg_posix.c

#ifndef FFMPEG_H
#define FFMPEG_H

#define READ_END 0
#define WRITE_END 1

typedef struct FFMPEG {
    int pipe;
    pid_t pid;
} FFMPEG;

FFMPEG* ffmpegStart(const char* filename, uint32_t width, uint32_t height,
                    uint32_t fps);
int ffmpegSendFrame(FFMPEG* ffmpeg, void* data, uint32_t width, uint32_t
                    height);
int ffmpegEnd(FFMPEG* ffmpeg, bool cancel);

#endif