123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- #pragma once
- #include "defs.h"
- namespace ffmpeg {
- enum class ImageType {
- UNKNOWN = 0,
- JPEG = 1,
- PNG = 2,
- TIFF = 3,
- };
- class SeekableBuffer {
- public:
-
-
- int init(
- DecoderInCallback&& in,
- uint64_t timeoutMs,
- size_t maxSeekableBytes,
- ImageType* type);
- int read(uint8_t* buf, int size, uint64_t timeoutMs);
- int64_t seek(int64_t offset, int whence, uint64_t timeoutMs);
- void shutdown();
- private:
- bool readBytes(DecoderInCallback& in, size_t maxBytes, uint64_t timeoutMs);
- void setImageType(ImageType* type);
- private:
- DecoderInCallback inCallback_;
- std::vector<uint8_t> buffer_;
- long pos_{0};
- long end_{0};
- bool eof_{0};
- bool isSeekable_{false};
- };
- }
|