mirror of
https://github.com/rzeldent/esp32cam-rtsp.git
synced 2025-11-14 12:08:02 +00:00
Work in progress
This commit is contained in:
@@ -2,17 +2,34 @@
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include <tuple>
|
||||
|
||||
class micro_rtsp_jpeg
|
||||
{
|
||||
public:
|
||||
micro_rtsp_jpeg(const uint8_t *jpeg, size_t size);
|
||||
bool decode_jpeg(const uint8_t *jpg, size_t size);
|
||||
|
||||
std::tuple<const uint8_t *, size_t> quantization_table_0_;
|
||||
std::tuple<const uint8_t *, size_t> quantization_table_1_;
|
||||
std::tuple<const uint8_t *, size_t> jpeg_data_;
|
||||
protected:
|
||||
bool decode_jpeg(uint8_t *jpg, size_t size);
|
||||
std::tuple<const uint8_t *, size_t> find_jpeg_section(uint8_t **ptr, uint8_t *end, uint8_t flag);
|
||||
class __attribute__ ((packed)) jpg_section
|
||||
{
|
||||
public:
|
||||
uint8_t flag() const { return section_flag; }
|
||||
const char *flag_name() const;
|
||||
uint16_t section_length() const { return section_flag == 0xd8 || section_flag == 0xd9 ? 0 : (section_length_msb << 8) + section_length_lsb; }
|
||||
const uint8_t *data() const { return reinterpret_cast<const uint8_t *>(§ion_data[1]); }
|
||||
uint16_t data_length() const { return section_length() - 3; }
|
||||
|
||||
private:
|
||||
const uint8_t section_flag;
|
||||
const uint8_t section_length_msb;
|
||||
const uint8_t section_length_lsb;
|
||||
const uint8_t section_data[];
|
||||
};
|
||||
|
||||
const jpg_section *quantization_table_0_;
|
||||
const jpg_section *quantization_table_1_;
|
||||
|
||||
const uint8_t *jpeg_data_start;
|
||||
const uint8_t *jpeg_data_end;
|
||||
|
||||
private:
|
||||
static const jpg_section *find_jpeg_section(const uint8_t **ptr, const uint8_t *end, uint8_t flag);
|
||||
};
|
||||
Reference in New Issue
Block a user