save timelapse stream to file
This commit is contained in:
10
src/mp4enc.h
10
src/mp4enc.h
@@ -1,7 +1,8 @@
|
||||
#pragma once
|
||||
#include "image.h"
|
||||
#include "serializer.h"
|
||||
|
||||
class MP4Encoder
|
||||
class MP4Encoder : public Serializer::Type
|
||||
{
|
||||
struct Frame
|
||||
{
|
||||
@@ -14,7 +15,7 @@ class MP4Encoder
|
||||
std::vector<uint8_t> SPS_data;
|
||||
std::vector<uint8_t> PPS_data;
|
||||
uint8_t avc_profile;
|
||||
uint8_t avc_profile_compat;
|
||||
uint8_t avc_compat;
|
||||
uint8_t avc_level;
|
||||
};
|
||||
class ISVCEncoder* m_encoder = nullptr;
|
||||
@@ -26,8 +27,13 @@ class MP4Encoder
|
||||
std::vector<Frame> m_frames;
|
||||
std::vector<uint8_t> m_yuv_buffer;
|
||||
public:
|
||||
~MP4Encoder();
|
||||
bool init() noexcept;
|
||||
bool init(int width, int height, int fps, int bitrate) noexcept;
|
||||
bool encode(const Image& rgba) noexcept;
|
||||
bool write_mp4(const std::string& filename) const noexcept;
|
||||
void destroy() noexcept;
|
||||
int frames_count() const noexcept { return m_frames.size(); }
|
||||
virtual bool read(BinaryStreamReader& r) override;
|
||||
virtual void write(BinaryStreamWriter& w) const override;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user