changeset 12341:0db4a3a5b01d

removed loader/ dependancy, imported some files from g2, also used patches from Dominik Mierzejewski
author alex
date Wed, 28 Apr 2004 10:18:33 +0000
parents 6aa3e3d97133
children da1292848fd3
files codec-cfg.c libmpdemux/aviheader.h libmpdemux/aviprint.c libmpdemux/ms_hdr.h libmpdemux/muxer.c libmpdemux/muxer_avi.c libmpdemux/muxer_mpeg.c libmpdemux/stheader.h mencoder.c
diffstat 9 files changed, 220 insertions(+), 53 deletions(-) [+]
line wrap: on
line diff
--- a/codec-cfg.c	Wed Apr 28 05:58:46 2004 +0000
+++ b/codec-cfg.c	Wed Apr 28 10:18:33 2004 +0000
@@ -27,7 +27,7 @@
 #include "mp_msg.h"
 
 // for mmioFOURCC:
-#include "wine/avifmt.h"
+#include "libmpdemux/aviheader.h"
 
 #include "libvo/img_format.h"
 #include "codec-cfg.h"
--- a/libmpdemux/aviheader.h	Wed Apr 28 05:58:46 2004 +0000
+++ b/libmpdemux/aviheader.h	Wed Apr 28 10:18:33 2004 +0000
@@ -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
--- a/libmpdemux/aviprint.c	Wed Apr 28 05:58:46 2004 +0000
+++ b/libmpdemux/aviprint.c	Wed Apr 28 10:18:33 2004 +0000
@@ -9,11 +9,8 @@
 #include "stream.h"
 #include "demuxer.h"
 
-#include "wine/mmreg.h"
-#include "wine/avifmt.h"
-#include "wine/vfw.h"
-
 #include "aviheader.h"
+#include "ms_hdr.h"
 
 //#include "codec-cfg.h"
 //#include "stheader.h"
@@ -79,7 +76,7 @@
     uint8_t* p = ((uint8_t*)h) + sizeof(WAVEFORMATEX);
     printf("Unknown extra header dump: ");
     for (i = 0; i < h->cbSize; i++)
-	printf("[%x] ", *(p+i));
+	printf("[%x] ", p[i]);
     printf("\n");
   }
   printf("===========================\n");
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libmpdemux/ms_hdr.h	Wed Apr 28 10:18:33 2004 +0000
@@ -0,0 +1,78 @@
+#ifndef __MS_HEADER_H
+#define __MS_HEADER_H 1
+
+#ifndef _WAVEFORMATEX_
+#define _WAVEFORMATEX_
+typedef struct __attribute__((__packed__)) _WAVEFORMATEX {
+  unsigned short  wFormatTag;
+  unsigned short  nChannels;
+  unsigned int    nSamplesPerSec;
+  unsigned int    nAvgBytesPerSec;
+  unsigned short  nBlockAlign;
+  unsigned short  wBitsPerSample;
+  unsigned short  cbSize;
+} WAVEFORMATEX, *PWAVEFORMATEX, *NPWAVEFORMATEX, *LPWAVEFORMATEX;
+#endif /* _WAVEFORMATEX_ */
+
+typedef struct __attribute__((__packed__)) mpeglayer3waveformat_tag {
+  WAVEFORMATEX wf;
+  unsigned short wID;
+  unsigned int   fdwFlags;
+  unsigned short nBlockSize;
+  unsigned short nFramesPerBlock;
+  unsigned short nCodecDelay;
+} MPEGLAYER3WAVEFORMAT;
+
+#if !defined(_BITMAPINFOHEADER_) && !defined(_WINGDI_H)
+#define _BITMAPINFOHEADER_
+typedef struct __attribute__((__packed__))
+{
+    int 	biSize;
+    int  	biWidth;
+    int  	biHeight;
+    short 	biPlanes;
+    short 	biBitCount;
+    int 	biCompression;
+    int 	biSizeImage;
+    int  	biXPelsPerMeter;
+    int  	biYPelsPerMeter;
+    int 	biClrUsed;
+    int 	biClrImportant;
+} BITMAPINFOHEADER, *PBITMAPINFOHEADER, *LPBITMAPINFOHEADER;
+typedef struct {
+	BITMAPINFOHEADER bmiHeader;
+	int	bmiColors[1];
+} BITMAPINFO, *LPBITMAPINFO;
+#endif
+
+#ifndef le2me_BITMAPINFOHEADER
+#ifdef WORDS_BIGENDIAN
+#define le2me_BITMAPINFOHEADER(h) {					\
+    (h)->biSize = le2me_32((h)->biSize);				\
+    (h)->biWidth = le2me_32((h)->biWidth);				\
+    (h)->biHeight = le2me_32((h)->biHeight);				\
+    (h)->biPlanes = le2me_16((h)->biPlanes);				\
+    (h)->biBitCount = le2me_16((h)->biBitCount);			\
+    (h)->biCompression = le2me_32((h)->biCompression);			\
+    (h)->biSizeImage = le2me_32((h)->biSizeImage);			\
+    (h)->biXPelsPerMeter = le2me_32((h)->biXPelsPerMeter);		\
+    (h)->biYPelsPerMeter = le2me_32((h)->biYPelsPerMeter);		\
+    (h)->biClrUsed = le2me_32((h)->biClrUsed);				\
+    (h)->biClrImportant = le2me_32((h)->biClrImportant);		\
+}
+#define le2me_WAVEFORMATEX(h) {						\
+    (h)->wFormatTag = le2me_16((h)->wFormatTag);			\
+    (h)->nChannels = le2me_16((h)->nChannels);				\
+    (h)->nSamplesPerSec = le2me_32((h)->nSamplesPerSec);		\
+    (h)->nAvgBytesPerSec = le2me_32((h)->nAvgBytesPerSec);		\
+    (h)->nBlockAlign = le2me_16((h)->nBlockAlign);			\
+    (h)->wBitsPerSample = le2me_16((h)->wBitsPerSample);		\
+    (h)->cbSize = le2me_16((h)->cbSize);				\
+}
+#else
+#define le2me_BITMAPINFOHEADER(h)   /**/
+#define le2me_WAVEFORMATEX(h)	    /**/
+#endif
+#endif
+
+#endif
--- a/libmpdemux/muxer.c	Wed Apr 28 05:58:46 2004 +0000
+++ b/libmpdemux/muxer.c	Wed Apr 28 10:18:33 2004 +0000
@@ -8,9 +8,8 @@
 #include "config.h"
 #include "../version.h"
 
