Robotran C Documentation
MpegFrameCapture.hh
Go to the documentation of this file.
1 #ifdef FRAME_CAPTURE_MPEG
2 
3 #ifndef _MPEG_FRAME_CAPTURE_HH_
4 #define _MPEG_FRAME_CAPTURE_HH_
5 
6 #include "FrameCapture.hh"
8 #include <string>
9 
10 extern "C" {
11 #include <libavcodec/avcodec.h>
12 #include <libavutil/imgutils.h>
13 #include <libavutil/opt.h>
14 #include <libavutil/mem.h>
15 #include <libswscale/swscale.h>
16 }
17 
18 namespace OpenGLMbs{
19 
22 class MpegFrameCapture: public MbsFrameCapture
23 {
24 
25  public:
26  MpegFrameCapture(MbsViewPointRenderer* vp_renderer, std::string filename = "test", int fps=25, OpenGLMbs::MpegFrameCaptureOptions const &opt=OpenGLMbs::MpegFrameCaptureOptions());
27  ~MpegFrameCapture();
28 
29  void ProcessScreenShot();
30  void ffmpeg_encoder_start(int codec_id, int fps);
31  void ffmpeg_encoder_glread_rgb();
32  void ffmpeg_encoder_set_frame_yuv_from_rgb();
33  void ffmpeg_encoder_encode_frame();
34  void ffmpeg_encoder_finish();
35 
36  private:
37  std::string filename;
38 
39  AVCodecContext *c;
40  AVFrame *frame;
41  AVPacket pkt;
42  FILE *file;
43  struct SwsContext *sws_context;
44  uint8_t *rgb;
45  const size_t format_nchannels;
46  int nvals;
47 
48  // parameters coming from options
49  int bit_rate;
50 
51 };
52 
53 } //namespace OpenGLMbs
54 
55 #endif //_MPEG_FRAME_CAPTURE_HH_
56 
57 #endif
OpenGLMbs
Definition: MpegFrameCaptureOptions.hh:6
OpenGLMbs::MpegFrameCaptureOptions::bit_rate
int bit_rate
Definition: MpegFrameCaptureOptions.hh:22
MpegFrameCapture.hh
MpegFrameCaptureOptions.hh
OpenGLMbs::MpegFrameCaptureOptions
MpegFrameCaptureOptions: save screenshots as video in the mpeg format.
Definition: MpegFrameCaptureOptions.hh:10
FrameCapture.hh
FrameCapture class.