VideoStream.h 820 B

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