summaryrefslogtreecommitdiffstats
path: root/libmpdemux/aviheader.h
diff options
context:
space:
mode:
authoralex <alex@b3059339-0415-0410-9bf9-f77b7e298cf2>2004-04-28 10:18:33 +0000
committeralex <alex@b3059339-0415-0410-9bf9-f77b7e298cf2>2004-04-28 10:18:33 +0000
commitd8c3060141044f7837713b40d69ac0444624a393 (patch)
tree61c797b3d38285ff3e765b3b1e1b7f6217723178 /libmpdemux/aviheader.h
parentb125f8f3fa7a1ea33ae05178a43196c9f5c9ce53 (diff)
downloadmpv-d8c3060141044f7837713b40d69ac0444624a393.tar.bz2
mpv-d8c3060141044f7837713b40d69ac0444624a393.tar.xz
removed loader/ dependancy, imported some files from g2, also used patches from Dominik Mierzejewski
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@12342 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libmpdemux/aviheader.h')
-rw-r--r--libmpdemux/aviheader.h130
1 files changed, 130 insertions, 0 deletions
diff --git a/libmpdemux/aviheader.h b/libmpdemux/aviheader.h
index e5c6fc1c96..552774b72a 100644
--- a/libmpdemux/aviheader.h
+++ b/libmpdemux/aviheader.h
@@ -4,6 +4,136 @@
//#include "config.h" /* get correct definition WORDS_BIGENDIAN */
#include "bswap.h"
+#ifndef MIN
+#define MIN(a,b) (((a)<(b))?(a):(b))
+#endif
+
+#ifndef min
+#define min(a,b) (((a)<(b))?(a):(b))
+#endif
+
+#ifndef max
+#define max(a,b) (((a)>(b))?(a):(b))
+#endif
+
+#ifndef mmioFOURCC
+#define mmioFOURCC( ch0, ch1, ch2, ch3 ) \
+ ( (uint32_t)(uint8_t)(ch0) | ( (uint32_t)(uint8_t)(ch1) << 8 ) | \
+ ( (uint32_t)(uint8_t)(ch2) << 16 ) | ( (uint32_t)(uint8_t)(ch3) << 24 ) )
+#endif
+
+/* Macro to make a TWOCC out of two characters */
+#ifndef aviTWOCC
+#define aviTWOCC(ch0, ch1) ((uint16_t)(uint8_t)(ch0) | ((uint16_t)(uint8_t)(ch1) << 8))
+#endif
+
+typedef uint16_t TWOCC;
+typedef uint32_t FOURCC;
+
+/* form types, list types, and chunk types */
+#define formtypeAVI mmioFOURCC('A', 'V', 'I', ' ')
+#define listtypeAVIHEADER mmioFOURCC('h', 'd', 'r', 'l')
+#define ckidAVIMAINHDR mmioFOURCC('a', 'v', 'i', 'h')
+#define listtypeSTREAMHEADER mmioFOURCC('s', 't', 'r', 'l')
+#define ckidSTREAMHEADER mmioFOURCC('s', 't', 'r', 'h')
+#define ckidSTREAMFORMAT mmioFOURCC('s', 't', 'r', 'f')
+#define ckidSTREAMHANDLERDATA mmioFOURCC('s', 't', 'r', 'd')
+#define ckidSTREAMNAME mmioFOURCC('s', 't', 'r', 'n')
+
+#define listtypeAVIMOVIE mmioFOURCC('m', 'o', 'v', 'i')
+#define listtypeAVIRECORD mmioFOURCC('r', 'e', 'c', ' ')
+
+#define ckidAVINEWINDEX mmioFOURCC('i', 'd', 'x', '1')
+
+/*
+** Stream types for the <fccType> field of the stream header.
+*/
+#define streamtypeVIDEO mmioFOURCC('v', 'i', 'd', 's')
+#define streamtypeAUDIO mmioFOURCC('a', 'u', 'd', 's')
+#define streamtypeMIDI mmioFOURCC('m', 'i', 'd', 's')
+#define streamtypeTEXT mmioFOURCC('t', 'x', 't', 's')
+
+/* Basic chunk types */
+#define cktypeDIBbits aviTWOCC('d', 'b')
+#define cktypeDIBcompressed aviTWOCC('d', 'c')
+#define cktypePALchange aviTWOCC('p', 'c')
+#define cktypeWAVEbytes aviTWOCC('w', 'b')
+
+/* Chunk id to use for extra chunks for padding. */
+#define ckidAVIPADDING mmioFOURCC('J', 'U', 'N', 'K')
+
+/* flags for use in <dwFlags> in AVIFileHdr */
+#define AVIF_HASINDEX 0x00000010 // Index at end of file?
+#define AVIF_MUSTUSEINDEX 0x00000020
+#define AVIF_ISINTERLEAVED 0x00000100
+#define AVIF_TRUSTCKTYPE 0x00000800 // Use CKType to find key frames?
+#define AVIF_WASCAPTUREFILE 0x00010000
+#define AVIF_COPYRIGHTED 0x00020000
+
+typedef struct
+{
+ uint32_t dwMicroSecPerFrame; // frame display rate (or 0L)
+ uint32_t dwMaxBytesPerSec; // max. transfer rate
+ uint32_t dwPaddingGranularity; // pad to multiples of this
+ // size; normally 2K.
+ uint32_t dwFlags; // the ever-present flags
+ uint32_t dwTotalFrames; // # frames in file
+ uint32_t dwInitialFrames;
+ uint32_t dwStreams;
+ uint32_t dwSuggestedBufferSize;
+
+ uint32_t dwWidth;
+ uint32_t dwHeight;
+
+ uint32_t dwReserved[4];
+} MainAVIHeader;
+
+/* The RECT structure */
+typedef struct tagRECT
+{
+ short left;
+ short top;
+ short right;
+ short bottom;
+} RECT, *PRECT, *LPRECT;
+typedef const RECT *LPCRECT;
+
+typedef struct {
+ FOURCC fccType;
+ FOURCC fccHandler;
+ uint32_t dwFlags; /* Contains AVITF_* flags */
+ uint16_t wPriority;
+ uint16_t wLanguage;
+ uint32_t dwInitialFrames;
+ uint32_t dwScale;
+ uint32_t dwRate; /* dwRate / dwScale == samples/second */
+ uint32_t dwStart;
+ uint32_t dwLength; /* In units above... */
+ uint32_t dwSuggestedBufferSize;
+ uint32_t dwQuality;
+ uint32_t dwSampleSize;
+ RECT rcFrame;
+} AVIStreamHeader;
+
+/* Flags for index */
+#define AVIIF_LIST 0x00000001L // chunk is a 'LIST'
+#define AVIIF_KEYFRAME 0x00000010L // this frame is a key frame.
+
+#define AVIIF_NOTIME 0x00000100L // this frame doesn't take any time
+#define AVIIF_COMPUSE 0x0FFF0000L // these bits are for compressor use
+
+#define FOURCC_RIFF mmioFOURCC('R', 'I', 'F', 'F')
+#define FOURCC_LIST mmioFOURCC('L', 'I', 'S', 'T')
+
+typedef struct
+{
+ uint32_t ckid;
+ uint32_t dwFlags;
+ uint32_t dwChunkOffset; // Position of chunk
+ uint32_t dwChunkLength; // Length of chunk
+} AVIINDEXENTRY;
+
+
typedef struct _avisuperindex_entry {
uint64_t qwOffset; // absolute file offset
uint32_t dwSize; // size of index chunk at this offset