Mercurial > mplayer.hg
comparison libmpdemux/aviprint.c @ 17977:f70772d02eaa
Convert printfs in aviprint.c to mp_msg and give the information printing
functions in this file a verbosity_level parameter.
author | diego |
---|---|
date | Mon, 27 Mar 2006 17:25:41 +0000 |
parents | 0a31740dd5e6 |
children | 4d81dbdf46b9 |
comparison
equal
deleted
inserted
replaced
17976:4c22d2209563 | 17977:f70772d02eaa |
---|---|
13 #include "ms_hdr.h" | 13 #include "ms_hdr.h" |
14 | 14 |
15 //#include "codec-cfg.h" | 15 //#include "codec-cfg.h" |
16 //#include "stheader.h" | 16 //#include "stheader.h" |
17 | 17 |
18 void print_avih_flags(MainAVIHeader *h){ | 18 void print_avih_flags(MainAVIHeader *h, int verbose_level){ |
19 printf("MainAVIHeader.dwFlags: (%ld)%s%s%s%s%s%s\n",h->dwFlags, | 19 mp_msg(MSGT_HEADER, verbose_level, "MainAVIHeader.dwFlags: (%ld)%s%s%s%s%s%s\n",h->dwFlags, |
20 (h->dwFlags&AVIF_HASINDEX)?" HAS_INDEX":"", | 20 (h->dwFlags&AVIF_HASINDEX)?" HAS_INDEX":"", |
21 (h->dwFlags&AVIF_MUSTUSEINDEX)?" MUST_USE_INDEX":"", | 21 (h->dwFlags&AVIF_MUSTUSEINDEX)?" MUST_USE_INDEX":"", |
22 (h->dwFlags&AVIF_ISINTERLEAVED)?" IS_INTERLEAVED":"", | 22 (h->dwFlags&AVIF_ISINTERLEAVED)?" IS_INTERLEAVED":"", |
23 (h->dwFlags&AVIF_TRUSTCKTYPE)?" TRUST_CKTYPE":"", | 23 (h->dwFlags&AVIF_TRUSTCKTYPE)?" TRUST_CKTYPE":"", |
24 (h->dwFlags&AVIF_WASCAPTUREFILE)?" WAS_CAPTUREFILE":"", | 24 (h->dwFlags&AVIF_WASCAPTUREFILE)?" WAS_CAPTUREFILE":"", |
25 (h->dwFlags&AVIF_COPYRIGHTED)?" COPYRIGHTED":"" | 25 (h->dwFlags&AVIF_COPYRIGHTED)?" COPYRIGHTED":"" |
26 ); | 26 ); |
27 } | 27 } |
28 | 28 |
29 void print_avih(MainAVIHeader *h){ | 29 void print_avih(MainAVIHeader *h, int verbose_level){ |
30 printf("======= AVI Header =======\n"); | 30 mp_msg(MSGT_HEADER, verbose_level, "======= AVI Header =======\n"); |
31 printf("us/frame: %ld (fps=%5.3f)\n",h->dwMicroSecPerFrame,1000000.0f/(float)h->dwMicroSecPerFrame); | 31 mp_msg(MSGT_HEADER, verbose_level, "us/frame: %ld (fps=%5.3f)\n",h->dwMicroSecPerFrame,1000000.0f/(float)h->dwMicroSecPerFrame); |
32 printf("max bytes/sec: %ld\n",h->dwMaxBytesPerSec); | 32 mp_msg(MSGT_HEADER, verbose_level, "max bytes/sec: %ld\n",h->dwMaxBytesPerSec); |
33 printf("padding: %ld\n",h->dwPaddingGranularity); | 33 mp_msg(MSGT_HEADER, verbose_level, "padding: %ld\n",h->dwPaddingGranularity); |
34 print_avih_flags(h); | 34 print_avih_flags(h, verbose_level); |
35 printf("frames total: %ld initial: %ld\n",h->dwTotalFrames,h->dwInitialFrames); | 35 mp_msg(MSGT_HEADER, verbose_level, "frames total: %ld initial: %ld\n",h->dwTotalFrames,h->dwInitialFrames); |
36 printf("streams: %ld\n",h->dwStreams); | 36 mp_msg(MSGT_HEADER, verbose_level, "streams: %ld\n",h->dwStreams); |
37 printf("Suggested BufferSize: %ld\n",h->dwSuggestedBufferSize); | 37 mp_msg(MSGT_HEADER, verbose_level, "Suggested BufferSize: %ld\n",h->dwSuggestedBufferSize); |
38 printf("Size: %ld x %ld\n",h->dwWidth,h->dwHeight); | 38 mp_msg(MSGT_HEADER, verbose_level, "Size: %ld x %ld\n",h->dwWidth,h->dwHeight); |
39 printf("==========================\n"); | 39 mp_msg(MSGT_HEADER, verbose_level, "==========================\n"); |
40 } | 40 } |
41 | 41 |
42 void print_strh(AVIStreamHeader *h){ | 42 void print_strh(AVIStreamHeader *h, int verbose_level){ |
43 printf("====== STREAM Header =====\n"); | 43 mp_msg(MSGT_HEADER, verbose_level, "====== STREAM Header =====\n"); |
44 printf("Type: %.4s FCC: %.4s (%X)\n",(char *)&h->fccType,(char *)&h->fccHandler,(unsigned int)h->fccHandler); | 44 mp_msg(MSGT_HEADER, verbose_level, "Type: %.4s FCC: %.4s (%X)\n",(char *)&h->fccType,(char *)&h->fccHandler,(unsigned int)h->fccHandler); |
45 printf("Flags: %ld\n",h->dwFlags); | 45 mp_msg(MSGT_HEADER, verbose_level, "Flags: %ld\n",h->dwFlags); |
46 printf("Priority: %d Language: %d\n",h->wPriority,h->wLanguage); | 46 mp_msg(MSGT_HEADER, verbose_level, "Priority: %d Language: %d\n",h->wPriority,h->wLanguage); |
47 printf("InitialFrames: %ld\n",h->dwInitialFrames); | 47 mp_msg(MSGT_HEADER, verbose_level, "InitialFrames: %ld\n",h->dwInitialFrames); |
48 printf("Rate: %ld/%ld = %5.3f\n",h->dwRate,h->dwScale,(float)h->dwRate/(float)h->dwScale); | 48 mp_msg(MSGT_HEADER, verbose_level, "Rate: %ld/%ld = %5.3f\n",h->dwRate,h->dwScale,(float)h->dwRate/(float)h->dwScale); |
49 printf("Start: %ld Len: %ld\n",h->dwStart,h->dwLength); | 49 mp_msg(MSGT_HEADER, verbose_level, "Start: %ld Len: %ld\n",h->dwStart,h->dwLength); |
50 printf("Suggested BufferSize: %ld\n",h->dwSuggestedBufferSize); | 50 mp_msg(MSGT_HEADER, verbose_level, "Suggested BufferSize: %ld\n",h->dwSuggestedBufferSize); |
51 printf("Quality %ld\n",h->dwQuality); | 51 mp_msg(MSGT_HEADER, verbose_level, "Quality %ld\n",h->dwQuality); |
52 printf("Sample size: %ld\n",h->dwSampleSize); | 52 mp_msg(MSGT_HEADER, verbose_level, "Sample size: %ld\n",h->dwSampleSize); |
53 printf("==========================\n"); | 53 mp_msg(MSGT_HEADER, verbose_level, "==========================\n"); |
54 } | 54 } |
55 | 55 |
56 void print_wave_header(WAVEFORMATEX *h){ | 56 void print_wave_header(WAVEFORMATEX *h, int verbose_level){ |
57 printf("======= WAVE Format =======\n"); | 57 mp_msg(MSGT_HEADER, verbose_level, "======= WAVE Format =======\n"); |
58 printf("Format Tag: %d (0x%X)\n",h->wFormatTag,h->wFormatTag); | 58 mp_msg(MSGT_HEADER, verbose_level, "Format Tag: %d (0x%X)\n",h->wFormatTag,h->wFormatTag); |
59 printf("Channels: %d\n",h->nChannels); | 59 mp_msg(MSGT_HEADER, verbose_level, "Channels: %d\n",h->nChannels); |
60 printf("Samplerate: %ld\n",h->nSamplesPerSec); | 60 mp_msg(MSGT_HEADER, verbose_level, "Samplerate: %ld\n",h->nSamplesPerSec); |
61 printf("avg byte/sec: %ld\n",h->nAvgBytesPerSec); | 61 mp_msg(MSGT_HEADER, verbose_level, "avg byte/sec: %ld\n",h->nAvgBytesPerSec); |
62 printf("Block align: %d\n",h->nBlockAlign); | 62 mp_msg(MSGT_HEADER, verbose_level, "Block align: %d\n",h->nBlockAlign); |
63 printf("bits/sample: %d\n",h->wBitsPerSample); | 63 mp_msg(MSGT_HEADER, verbose_level, "bits/sample: %d\n",h->wBitsPerSample); |
64 printf("cbSize: %d\n",h->cbSize); | 64 mp_msg(MSGT_HEADER, verbose_level, "cbSize: %d\n",h->cbSize); |
65 if(h->wFormatTag==0x55 && h->cbSize>=12){ | 65 if(h->wFormatTag==0x55 && h->cbSize>=12){ |
66 MPEGLAYER3WAVEFORMAT* h2=(MPEGLAYER3WAVEFORMAT *)h; | 66 MPEGLAYER3WAVEFORMAT* h2=(MPEGLAYER3WAVEFORMAT *)h; |
67 printf("mp3.wID=%d\n",h2->wID); | 67 mp_msg(MSGT_HEADER, verbose_level, "mp3.wID=%d\n",h2->wID); |
68 printf("mp3.fdwFlags=0x%lX\n",h2->fdwFlags); | 68 mp_msg(MSGT_HEADER, verbose_level, "mp3.fdwFlags=0x%lX\n",h2->fdwFlags); |
69 printf("mp3.nBlockSize=%d\n",h2->nBlockSize); | 69 mp_msg(MSGT_HEADER, verbose_level, "mp3.nBlockSize=%d\n",h2->nBlockSize); |
70 printf("mp3.nFramesPerBlock=%d\n",h2->nFramesPerBlock); | 70 mp_msg(MSGT_HEADER, verbose_level, "mp3.nFramesPerBlock=%d\n",h2->nFramesPerBlock); |
71 printf("mp3.nCodecDelay=%d\n",h2->nCodecDelay); | 71 mp_msg(MSGT_HEADER, verbose_level, "mp3.nCodecDelay=%d\n",h2->nCodecDelay); |
72 } | 72 } |
73 else if (h->cbSize > 0) | 73 else if (h->cbSize > 0) |
74 { | 74 { |
75 int i; | 75 int i; |
76 uint8_t* p = ((uint8_t*)h) + sizeof(WAVEFORMATEX); | 76 uint8_t* p = ((uint8_t*)h) + sizeof(WAVEFORMATEX); |
77 printf("Unknown extra header dump: "); | 77 mp_msg(MSGT_HEADER, verbose_level, "Unknown extra header dump: "); |
78 for (i = 0; i < h->cbSize; i++) | 78 for (i = 0; i < h->cbSize; i++) |
79 printf("[%x] ", p[i]); | 79 mp_msg(MSGT_HEADER, verbose_level, "[%x] ", p[i]); |
80 printf("\n"); | 80 mp_msg(MSGT_HEADER, verbose_level, "\n"); |
81 } | 81 } |
82 printf("===========================\n"); | 82 mp_msg(MSGT_HEADER, verbose_level, "==========================================================================\n"); |
83 } | 83 } |
84 | 84 |
85 | 85 |
86 void print_video_header(BITMAPINFOHEADER *h){ | 86 void print_video_header(BITMAPINFOHEADER *h, int verbose_level){ |
87 printf("======= VIDEO Format ======\n"); | 87 mp_msg(MSGT_HEADER, verbose_level, "======= VIDEO Format ======\n"); |
88 printf(" biSize %d\n", h->biSize); | 88 mp_msg(MSGT_HEADER, verbose_level, " biSize %d\n", h->biSize); |
89 printf(" biWidth %d\n", h->biWidth); | 89 mp_msg(MSGT_HEADER, verbose_level, " biWidth %d\n", h->biWidth); |
90 printf(" biHeight %d\n", h->biHeight); | 90 mp_msg(MSGT_HEADER, verbose_level, " biHeight %d\n", h->biHeight); |
91 printf(" biPlanes %d\n", h->biPlanes); | 91 mp_msg(MSGT_HEADER, verbose_level, " biPlanes %d\n", h->biPlanes); |
92 printf(" biBitCount %d\n", h->biBitCount); | 92 mp_msg(MSGT_HEADER, verbose_level, " biBitCount %d\n", h->biBitCount); |
93 printf(" biCompression %d='%.4s'\n", h->biCompression, (char *)&h->biCompression); | 93 mp_msg(MSGT_HEADER, verbose_level, " biCompression %d='%.4s'\n", h->biCompression, (char *)&h->biCompression); |
94 printf(" biSizeImage %d\n", h->biSizeImage); | 94 mp_msg(MSGT_HEADER, verbose_level, " biSizeImage %d\n", h->biSizeImage); |
95 if (h->biSize > sizeof(BITMAPINFOHEADER)) | 95 if (h->biSize > sizeof(BITMAPINFOHEADER)) |
96 { | 96 { |
97 int i; | 97 int i; |
98 uint8_t* p = ((uint8_t*)h) + sizeof(BITMAPINFOHEADER); | 98 uint8_t* p = ((uint8_t*)h) + sizeof(BITMAPINFOHEADER); |
99 printf("Unknown extra header dump: "); | 99 mp_msg(MSGT_HEADER, verbose_level, "Unknown extra header dump: "); |
100 for (i = 0; i < h->biSize-sizeof(BITMAPINFOHEADER); i++) | 100 for (i = 0; i < h->biSize-sizeof(BITMAPINFOHEADER); i++) |
101 printf("[%x] ", *(p+i)); | 101 mp_msg(MSGT_HEADER, verbose_level, "[%x] ", *(p+i)); |
102 printf("\n"); | 102 mp_msg(MSGT_HEADER, verbose_level, "\n"); |
103 } | 103 } |
104 printf("===========================\n"); | 104 mp_msg(MSGT_HEADER, verbose_level, "===========================\n"); |
105 } | 105 } |
106 | 106 |
107 void print_vprp(VideoPropHeader *vprp){ | 107 void print_vprp(VideoPropHeader *vprp, int verbose_level){ |
108 int i; | 108 int i; |
109 printf("======= Video Properties Header =======\n"); | 109 mp_msg(MSGT_HEADER, verbose_level, "======= Video Properties Header =======\n"); |
110 printf("Format: %d VideoStandard: %d\n", | 110 mp_msg(MSGT_HEADER, verbose_level, "Format: %d VideoStandard: %d\n", |
111 vprp->VideoFormatToken,vprp->VideoStandard); | 111 vprp->VideoFormatToken,vprp->VideoStandard); |
112 printf("VRefresh: %d HTotal: %d VTotal: %d\n", | 112 mp_msg(MSGT_HEADER, verbose_level, "VRefresh: %d HTotal: %d VTotal: %d\n", |
113 vprp->dwVerticalRefreshRate, vprp->dwHTotalInT, vprp->dwVTotalInLines); | 113 vprp->dwVerticalRefreshRate, vprp->dwHTotalInT, vprp->dwVTotalInLines); |
114 printf("FrameAspect: %d:%d Framewidth: %d Frameheight: %d\n", | 114 mp_msg(MSGT_HEADER, verbose_level, "FrameAspect: %d:%d Framewidth: %d Frameheight: %d\n", |
115 vprp->dwFrameAspectRatio >> 16, vprp->dwFrameAspectRatio & 0xffff, | 115 vprp->dwFrameAspectRatio >> 16, vprp->dwFrameAspectRatio & 0xffff, |
116 vprp->dwFrameWidthInPixels, vprp->dwFrameHeightInLines); | 116 vprp->dwFrameWidthInPixels, vprp->dwFrameHeightInLines); |
117 printf("Fields: %d\n", vprp->nbFieldPerFrame); | 117 mp_msg(MSGT_HEADER, verbose_level, "Fields: %d\n", vprp->nbFieldPerFrame); |
118 for (i=0; i<vprp->nbFieldPerFrame; i++) { | 118 for (i=0; i<vprp->nbFieldPerFrame; i++) { |
119 VIDEO_FIELD_DESC *vfd = &vprp->FieldInfo[i]; | 119 VIDEO_FIELD_DESC *vfd = &vprp->FieldInfo[i]; |
120 printf(" == Field %d description ==\n", i); | 120 mp_msg(MSGT_HEADER, verbose_level, " == Field %d description ==\n", i); |
121 printf(" CompressedBMHeight: %d CompressedBMWidth: %d\n", | 121 mp_msg(MSGT_HEADER, verbose_level, " CompressedBMHeight: %d CompressedBMWidth: %d\n", |
122 vfd->CompressedBMHeight, vfd->CompressedBMWidth); | 122 vfd->CompressedBMHeight, vfd->CompressedBMWidth); |
123 printf(" ValidBMHeight: %d ValidBMWidth: %d\n", | 123 mp_msg(MSGT_HEADER, verbose_level, " ValidBMHeight: %d ValidBMWidth: %d\n", |
124 vfd->ValidBMHeight, vfd->ValidBMWidth); | 124 vfd->ValidBMHeight, vfd->ValidBMWidth); |
125 printf(" ValidBMXOffset: %d ValidBMYOffset: %d\n", | 125 mp_msg(MSGT_HEADER, verbose_level, " ValidBMXOffset: %d ValidBMYOffset: %d\n", |
126 vfd->ValidBMXOffset, vfd->ValidBMYOffset); | 126 vfd->ValidBMXOffset, vfd->ValidBMYOffset); |
127 printf(" VideoXOffsetInT: %d VideoYValidStartLine: %d\n", | 127 mp_msg(MSGT_HEADER, verbose_level, " VideoXOffsetInT: %d VideoYValidStartLine: %d\n", |
128 vfd->VideoXOffsetInT, vfd->VideoYValidStartLine); | 128 vfd->VideoXOffsetInT, vfd->VideoYValidStartLine); |
129 } | 129 } |
130 printf("=======================================\n"); | 130 mp_msg(MSGT_HEADER, verbose_level, "=======================================\n"); |
131 } | 131 } |
132 | 132 |
133 void print_index(AVIINDEXENTRY *idx,int idx_size){ | 133 void print_index(AVIINDEXENTRY *idx, int idx_size, int verbose_level){ |
134 int i; | 134 int i; |
135 unsigned int pos[256]; | 135 unsigned int pos[256]; |
136 unsigned int num[256]; | 136 unsigned int num[256]; |
137 for(i=0;i<256;i++) num[i]=pos[i]=0; | 137 for(i=0;i<256;i++) num[i]=pos[i]=0; |
138 for(i=0;i<idx_size;i++){ | 138 for(i=0;i<idx_size;i++){ |
139 int id=avi_stream_id(idx[i].ckid); | 139 int id=avi_stream_id(idx[i].ckid); |
140 if(id<0 || id>255) id=255; | 140 if(id<0 || id>255) id=255; |
141 printf("%5d: %.4s %4X %016llX len:%6ld pos:%7d->%7.3f %7d->%7.3f\n",i, | 141 mp_msg(MSGT_HEADER, verbose_level, "%5d: %.4s %4X %016llX len:%6ld pos:%7d->%7.3f %7d->%7.3f\n",i, |
142 (char *)&idx[i].ckid, | 142 (char *)&idx[i].ckid, |
143 (unsigned int)idx[i].dwFlags&0xffff, | 143 (unsigned int)idx[i].dwFlags&0xffff, |
144 (uint64_t)AVI_IDX_OFFSET(&idx[i]), | 144 (uint64_t)AVI_IDX_OFFSET(&idx[i]), |
145 // idx[i].dwChunkOffset+demuxer->movi_start, | 145 // idx[i].dwChunkOffset+demuxer->movi_start, |
146 idx[i].dwChunkLength, | 146 idx[i].dwChunkLength, |
150 pos[id]+=idx[i].dwChunkLength; | 150 pos[id]+=idx[i].dwChunkLength; |
151 ++num[id]; | 151 ++num[id]; |
152 } | 152 } |
153 } | 153 } |
154 | 154 |
155 void print_avistdindex_chunk(avistdindex_chunk *h){ | 155 void print_avistdindex_chunk(avistdindex_chunk *h, int verbose_level){ |
156 mp_msg (MSGT_HEADER, MSGL_V, "====== AVI Standard Index Header ========\n"); | 156 mp_msg (MSGT_HEADER, verbose_level, "====== AVI Standard Index Header ========\n"); |
157 mp_msg (MSGT_HEADER, MSGL_V, " FCC (%.4s) dwSize (%d) wLongsPerEntry(%d)\n", h->fcc, h->dwSize, h->wLongsPerEntry); | 157 mp_msg (MSGT_HEADER, verbose_level, " FCC (%.4s) dwSize (%d) wLongsPerEntry(%d)\n", h->fcc, h->dwSize, h->wLongsPerEntry); |
158 mp_msg (MSGT_HEADER, MSGL_V, " bIndexSubType (%d) bIndexType (%d)\n", h->bIndexSubType, h->bIndexType); | 158 mp_msg (MSGT_HEADER, verbose_level, " bIndexSubType (%d) bIndexType (%d)\n", h->bIndexSubType, h->bIndexType); |
159 mp_msg (MSGT_HEADER, MSGL_V, " nEntriesInUse (%d) dwChunkId (%.4s)\n", h->nEntriesInUse, h->dwChunkId); | 159 mp_msg (MSGT_HEADER, verbose_level, " nEntriesInUse (%d) dwChunkId (%.4s)\n", h->nEntriesInUse, h->dwChunkId); |
160 mp_msg (MSGT_HEADER, MSGL_V, " qwBaseOffset (0x%"PRIX64") dwReserved3 (%d)\n", h->qwBaseOffset, h->dwReserved3); | 160 mp_msg (MSGT_HEADER, verbose_level, " qwBaseOffset (0x%"PRIX64") dwReserved3 (%d)\n", h->qwBaseOffset, h->dwReserved3); |
161 mp_msg (MSGT_HEADER, MSGL_V, "===========================\n"); | 161 mp_msg (MSGT_HEADER, verbose_level, "===========================\n"); |
162 } | 162 } |
163 void print_avisuperindex_chunk(avisuperindex_chunk *h){ | 163 void print_avisuperindex_chunk(avisuperindex_chunk *h, int verbose_level){ |
164 mp_msg (MSGT_HEADER, MSGL_V, "====== AVI Super Index Header ========\n"); | 164 mp_msg (MSGT_HEADER, verbose_level, "====== AVI Super Index Header ========\n"); |
165 mp_msg (MSGT_HEADER, MSGL_V, " FCC (%.4s) dwSize (%d) wLongsPerEntry(%d)\n", h->fcc, h->dwSize, h->wLongsPerEntry); | 165 mp_msg (MSGT_HEADER, verbose_level, " FCC (%.4s) dwSize (%d) wLongsPerEntry(%d)\n", h->fcc, h->dwSize, h->wLongsPerEntry); |
166 mp_msg (MSGT_HEADER, MSGL_V, " bIndexSubType (%d) bIndexType (%d)\n", h->bIndexSubType, h->bIndexType); | 166 mp_msg (MSGT_HEADER, verbose_level, " bIndexSubType (%d) bIndexType (%d)\n", h->bIndexSubType, h->bIndexType); |
167 mp_msg (MSGT_HEADER, MSGL_V, " nEntriesInUse (%d) dwChunkId (%.4s)\n", h->nEntriesInUse, h->dwChunkId); | 167 mp_msg (MSGT_HEADER, verbose_level, " nEntriesInUse (%d) dwChunkId (%.4s)\n", h->nEntriesInUse, h->dwChunkId); |
168 mp_msg (MSGT_HEADER, MSGL_V, " dwReserved[0] (%d) dwReserved[1] (%d) dwReserved[2] (%d)\n", | 168 mp_msg (MSGT_HEADER, verbose_level, " dwReserved[0] (%d) dwReserved[1] (%d) dwReserved[2] (%d)\n", |
169 h->dwReserved[0], h->dwReserved[1], h->dwReserved[2]); | 169 h->dwReserved[0], h->dwReserved[1], h->dwReserved[2]); |
170 mp_msg (MSGT_HEADER, MSGL_V, "===========================\n"); | 170 mp_msg (MSGT_HEADER, verbose_level, "===========================\n"); |
171 } | 171 } |
172 | 172 |