int64_t pts = -1; // -1 means empty.
off_t offset;
unsigned filename_idx;
- uint32_t size; // Not using size_t saves a few bytes; we can have so many frames.
+ uint32_t size; // Not using size_t saves a few bytes; we can have so many frames. TODO: Not anymore due to audio_size.
+ uint32_t audio_size;
+ // Unfortunately, 32 bits wasted in padding here.
};
extern std::vector<FrameOnDisk> frames[MAX_STREAMS]; // Under frame_mu.
extern std::vector<std::string> frame_filenames; // Under frame_mu.
return a.pts == b.pts &&
a.offset == b.offset &&
a.filename_idx == b.filename_idx &&
- a.size == b.size;
+ a.size == b.size &&
+ a.audio_size == b.audio_size;
}
// A helper class to read frames from disk. It caches the file descriptor
public:
FrameReader();
~FrameReader();
- std::string read_frame(FrameOnDisk frame);
+
+ struct Frame {
+ std::string video;
+ std::string audio;
+ };
+ Frame read_frame(FrameOnDisk frame, bool read_audio);
private:
int fd = -1;