aboutsummaryrefslogtreecommitdiff
path: root/src/recorder.h
blob: b2ee5e64d395e1f5e7267a5a8016f1c8df8265b3 (plain)
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
32
33
34
35
36
37
38
#ifndef __RECORDER_H
#define __RECORDER_H

#include <SDL.h>
#include <SDL_thread.h>
#include <SDL/SDL_ffmpeg.h>

#include "osc_graphics.h"

class Recorder {
	SDL_ffmpegFile *file;

	SDL_mutex *mutex;

	inline void
	lock()
	{
		SDL_LockMutex(mutex);
	}
	inline void
	unlock()
	{
		SDL_UnlockMutex(mutex);
	}

public:
	Recorder() : file(NULL), mutex(SDL_CreateMutex()) {}
	~Recorder();

	void register_methods();

	void start(const char *filename);
	void stop();

	void record(SDL_Surface *surf);
};

#endif