VideoStream.h 870 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. #pragma once
  2. #ifdef FFMPEG_ENABLED
  3. #ifndef VIDEO_STREAM_H_
  4. #define VIDEO_STREAM_H_
  5. #include <string>
  6. #include "Bitmap.h"
  7. extern "C" {
  8. # include <libavformat/avformat.h>
  9. # include <libavformat/avio.h>
  10. # include <libavcodec/avcodec.h>
  11. # include <libavformat/avformat.h>
  12. # include <libavutil/imgutils.h>
  13. # include <libavutil/opt.h>
  14. # include <libswscale/swscale.h>
  15. }
  16. class VideoStream
  17. {
  18. const AVCodec* codec;
  19. AVCodecContext* codecContext;
  20. FILE* file;
  21. AVFrame* picture;
  22. AVPacket* pkt;
  23. SwsContext* swsContext;
  24. static const uint8_t endcode[];
  25. size_t width;
  26. size_t height;
  27. uint64_t frameIndex = 0;
  28. public:
  29. VideoStream(::size_t width, ::size_t height, const std::string& filename);
  30. ~VideoStream(void);
  31. void addFrame(const Bitmap<RGBColor>& frame);
  32. };
  33. #endif // VIDEO_STREAM_H_
  34. #endif // FFMPEG_ENABLED