-#include "wine/mmreg.h"
-#include "wine/avifmt.h"
-#include "wine/vfw.h"
+#include "aviheader.h"
+#include "ms_hdr.h"
 
 #include "muxer.h"
 
--- a/libmpdemux/muxer_avi.c	Wed Apr 28 05:58:46 2004 +0000
+++ b/libmpdemux/muxer_avi.c	Wed Apr 28 10:18:33 2004 +0000
@@ -12,13 +12,11 @@
 #include "demuxer.h"
 #include "stheader.h"
 
-#include "wine/mmreg.h"
-#include "wine/avifmt.h"
-#include "wine/vfw.h"
 #include "bswap.h"
 
 #include "muxer.h"
 #include "aviheader.h"
+#include "ms_hdr.h"
 #include "mp_msg.h"
 
 extern char *info_name;
--- a/libmpdemux/muxer_mpeg.c	Wed Apr 28 05:58:46 2004 +0000
+++ b/libmpdemux/muxer_mpeg.c	Wed Apr 28 10:18:33 2004 +0000
@@ -8,11 +8,11 @@
 #include "../version.h"
 #include "../mp_msg.h"
 
-#include "wine/mmreg.h"
-#include "wine/avifmt.h"
-#include "wine/vfw.h"
 #include "bswap.h"
 
+#include "aviheader.h"
+#include "ms_hdr.h"
+
 #include "muxer.h"
 
 // 18 bytes reserved for block headers and STD
--- a/libmpdemux/stheader.h	Wed Apr 28 05:58:46 2004 +0000
+++ b/libmpdemux/stheader.h	Wed Apr 28 10:18:33 2004 +0000
@@ -1,43 +1,8 @@
 #ifndef __ST_HEADER_H
 #define __ST_HEADER_H 1
 
-// for AVIStreamHeader:
-#include "wine/avifmt.h"
-
-#ifndef _WAVEFORMATEX_
-#define _WAVEFORMATEX_
-typedef struct __attribute__((__packed__)) _WAVEFORMATEX {
-  WORD   wFormatTag;
-  WORD   nChannels;
-  DWORD  nSamplesPerSec;
-  DWORD  nAvgBytesPerSec;
-  WORD   nBlockAlign;
-  WORD   wBitsPerSample;
-  WORD   cbSize;
-} WAVEFORMATEX, *PWAVEFORMATEX, *NPWAVEFORMATEX, *LPWAVEFORMATEX;
-#endif /* _WAVEFORMATEX_ */
-
-#ifndef _BITMAPINFOHEADER_
-#define _BITMAPINFOHEADER_
-typedef struct __attribute__((__packed__))
-{
-    int 	biSize;
-    int  	biWidth;
-    int  	biHeight;
-    short 	biPlanes;
-    short 	biBitCount;
-    int 	biCompression;
-    int 	biSizeImage;
-    int  	biXPelsPerMeter;
-    int  	biYPelsPerMeter;
-    int 	biClrUsed;
-    int 	biClrImportant;
-} BITMAPINFOHEADER, *PBITMAPINFOHEADER, *LPBITMAPINFOHEADER;
-typedef struct {
-	BITMAPINFOHEADER bmiHeader;
-	int	bmiColors[1];
-} BITMAPINFO, *LPBITMAPINFO;
-#endif
+#include "aviheader.h"
+#include "ms_hdr.h"
 
 // Stream headers:
 
--- a/mencoder.c	Wed Apr 28 05:58:46 2004 +0000
+++ b/mencoder.c	Wed Apr 28 10:18:33 2004 +0000
@@ -55,7 +55,7 @@
 #include "libmpcodecs/vf.h"
 
 // for MPEGLAYER3WAVEFORMAT:
-#include "loader/wine/mmreg.h"
+#include "libmpdemux/ms_hdr.h"
 
 #ifdef HAVE_MP3LAME
 #undef CDECL