annotate libmpdemux/aviheader.h @ 10223:b89d03e939d6

display pts for audio-only files as hh:mm:ss.f patch by Robert Riches (rm.riches at verizon.net)
author rfelker
date Sat, 31 May 2003 20:52:16 +0000
parents ae5a2ae1c349
children 846ed866f86c
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1343
ecaa8d0f1649 ASF support for non-x86 cpus
jkeil
parents:
diff changeset
1 #ifndef _aviheader_h
ecaa8d0f1649 ASF support for non-x86 cpus
jkeil
parents:
diff changeset
2 #define _aviheader_h
ecaa8d0f1649 ASF support for non-x86 cpus
jkeil
parents:
diff changeset
3
1485
b895f95e7657 AVI demuxer cleanups, fileformat-dependent stuff moved to priv_t
arpi
parents: 1343
diff changeset
4 //#include "config.h" /* get correct definition WORDS_BIGENDIAN */
1343
ecaa8d0f1649 ASF support for non-x86 cpus
jkeil
parents:
diff changeset
5 #include "bswap.h"
ecaa8d0f1649 ASF support for non-x86 cpus
jkeil
parents:
diff changeset
6
ecaa8d0f1649 ASF support for non-x86 cpus
jkeil
parents:
diff changeset
7 /*
ecaa8d0f1649 ASF support for non-x86 cpus
jkeil
parents:
diff changeset
8 * Some macros to swap little endian structures read from an AVI file
ecaa8d0f1649 ASF support for non-x86 cpus
jkeil
parents:
diff changeset
9 * into machine endian format
ecaa8d0f1649 ASF support for non-x86 cpus
jkeil
parents:
diff changeset
10 */
ecaa8d0f1649 ASF support for non-x86 cpus
jkeil
parents:
diff changeset
11 #ifdef WORDS_BIGENDIAN
ecaa8d0f1649 ASF support for non-x86 cpus
jkeil
parents:
diff changeset
12 #define le2me_MainAVIHeader(h) { \
ecaa8d0f1649 ASF support for non-x86 cpus
jkeil
parents:
diff changeset
13 (h)->dwMicroSecPerFrame = le2me_32((h)->dwMicroSecPerFrame); \
ecaa8d0f1649 ASF support for non-x86 cpus
jkeil
parents:
diff changeset
14 (h)->dwMaxBytesPerSec = le2me_32((h)->dwMaxBytesPerSec); \
ecaa8d0f1649 ASF support for non-x86 cpus
jkeil
parents:
diff changeset
15 (h)->dwPaddingGranularity = le2me_32((h)->dwPaddingGranularity); \
ecaa8d0f1649 ASF support for non-x86 cpus
jkeil
parents:
diff changeset
16 (h)->dwFlags = le2me_32((h)->dwFlags); \
ecaa8d0f1649 ASF support for non-x86 cpus
jkeil
parents:
diff changeset
17 (h)->dwTotalFrames = le2me_32((h)->dwTotalFrames); \
ecaa8d0f1649 ASF support for non-x86 cpus
jkeil
parents:
diff changeset
18 (h)->dwInitialFrames = le2me_32((h)->dwInitialFrames); \
ecaa8d0f1649 ASF support for non-x86 cpus
jkeil
parents:
diff changeset
19 (h)->dwStreams = le2me_32((h)->dwStreams); \
ecaa8d0f1649 ASF support for non-x86 cpus
jkeil
parents:
diff changeset
20 (h)->dwSuggestedBufferSize = le2me_32((h)->dwSuggestedBufferSize); \
ecaa8d0f1649 ASF support for non-x86 cpus
jkeil
parents:
diff changeset
21 (h)->dwWidth = le2me_32((h)->dwWidth); \
ecaa8d0f1649 ASF support for non-x86 cpus
jkeil
parents:
diff changeset
22 (h)->dwHeight = le2me_32((h)->dwHeight); \
ecaa8d0f1649 ASF support for non-x86 cpus
jkeil
parents:
diff changeset
23 }
ecaa8d0f1649 ASF support for non-x86 cpus
jkeil
parents:
diff changeset
24
ecaa8d0f1649 ASF support for non-x86 cpus
jkeil
parents:
diff changeset
25 #define le2me_AVIStreamHeader(h) { \
ecaa8d0f1649 ASF support for non-x86 cpus
jkeil
parents:
diff changeset
26 (h)->fccType = le2me_32((h)->fccType); \
ecaa8d0f1649 ASF support for non-x86 cpus
jkeil
parents:
diff changeset
27 (h)->fccHandler = le2me_32((h)->fccHandler); \
ecaa8d0f1649 ASF support for non-x86 cpus
jkeil
parents:
diff changeset
28 (h)->dwFlags = le2me_32((h)->dwFlags); \
ecaa8d0f1649 ASF support for non-x86 cpus
jkeil
parents:
diff changeset
29 (h)->wPriority = le2me_16((h)->wPriority); \
ecaa8d0f1649 ASF support for non-x86 cpus
jkeil
parents:
diff changeset
30 (h)->wLanguage = le2me_16((h)->wLanguage); \
ecaa8d0f1649 ASF support for non-x86 cpus
jkeil
parents:
diff changeset
31 (h)->dwInitialFrames = le2me_32((h)->dwInitialFrames); \
ecaa8d0f1649 ASF support for non-x86 cpus
jkeil
parents:
diff changeset
32 (h)->dwScale = le2me_32((h)->dwScale); \
ecaa8d0f1649 ASF support for non-x86 cpus
jkeil
parents:
diff changeset
33 (h)->dwRate = le2me_32((h)->dwRate); \
ecaa8d0f1649 ASF support for non-x86 cpus
jkeil
parents:
diff changeset
34 (h)->dwStart = le2me_32((h)->dwStart); \
ecaa8d0f1649 ASF support for non-x86 cpus
jkeil
parents:
diff changeset
35 (h)->dwLength = le2me_32((h)->dwLength); \
ecaa8d0f1649 ASF support for non-x86 cpus
jkeil
parents:
diff changeset
36 (h)->dwSuggestedBufferSize = le2me_32((h)->dwSuggestedBufferSize); \
ecaa8d0f1649 ASF support for non-x86 cpus
jkeil
parents:
diff changeset
37 (h)->dwQuality = le2me_32((h)->dwQuality); \
ecaa8d0f1649 ASF support for non-x86 cpus
jkeil
parents:
diff changeset
38 (h)->dwSampleSize = le2me_32((h)->dwSampleSize); \
ecaa8d0f1649 ASF support for non-x86 cpus
jkeil
parents:
diff changeset
39 le2me_RECT(&(h)->rcFrame); \
ecaa8d0f1649 ASF support for non-x86 cpus
jkeil
parents:
diff changeset
40 }
ecaa8d0f1649 ASF support for non-x86 cpus
jkeil
parents:
diff changeset
41 #define le2me_RECT(h) { \
ecaa8d0f1649 ASF support for non-x86 cpus
jkeil
parents:
diff changeset
42 (h)->left = le2me_16((h)->left); \
ecaa8d0f1649 ASF support for non-x86 cpus
jkeil
parents:
diff changeset
43 (h)->top = le2me_16((h)->top); \
ecaa8d0f1649 ASF support for non-x86 cpus
jkeil
parents:
diff changeset
44 (h)->right = le2me_16((h)->right); \
ecaa8d0f1649 ASF support for non-x86 cpus
jkeil
parents:
diff changeset
45 (h)->bottom = le2me_16((h)->bottom); \
ecaa8d0f1649 ASF support for non-x86 cpus
jkeil
parents:
diff changeset
46 }
ecaa8d0f1649 ASF support for non-x86 cpus
jkeil
parents:
diff changeset
47 #define le2me_BITMAPINFOHEADER(h) { \
ecaa8d0f1649 ASF support for non-x86 cpus
jkeil
parents:
diff changeset
48 (h)->biSize = le2me_32((h)->biSize); \
ecaa8d0f1649 ASF support for non-x86 cpus
jkeil
parents:
diff changeset
49 (h)->biWidth = le2me_32((h)->biWidth); \
ecaa8d0f1649 ASF support for non-x86 cpus
jkeil
parents:
diff changeset
50 (h)->biHeight = le2me_32((h)->biHeight); \
ecaa8d0f1649 ASF support for non-x86 cpus
jkeil
parents:
diff changeset
51 (h)->biPlanes = le2me_16((h)->biPlanes); \
ecaa8d0f1649 ASF support for non-x86 cpus
jkeil
parents:
diff changeset
52 (h)->biBitCount = le2me_16((h)->biBitCount); \
ecaa8d0f1649 ASF support for non-x86 cpus
jkeil
parents:
diff changeset
53 (h)->biCompression = le2me_32((h)->biCompression); \
ecaa8d0f1649 ASF support for non-x86 cpus
jkeil
parents:
diff changeset
54 (h)->biSizeImage = le2me_32((h)->biSizeImage); \
ecaa8d0f1649 ASF support for non-x86 cpus
jkeil
parents:
diff changeset
55 (h)->biXPelsPerMeter = le2me_32((h)->biXPelsPerMeter); \
ecaa8d0f1649 ASF support for non-x86 cpus
jkeil
parents:
diff changeset
56 (h)->biYPelsPerMeter = le2me_32((h)->biYPelsPerMeter); \
ecaa8d0f1649 ASF support for non-x86 cpus
jkeil
parents:
diff changeset
57 (h)->biClrUsed = le2me_32((h)->biClrUsed); \
ecaa8d0f1649 ASF support for non-x86 cpus
jkeil
parents:
diff changeset
58 (h)->biClrImportant = le2me_32((h)->biClrImportant); \
ecaa8d0f1649 ASF support for non-x86 cpus
jkeil
parents:
diff changeset
59 }
ecaa8d0f1649 ASF support for non-x86 cpus
jkeil
parents:
diff changeset
60 #define le2me_WAVEFORMATEX(h) { \
ecaa8d0f1649 ASF support for non-x86 cpus
jkeil
parents:
diff changeset
61 (h)->wFormatTag = le2me_16((h)->wFormatTag); \
ecaa8d0f1649 ASF support for non-x86 cpus
jkeil
parents:
diff changeset
62 (h)->nChannels = le2me_16((h)->nChannels); \
ecaa8d0f1649 ASF support for non-x86 cpus
jkeil
parents:
diff changeset
63 (h)->nSamplesPerSec = le2me_32((h)->nSamplesPerSec); \
ecaa8d0f1649 ASF support for non-x86 cpus
jkeil
parents:
diff changeset
64 (h)->nAvgBytesPerSec = le2me_32((h)->nAvgBytesPerSec); \
ecaa8d0f1649 ASF support for non-x86 cpus
jkeil
parents:
diff changeset
65 (h)->nBlockAlign = le2me_16((h)->nBlockAlign); \
ecaa8d0f1649 ASF support for non-x86 cpus
jkeil
parents:
diff changeset
66 (h)->wBitsPerSample = le2me_16((h)->wBitsPerSample); \
ecaa8d0f1649 ASF support for non-x86 cpus
jkeil
parents:
diff changeset
67 (h)->cbSize = le2me_16((h)->cbSize); \
ecaa8d0f1649 ASF support for non-x86 cpus
jkeil
parents:
diff changeset
68 }
ecaa8d0f1649 ASF support for non-x86 cpus
jkeil
parents:
diff changeset
69 #define le2me_AVIINDEXENTRY(h) { \
ecaa8d0f1649 ASF support for non-x86 cpus
jkeil
parents:
diff changeset
70 (h)->ckid = le2me_32((h)->ckid); \
ecaa8d0f1649 ASF support for non-x86 cpus
jkeil
parents:
diff changeset
71 (h)->dwFlags = le2me_32((h)->dwFlags); \
ecaa8d0f1649 ASF support for non-x86 cpus
jkeil
parents:
diff changeset
72 (h)->dwChunkOffset = le2me_32((h)->dwChunkOffset); \
ecaa8d0f1649 ASF support for non-x86 cpus
jkeil
parents:
diff changeset
73 (h)->dwChunkLength = le2me_32((h)->dwChunkLength); \
ecaa8d0f1649 ASF support for non-x86 cpus
jkeil
parents:
diff changeset
74 }
ecaa8d0f1649 ASF support for non-x86 cpus
jkeil
parents:
diff changeset
75 #else
ecaa8d0f1649 ASF support for non-x86 cpus
jkeil
parents:
diff changeset
76 #define le2me_MainAVIHeader(h) /**/
ecaa8d0f1649 ASF support for non-x86 cpus
jkeil
parents:
diff changeset
77 #define le2me_AVIStreamHeader(h) /**/
ecaa8d0f1649 ASF support for non-x86 cpus
jkeil
parents:
diff changeset
78 #define le2me_RECT(h) /**/
ecaa8d0f1649 ASF support for non-x86 cpus
jkeil
parents:
diff changeset
79 #define le2me_BITMAPINFOHEADER(h) /**/
ecaa8d0f1649 ASF support for non-x86 cpus
jkeil
parents:
diff changeset
80 #define le2me_WAVEFORMATEX(h) /**/
ecaa8d0f1649 ASF support for non-x86 cpus
jkeil
parents:
diff changeset
81 #define le2me_AVIINDEXENTRY(h) /**/
ecaa8d0f1649 ASF support for non-x86 cpus
jkeil
parents:
diff changeset
82 #endif
ecaa8d0f1649 ASF support for non-x86 cpus
jkeil
parents:
diff changeset
83
ecaa8d0f1649 ASF support for non-x86 cpus
jkeil
parents:
diff changeset
84
ecaa8d0f1649 ASF support for non-x86 cpus
jkeil
parents:
diff changeset
85 #endif
1485
b895f95e7657 AVI demuxer cleanups, fileformat-dependent stuff moved to priv_t
arpi
parents: 1343
diff changeset
86
b895f95e7657 AVI demuxer cleanups, fileformat-dependent stuff moved to priv_t
arpi
parents: 1343
diff changeset
87
b895f95e7657 AVI demuxer cleanups, fileformat-dependent stuff moved to priv_t
arpi
parents: 1343
diff changeset
88 typedef struct {
b895f95e7657 AVI demuxer cleanups, fileformat-dependent stuff moved to priv_t
arpi
parents: 1343
diff changeset
89 // index stuff:
b895f95e7657 AVI demuxer cleanups, fileformat-dependent stuff moved to priv_t
arpi
parents: 1343
diff changeset
90 void* idx;
b895f95e7657 AVI demuxer cleanups, fileformat-dependent stuff moved to priv_t
arpi
parents: 1343
diff changeset
91 int idx_size;
6056
f980563afdbc big (>2GB) AVI files support - patch by Wolfram Gloger <wg@malloc.de>
arpi
parents: 2330
diff changeset
92 off_t idx_pos;
f980563afdbc big (>2GB) AVI files support - patch by Wolfram Gloger <wg@malloc.de>
arpi
parents: 2330
diff changeset
93 off_t idx_pos_a;
f980563afdbc big (>2GB) AVI files support - patch by Wolfram Gloger <wg@malloc.de>
arpi
parents: 2330
diff changeset
94 off_t idx_pos_v;
f980563afdbc big (>2GB) AVI files support - patch by Wolfram Gloger <wg@malloc.de>
arpi
parents: 2330
diff changeset
95 off_t idx_offset; // ennyit kell hozzaadni az index offset ertekekhez
8030
2b39ff3860b7 cleanup of .AVI timestamp calculation (ugly hack from mplayer.c removed,
arpi
parents: 6056
diff changeset
96 // bps-based PTS stuff:
2b39ff3860b7 cleanup of .AVI timestamp calculation (ugly hack from mplayer.c removed,
arpi
parents: 6056
diff changeset
97 int video_pack_no;
2b39ff3860b7 cleanup of .AVI timestamp calculation (ugly hack from mplayer.c removed,
arpi
parents: 6056
diff changeset
98 int audio_block_size;
2b39ff3860b7 cleanup of .AVI timestamp calculation (ugly hack from mplayer.c removed,
arpi
parents: 6056
diff changeset
99 off_t audio_block_no;
1485
b895f95e7657 AVI demuxer cleanups, fileformat-dependent stuff moved to priv_t
arpi
parents: 1343
diff changeset
100 // interleaved PTS stuff:
b895f95e7657 AVI demuxer cleanups, fileformat-dependent stuff moved to priv_t
arpi
parents: 1343
diff changeset
101 int skip_video_frames;
2330
8f0861360325 AVI - no audio stream fix
arpi
parents: 2310
diff changeset
102 int audio_streams;
1485
b895f95e7657 AVI demuxer cleanups, fileformat-dependent stuff moved to priv_t
arpi
parents: 1343
diff changeset
103 float avi_audio_pts;
b895f95e7657 AVI demuxer cleanups, fileformat-dependent stuff moved to priv_t
arpi
parents: 1343
diff changeset
104 float avi_video_pts;
b895f95e7657 AVI demuxer cleanups, fileformat-dependent stuff moved to priv_t
arpi
parents: 1343
diff changeset
105 float pts_correction;
b895f95e7657 AVI demuxer cleanups, fileformat-dependent stuff moved to priv_t
arpi
parents: 1343
diff changeset
106 unsigned int pts_corr_bytes;
b895f95e7657 AVI demuxer cleanups, fileformat-dependent stuff moved to priv_t
arpi
parents: 1343
diff changeset
107 unsigned char pts_corrected;
b895f95e7657 AVI demuxer cleanups, fileformat-dependent stuff moved to priv_t
arpi
parents: 1343
diff changeset
108 unsigned char pts_has_video;
8208
ae5a2ae1c349 demuxer_control(), percent position and time length query implemented in
arpi
parents: 8030
diff changeset
109 unsigned int numberofframes;
1485
b895f95e7657 AVI demuxer cleanups, fileformat-dependent stuff moved to priv_t
arpi
parents: 1343
diff changeset
110 } avi_priv_t;
b895f95e7657 AVI demuxer cleanups, fileformat-dependent stuff moved to priv_t
arpi
parents: 1343
diff changeset
111
b895f95e7657 AVI demuxer cleanups, fileformat-dependent stuff moved to priv_t
arpi
parents: 1343
diff changeset
112 #define AVI_PRIV ((avi_priv_t*)(demuxer->priv))