aboutsummaryrefslogtreecommitdiff
path: root/src/recorder.h
blob: 2ef0d4753acfd11a36012282428dd00c501ce78c (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
#ifndef __RECORDER_H
#define __RECORDER_H

#include <SDL.h>

extern "C" {
#include <libavformat/avformat.h>
#include <libavcodec/avcodec.h>
#include <libswscale/swscale.h>
}

#include "osc_graphics.h"

class Recorder : Mutex {
	AVFormatContext	*ffmpeg;
	AVStream 	*stream;
	SwsContext	*sws_context;
	AVFrame		*encodeFrame;
	int		encodeFrameBufferSize;
	uint8_t		*encodeFrameBuffer;
	AVPacket	pkt;

	Uint32 start_time;

public:
	Recorder();
	~Recorder();

	void register_methods();

	void start(const char *filename, const char *codecname = NULL);
	void stop();

	void record(SDL_Surface *surf);
};

#endif