VideoStream.h 893 B

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