2 * This file is part of MPlayer.
4 * MPlayer is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * MPlayer is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License along
15 * with MPlayer; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
26 // for avi_stream_id():
27 #include "stream/stream.h"
30 #include "aviheader.h"
33 //#include "codec-cfg.h"
34 //#include "stheader.h"
36 void print_avih_flags(MainAVIHeader
*h
, int verbose_level
){
37 mp_msg(MSGT_HEADER
, verbose_level
, "MainAVIHeader.dwFlags: (%"PRId32
")%s%s%s%s%s%s\n",h
->dwFlags
,
38 (h
->dwFlags
&AVIF_HASINDEX
)?" HAS_INDEX":"",
39 (h
->dwFlags
&AVIF_MUSTUSEINDEX
)?" MUST_USE_INDEX":"",
40 (h
->dwFlags
&AVIF_ISINTERLEAVED
)?" IS_INTERLEAVED":"",
41 (h
->dwFlags
&AVIF_TRUSTCKTYPE
)?" TRUST_CKTYPE":"",
42 (h
->dwFlags
&AVIF_WASCAPTUREFILE
)?" WAS_CAPTUREFILE":"",
43 (h
->dwFlags
&AVIF_COPYRIGHTED
)?" COPYRIGHTED":""
47 void print_avih(MainAVIHeader
*h
, int verbose_level
){
48 mp_msg(MSGT_HEADER
, verbose_level
, "======= AVI Header =======\n");
49 mp_msg(MSGT_HEADER
, verbose_level
, "us/frame: %"PRId32
" (fps=%5.3f)\n",h
->dwMicroSecPerFrame
,1000000.0f
/(float)h
->dwMicroSecPerFrame
);
50 mp_msg(MSGT_HEADER
, verbose_level
, "max bytes/sec: %"PRId32
"\n",h
->dwMaxBytesPerSec
);
51 mp_msg(MSGT_HEADER
, verbose_level
, "padding: %"PRId32
"\n",h
->dwPaddingGranularity
);
52 print_avih_flags(h
, verbose_level
);
53 mp_msg(MSGT_HEADER
, verbose_level
, "frames total: %"PRId32
" initial: %"PRId32
"\n",h
->dwTotalFrames
,h
->dwInitialFrames
);
54 mp_msg(MSGT_HEADER
, verbose_level
, "streams: %"PRId32
"\n",h
->dwStreams
);
55 mp_msg(MSGT_HEADER
, verbose_level
, "Suggested BufferSize: %"PRId32
"\n",h
->dwSuggestedBufferSize
);
56 mp_msg(MSGT_HEADER
, verbose_level
, "Size: %"PRId32
" x %"PRId32
"\n",h
->dwWidth
,h
->dwHeight
);
57 mp_msg(MSGT_HEADER
, verbose_level
, "==========================\n");
60 void print_strh(AVIStreamHeader
*h
, int verbose_level
){
61 mp_msg(MSGT_HEADER
, verbose_level
, "====== STREAM Header =====\n");
62 mp_msg(MSGT_HEADER
, verbose_level
, "Type: %.4s FCC: %.4s (%X)\n",(char *)&h
->fccType
,(char *)&h
->fccHandler
,(unsigned int)h
->fccHandler
);
63 mp_msg(MSGT_HEADER
, verbose_level
, "Flags: %"PRId32
"\n",h
->dwFlags
);
64 mp_msg(MSGT_HEADER
, verbose_level
, "Priority: %d Language: %d\n",h
->wPriority
,h
->wLanguage
);
65 mp_msg(MSGT_HEADER
, verbose_level
, "InitialFrames: %"PRId32
"\n",h
->dwInitialFrames
);
66 mp_msg(MSGT_HEADER
, verbose_level
, "Rate: %"PRId32
"/%"PRId32
" = %5.3f\n",h
->dwRate
,h
->dwScale
,(float)h
->dwRate
/(float)h
->dwScale
);
67 mp_msg(MSGT_HEADER
, verbose_level
, "Start: %"PRId32
" Len: %"PRId32
"\n",h
->dwStart
,h
->dwLength
);
68 mp_msg(MSGT_HEADER
, verbose_level
, "Suggested BufferSize: %"PRId32
"\n",h
->dwSuggestedBufferSize
);
69 mp_msg(MSGT_HEADER
, verbose_level
, "Quality %"PRId32
"\n",h
->dwQuality
);
70 mp_msg(MSGT_HEADER
, verbose_level
, "Sample size: %"PRId32
"\n",h
->dwSampleSize
);
71 mp_msg(MSGT_HEADER
, verbose_level
, "==========================\n");
74 void print_wave_header(WAVEFORMATEX
*h
, int verbose_level
){
75 mp_msg(MSGT_HEADER
, verbose_level
, "======= WAVE Format =======\n");
76 mp_msg(MSGT_HEADER
, verbose_level
, "Format Tag: %d (0x%X)\n",h
->wFormatTag
,h
->wFormatTag
);
77 mp_msg(MSGT_HEADER
, verbose_level
, "Channels: %d\n",h
->nChannels
);
78 mp_msg(MSGT_HEADER
, verbose_level
, "Samplerate: %"PRId32
"\n",h
->nSamplesPerSec
);
79 mp_msg(MSGT_HEADER
, verbose_level
, "avg byte/sec: %"PRId32
"\n",h
->nAvgBytesPerSec
);
80 mp_msg(MSGT_HEADER
, verbose_level
, "Block align: %d\n",h
->nBlockAlign
);
81 mp_msg(MSGT_HEADER
, verbose_level
, "bits/sample: %d\n",h
->wBitsPerSample
);
82 mp_msg(MSGT_HEADER
, verbose_level
, "cbSize: %d\n",h
->cbSize
);
83 if(h
->wFormatTag
==0x55 && h
->cbSize
>=12){
84 MPEGLAYER3WAVEFORMAT
* h2
=(MPEGLAYER3WAVEFORMAT
*)h
;
85 mp_msg(MSGT_HEADER
, verbose_level
, "mp3.wID=%d\n",h2
->wID
);
86 mp_msg(MSGT_HEADER
, verbose_level
, "mp3.fdwFlags=0x%"PRIX32
"\n",h2
->fdwFlags
);
87 mp_msg(MSGT_HEADER
, verbose_level
, "mp3.nBlockSize=%d\n",h2
->nBlockSize
);
88 mp_msg(MSGT_HEADER
, verbose_level
, "mp3.nFramesPerBlock=%d\n",h2
->nFramesPerBlock
);
89 mp_msg(MSGT_HEADER
, verbose_level
, "mp3.nCodecDelay=%d\n",h2
->nCodecDelay
);
91 else if (h
->cbSize
> 0)
94 uint8_t* p
= (uint8_t*)(h
+ 1);
95 mp_msg(MSGT_HEADER
, verbose_level
, "Unknown extra header dump: ");
96 for (i
= 0; i
< h
->cbSize
; i
++)
97 mp_msg(MSGT_HEADER
, verbose_level
, "[%x] ", p
[i
]);
98 mp_msg(MSGT_HEADER
, verbose_level
, "\n");
100 mp_msg(MSGT_HEADER
, verbose_level
, "==========================================================================\n");
104 void print_video_header(BITMAPINFOHEADER
*h
, int verbose_level
){
105 mp_msg(MSGT_HEADER
, verbose_level
, "======= VIDEO Format ======\n");
106 mp_msg(MSGT_HEADER
, verbose_level
, " biSize %d\n", h
->biSize
);
107 mp_msg(MSGT_HEADER
, verbose_level
, " biWidth %d\n", h
->biWidth
);
108 mp_msg(MSGT_HEADER
, verbose_level
, " biHeight %d\n", h
->biHeight
);
109 mp_msg(MSGT_HEADER
, verbose_level
, " biPlanes %d\n", h
->biPlanes
);
110 mp_msg(MSGT_HEADER
, verbose_level
, " biBitCount %d\n", h
->biBitCount
);
111 mp_msg(MSGT_HEADER
, verbose_level
, " biCompression %d='%.4s'\n", h
->biCompression
, (char *)&h
->biCompression
);
112 mp_msg(MSGT_HEADER
, verbose_level
, " biSizeImage %d\n", h
->biSizeImage
);
113 if (h
->biSize
> sizeof(BITMAPINFOHEADER
))
116 uint8_t* p
= (uint8_t*)(h
+ 1);
117 mp_msg(MSGT_HEADER
, verbose_level
, "Unknown extra header dump: ");
118 for (i
= 0; i
< h
->biSize
-sizeof(BITMAPINFOHEADER
); i
++)
119 mp_msg(MSGT_HEADER
, verbose_level
, "[%x] ", *(p
+i
));
120 mp_msg(MSGT_HEADER
, verbose_level
, "\n");
122 mp_msg(MSGT_HEADER
, verbose_level
, "===========================\n");
125 void print_vprp(VideoPropHeader
*vprp
, int verbose_level
){
127 mp_msg(MSGT_HEADER
, verbose_level
, "======= Video Properties Header =======\n");
128 mp_msg(MSGT_HEADER
, verbose_level
, "Format: %d VideoStandard: %d\n",
129 vprp
->VideoFormatToken
,vprp
->VideoStandard
);
130 mp_msg(MSGT_HEADER
, verbose_level
, "VRefresh: %d HTotal: %d VTotal: %d\n",
131 vprp
->dwVerticalRefreshRate
, vprp
->dwHTotalInT
, vprp
->dwVTotalInLines
);
132 mp_msg(MSGT_HEADER
, verbose_level
, "FrameAspect: %d:%d Framewidth: %d Frameheight: %d\n",
133 vprp
->dwFrameAspectRatio
>> 16, vprp
->dwFrameAspectRatio
& 0xffff,
134 vprp
->dwFrameWidthInPixels
, vprp
->dwFrameHeightInLines
);
135 mp_msg(MSGT_HEADER
, verbose_level
, "Fields: %d\n", vprp
->nbFieldPerFrame
);
136 for (i
=0; i
<vprp
->nbFieldPerFrame
; i
++) {
137 VIDEO_FIELD_DESC
*vfd
= &vprp
->FieldInfo
[i
];
138 mp_msg(MSGT_HEADER
, verbose_level
, " == Field %d description ==\n", i
);
139 mp_msg(MSGT_HEADER
, verbose_level
, " CompressedBMHeight: %d CompressedBMWidth: %d\n",
140 vfd
->CompressedBMHeight
, vfd
->CompressedBMWidth
);
141 mp_msg(MSGT_HEADER
, verbose_level
, " ValidBMHeight: %d ValidBMWidth: %d\n",
142 vfd
->ValidBMHeight
, vfd
->ValidBMWidth
);
143 mp_msg(MSGT_HEADER
, verbose_level
, " ValidBMXOffset: %d ValidBMYOffset: %d\n",
144 vfd
->ValidBMXOffset
, vfd
->ValidBMYOffset
);
145 mp_msg(MSGT_HEADER
, verbose_level
, " VideoXOffsetInT: %d VideoYValidStartLine: %d\n",
146 vfd
->VideoXOffsetInT
, vfd
->VideoYValidStartLine
);
148 mp_msg(MSGT_HEADER
, verbose_level
, "=======================================\n");
151 void print_index(AVIINDEXENTRY
*idx
, int idx_size
, int verbose_level
){
153 unsigned int pos
[256];
154 unsigned int num
[256];
155 memset(pos
, 0, sizeof(pos
));
156 memset(num
, 0, sizeof(num
));
157 for(i
=0;i
<idx_size
;i
++){
158 int id
=avi_stream_id(idx
[i
].ckid
);
159 if(id
<0 || id
>255) id
=255;
160 mp_msg(MSGT_HEADER
, verbose_level
, "%5d: %.4s %4X %016"PRIX64
" len:%6"PRId32
" pos:%7d->%7.3f %7d->%7.3f\n",i
,
161 (char *)&idx
[i
].ckid
,
162 (unsigned int)idx
[i
].dwFlags
&0xffff,
163 (uint64_t)AVI_IDX_OFFSET(&idx
[i
]),
164 // idx[i].dwChunkOffset+demuxer->movi_start,
165 idx
[i
].dwChunkLength
,
166 pos
[id
],(float)pos
[id
]/18747.0f
,
167 num
[id
],(float)num
[id
]/23.976f
169 pos
[id
]+=idx
[i
].dwChunkLength
;
174 void print_avistdindex_chunk(avistdindex_chunk
*h
, int verbose_level
){
175 mp_msg (MSGT_HEADER
, verbose_level
, "====== AVI Standard Index Header ========\n");
176 mp_msg (MSGT_HEADER
, verbose_level
, " FCC (%.4s) dwSize (%d) wLongsPerEntry(%d)\n", h
->fcc
, h
->dwSize
, h
->wLongsPerEntry
);
177 mp_msg (MSGT_HEADER
, verbose_level
, " bIndexSubType (%d) bIndexType (%d)\n", h
->bIndexSubType
, h
->bIndexType
);
178 mp_msg (MSGT_HEADER
, verbose_level
, " nEntriesInUse (%d) dwChunkId (%.4s)\n", h
->nEntriesInUse
, h
->dwChunkId
);
179 mp_msg (MSGT_HEADER
, verbose_level
, " qwBaseOffset (0x%"PRIX64
") dwReserved3 (%d)\n", h
->qwBaseOffset
, h
->dwReserved3
);
180 mp_msg (MSGT_HEADER
, verbose_level
, "===========================\n");
182 void print_avisuperindex_chunk(avisuperindex_chunk
*h
, int verbose_level
){
183 mp_msg (MSGT_HEADER
, verbose_level
, "====== AVI Super Index Header ========\n");
184 mp_msg (MSGT_HEADER
, verbose_level
, " FCC (%.4s) dwSize (%d) wLongsPerEntry(%d)\n", h
->fcc
, h
->dwSize
, h
->wLongsPerEntry
);
185 mp_msg (MSGT_HEADER
, verbose_level
, " bIndexSubType (%d) bIndexType (%d)\n", h
->bIndexSubType
, h
->bIndexType
);
186 mp_msg (MSGT_HEADER
, verbose_level
, " nEntriesInUse (%d) dwChunkId (%.4s)\n", h
->nEntriesInUse
, h
->dwChunkId
);
187 mp_msg (MSGT_HEADER
, verbose_level
, " dwReserved[0] (%d) dwReserved[1] (%d) dwReserved[2] (%d)\n",
188 h
->dwReserved
[0], h
->dwReserved
[1], h
->dwReserved
[2]);
189 mp_msg (MSGT_HEADER
, verbose_level
, "===========================\n");