11#define LIST_HEADER_SIZE 12
12#define CHUNK_HEADER_SIZE 8
63 return ptr ==
nullptr ? -1l : ptr -
vector.
data();
176 void set(
size_t currentPos,
const char *
id,
size_t size,
283 const char *
mime()
override {
return "video/avi"; }
336 virtual size_t write(
const uint8_t *data,
size_t len)
override {
337 LOGD(
"write: %d", (
int)len);
672 uint16_t biBitCount) {
674 if (biCompression == 3)
677 auto is = [biCompression](
const char *fourcc) {
678 return memcmp(&biCompression, fourcc, 4) == 0;
680 if (is(
"H264") || is(
"h264") || is(
"X264") || is(
"x264") ||
681 is(
"avc1") || is(
"AVC1"))
683 if (is(
"MJPG") || is(
"mjpg"))
685 if (is(
"FMP4") || is(
"XVID") || is(
"DIVX") || is(
"DX50") ||
688 if (is(
"YUY2") || is(
"YUYV") || is(
"yuy2") || is(
"yuyv"))
690 if (is(
"I420") || is(
"IYUV"))
705 if (payload_left < 0) payload_left = 0;
706 long payload_to_write = min(to_write, payload_left);
709 LOGD(
"audio %d", (
int)to_write);
717 LOGD(
"video %d", (
int)to_write);
718 if (payload_to_write > 0) {
734 if (
getStr(0, 4).equals(
"RIFF")) {
736 uint32_t header_file_size =
getInt(4);
741 header_file_size >= 0xFFFFFFF0 ? 0 : header_file_size + 8;
765 if (
getStr(0, 4).equals(
id)) {
774 if (list_id.
equals(
id) &&
getStr(0, 3).equals(
"LIST")) {
783 if (
getStr(0, 4).equals(
"LIST")) {
792 int chunk_size =
getInt(4);
804 if (
getStr(0, 4).equals(
"LIST") &&
getStr(8, 4).equals(
id)) {
911 const char *
mime()
override {
return "video/avi"; }
938 if (
p_out ==
nullptr) {
939 LOGE(
"output not defined");
987 size_t written =
p_out->
write(data, to_write);
1007 size_t write(
const uint8_t *data,
size_t len)
override {
1034 bool isKeyFrame =
true)
override {
1184 LOGW(
"getVideoInfo().format does not match the addXxxFrame() called");
1193 if (expected_size > 0 && len != expected_size) {
1194 LOGW(
"frame size %d does not match the expected %d bytes for %d x %d",
1202 uint8_t b[2] = {(uint8_t)(v & 0xFF), (uint8_t)((v >> 8) & 0xFF)};
1207 uint8_t b[4] = {(uint8_t)(v & 0xFF), (uint8_t)((v >> 8) & 0xFF),
1208 (uint8_t)((v >> 16) & 0xFF), (uint8_t)((v >> 24) & 0xFF)};
1213 for (
int j = 0; j < n; j++)
writeU8(0);
1232 uint32_t micros_per_frame =
1298 uint16_t block_align =
#define LOGW(...)
Definition AudioLoggerIDF.h:29
#define LOGI(...)
Definition AudioLoggerIDF.h:28
#define LOGD(...)
Definition AudioLoggerIDF.h:27
#define LOGE(...)
Definition AudioLoggerIDF.h:30
#define LIST_HEADER_SIZE
Definition ContainerAVI.h:11
#define CHUNK_HEADER_SIZE
Definition ContainerAVI.h:12
virtual size_t write(const uint8_t *data, size_t len)
Definition Arduino.h:120
virtual void flush()
Definition Arduino.h:130
char[4] FOURCC
Four-character code identifier for AVI format.
Definition ContainerAVI.h:73
VideoFormat
Video codec/pixel-format identifier, shared by two unrelated uses: the (single) video stream of a con...
Definition Video.h:43
StreamContentType
Which track write() feeds, for muxers (MuxerAVI, MuxerMP4) that double as a plain,...
Definition Video.h:19
size_t videoFrameSizeBytes(VideoFormat format, uint16_t width, uint16_t height)
Fixed per-frame size (bytes) for a raw/uncompressed VideoFormat at the given resolution - 0 for compr...
Definition Video.h:61
AudioFormat
Audio format codes used by Microsoft e.g. in avi or wav files.
Definition AudioFormat.h:21
bool isWavFormat(AudioFormat format)
True if the wav code is handled via the WAV decoder (i.e. toMime() maps it to "audio/wav": PCM and al...
Definition AudioFormat.h:348
@ Audio
Definition Video.h:19
@ Video
Definition Video.h:19
Definition ContainerAVI.h:75
uint32_t dwStreams
Definition ContainerAVI.h:84
uint32_t dwInitialFrames
Definition ContainerAVI.h:83
uint32_t dwMaxBytesPerSec
Definition ContainerAVI.h:79
uint32_t dwHeight
Definition ContainerAVI.h:87
uint32_t dwReserved[4]
Definition ContainerAVI.h:88
uint32_t dwFlags
Definition ContainerAVI.h:81
uint32_t dwPaddingGranularity
Definition ContainerAVI.h:80
uint32_t dwMicroSecPerFrame
Definition ContainerAVI.h:78
uint32_t dwSuggestedBufferSize
Definition ContainerAVI.h:85
uint32_t dwWidth
Definition ContainerAVI.h:86
uint32_t dwTotalFrames
Definition ContainerAVI.h:82