worked on avi, working now? :P
This commit is contained in:
@@ -1,21 +1,72 @@
|
||||
#pragma once
|
||||
|
||||
typedef uint8_t FOURCC[4];
|
||||
//typedef uint8_t FOURCC[4];
|
||||
|
||||
union FOURCC {
|
||||
|
||||
uint32_t u32;
|
||||
uint8_t bytes[4];
|
||||
char chars[4];
|
||||
|
||||
FOURCC() {}
|
||||
FOURCC(const char* str) : chars{str[0], str[1], str[2], str[3]} {}
|
||||
|
||||
bool operator == (const FOURCC other) const {return u32 == other.u32;}
|
||||
bool operator != (const FOURCC other) const {return u32 != other.u32;}
|
||||
|
||||
};
|
||||
|
||||
|
||||
//struct AVICommonHeader {
|
||||
// FOURCC fourcc;
|
||||
// uint32_t length;
|
||||
//};
|
||||
|
||||
struct AVITypeHeader {
|
||||
FOURCC fourcc;
|
||||
uint32_t length;
|
||||
//struct AVITypeHeader {
|
||||
// FOURCC fourcc;
|
||||
// uint32_t length;
|
||||
// FOURCC type;
|
||||
//};
|
||||
|
||||
|
||||
|
||||
struct AVIChunk {
|
||||
|
||||
FOURCC type;
|
||||
uint32_t size;
|
||||
// uint8_t data[size] follows hereafter
|
||||
|
||||
bool isJUNK() const {return type == FOURCC("JUNK");}
|
||||
|
||||
/** is an audio data chunk? */
|
||||
bool isAudioData() const {return type.chars[2] == 'w' && type.chars[3] == 'b';}
|
||||
|
||||
/** is a video data chunk? */
|
||||
bool isVideoData() const {return type.chars[2] == 'd' && type.chars[3] == 'c';}
|
||||
|
||||
};
|
||||
|
||||
struct AVIMainHeader {
|
||||
FOURCC fourcc;
|
||||
uint32_t cb;
|
||||
struct AVIList : AVIChunk {
|
||||
|
||||
// AVIList is an AVIChunk with type "RIFF" or "LIST"
|
||||
|
||||
FOURCC content;
|
||||
// uint8_t data[size-4] follows hereafter, contains lists and chunks
|
||||
|
||||
uint32_t getPayloadSize() const {return size-4;}
|
||||
|
||||
};
|
||||
|
||||
struct RIFFHeader : AVIList {
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
struct AVIMainHeader : AVIChunk {
|
||||
|
||||
// <data from AVIChunk>
|
||||
|
||||
uint32_t ms_per_frame;
|
||||
uint32_t max_bytes_per_sec;
|
||||
uint32_t padding_granularity;
|
||||
@@ -27,6 +78,7 @@ struct AVIMainHeader {
|
||||
uint32_t width;
|
||||
uint32_t height;
|
||||
uint32_t reserved[4];
|
||||
|
||||
};
|
||||
|
||||
struct AVIRect {
|
||||
@@ -36,11 +88,12 @@ struct AVIRect {
|
||||
uint16_t bottom;
|
||||
};
|
||||
|
||||
struct AVIStreamHeader {
|
||||
FOURCC fourcc;
|
||||
uint32_t cb;
|
||||
FOURCC type;
|
||||
FOURCC fcc_handler;
|
||||
struct AVIStreamHeader : AVIChunk {
|
||||
|
||||
// <data from AVIChunk>
|
||||
|
||||
FOURCC fccType; // "vids" or "auds" or "txts"
|
||||
FOURCC fccHandler; // video format, e.g. "MJPG"
|
||||
uint32_t flags;
|
||||
uint16_t priority;
|
||||
uint16_t language;
|
||||
@@ -53,6 +106,10 @@ struct AVIStreamHeader {
|
||||
uint32_t quality;
|
||||
uint32_t sample_size;
|
||||
AVIRect rcFrame;
|
||||
|
||||
bool isVideo() const {return fccType == FOURCC("vids");}
|
||||
bool isAudio() const {return fccType == FOURCC("auds");}
|
||||
|
||||
};
|
||||
|
||||
struct BitMapInfoHeader {
|
||||
@@ -76,12 +133,14 @@ struct RGBQUAD {
|
||||
uint8_t rgbReserved;
|
||||
};
|
||||
|
||||
struct BitMapInfo {
|
||||
struct BitMapInfo : AVIChunk {
|
||||
// <data from AVIChunk>
|
||||
BitMapInfoHeader bmi_header;
|
||||
RGBQUAD bmi_colors[1];
|
||||
};
|
||||
|
||||
struct WaveFormat {
|
||||
struct WaveFormat : AVIChunk {
|
||||
// <data from AVIChunk>
|
||||
uint16_t format_tag;
|
||||
uint16_t channels;
|
||||
uint32_t samples_per_sec;
|
||||
|
||||
Reference in New Issue
Block a user