aboutsummaryrefslogtreecommitdiff
path: root/src/recorder.h
diff options
context:
space:
mode:
authorRobin Haberkorn <robin.haberkorn@googlemail.com>2012-10-04 22:42:06 +0200
committerRobin Haberkorn <robin.haberkorn@googlemail.com>2012-10-04 22:42:06 +0200
commit4bb5ce0be62671f7c5127d969c682d57e971679b (patch)
tree1ce0510c5a8cca37a4106f43f4c5de1162f01a35 /src/recorder.h
parentd5dcc19a006f898f21a5b081180a132c9dc6e638 (diff)
downloadosc-graphics-4bb5ce0be62671f7c5127d969c682d57e971679b.tar.gz
rewritten recorder using ffmpeg libs (without SDL_ffmpeg)
* SDL_ffmpeg was broken and is hard to get * my implementation allows specifying an output codec. if the codec supports the screen's pixel format, no conversion is performed saving lots of performance (also beneficial for post-processing a recorded video)
Diffstat (limited to 'src/recorder.h')
-rw-r--r--src/recorder.h20
1 files changed, 16 insertions, 4 deletions
diff --git a/src/recorder.h b/src/recorder.h
index 62458ad..2ef0d47 100644
--- a/src/recorder.h
+++ b/src/recorder.h
@@ -2,21 +2,33 @@
#define __RECORDER_H
#include <SDL.h>
-#include <SDL/SDL_ffmpeg.h>
+
+extern "C" {
+#include <libavformat/avformat.h>
+#include <libavcodec/avcodec.h>
+#include <libswscale/swscale.h>
+}
#include "osc_graphics.h"
class Recorder : Mutex {
- SDL_ffmpegFile *file;
+ AVFormatContext *ffmpeg;
+ AVStream *stream;
+ SwsContext *sws_context;
+ AVFrame *encodeFrame;
+ int encodeFrameBufferSize;
+ uint8_t *encodeFrameBuffer;
+ AVPacket pkt;
+
Uint32 start_time;
public:
- Recorder() : Mutex(), file(NULL) {}
+ Recorder();
~Recorder();
void register_methods();
- void start(const char *filename);
+ void start(const char *filename, const char *codecname = NULL);
void stop();
void record(SDL_Surface *surf);