2001-04-23 03:42:17 +00:00
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
2001-08-01 09:14:02 +00:00
|
|
|
#include <unistd.h>
|
2001-04-23 03:42:17 +00:00
|
|
|
|
2001-10-30 17:03:11 +00:00
|
|
|
#include "config.h"
|
|
|
|
|
2002-09-22 00:43:14 +00:00
|
|
|
// for avi_stream_id():
|
2001-04-23 03:42:17 +00:00
|
|
|
#include "stream.h"
|
|
|
|
#include "demuxer.h"
|
|
|
|
|
|
|
|
#include "wine/mmreg.h"
|
|
|
|
#include "wine/avifmt.h"
|
|
|
|
#include "wine/vfw.h"
|
|
|
|
|
|
|
|
//#include "codec-cfg.h"
|
|
|
|
//#include "stheader.h"
|
|
|
|
|
2001-08-06 23:59:50 +00:00
|
|
|
void print_avih_flags(MainAVIHeader *h){
|
|
|
|
printf("MainAVIHeader.dwFlags: (%ld)%s%s%s%s%s%s\n",h->dwFlags,
|
2001-02-24 20:28:24 +00:00
|
|
|
(h->dwFlags&AVIF_HASINDEX)?" HAS_INDEX":"",
|
|
|
|
(h->dwFlags&AVIF_MUSTUSEINDEX)?" MUST_USE_INDEX":"",
|
|
|
|
(h->dwFlags&AVIF_ISINTERLEAVED)?" IS_INTERLEAVED":"",
|
|
|
|
(h->dwFlags&AVIF_TRUSTCKTYPE)?" TRUST_CKTYPE":"",
|
|
|
|
(h->dwFlags&AVIF_WASCAPTUREFILE)?" WAS_CAPTUREFILE":"",
|
|
|
|
(h->dwFlags&AVIF_COPYRIGHTED)?" COPYRIGHTED":""
|
|
|
|
);
|
2001-08-06 23:59:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void print_avih(MainAVIHeader *h){
|
|
|
|
printf("======= AVI Header =======\n");
|
|
|
|
printf("us/frame: %ld (fps=%5.3f)\n",h->dwMicroSecPerFrame,1000000.0f/(float)h->dwMicroSecPerFrame);
|
|
|
|
printf("max bytes/sec: %ld\n",h->dwMaxBytesPerSec);
|
|
|
|
printf("padding: %ld\n",h->dwPaddingGranularity);
|
|
|
|
print_avih_flags(h);
|
2001-04-23 23:04:02 +00:00
|
|
|
printf("frames total: %ld initial: %ld\n",h->dwTotalFrames,h->dwInitialFrames);
|
|
|
|
printf("streams: %ld\n",h->dwStreams);
|
|
|
|
printf("Suggested BufferSize: %ld\n",h->dwSuggestedBufferSize);
|
|
|
|
printf("Size: %ld x %ld\n",h->dwWidth,h->dwHeight);
|
2001-02-24 20:28:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void print_strh(AVIStreamHeader *h){
|
|
|
|
printf("======= STREAM Header =======\n");
|
2001-04-23 23:04:02 +00:00
|
|
|
printf("Type: %.4s FCC: %.4s (%X)\n",(char *)&h->fccType,(char *)&h->fccHandler,(unsigned int)h->fccHandler);
|
|
|
|
printf("Flags: %ld\n",h->dwFlags);
|
2001-02-24 20:28:24 +00:00
|
|
|
printf("Priority: %d Language: %d\n",h->wPriority,h->wLanguage);
|
2001-04-23 23:04:02 +00:00
|
|
|
printf("InitialFrames: %ld\n",h->dwInitialFrames);
|
|
|
|
printf("Rate: %ld/%ld = %5.3f\n",h->dwRate,h->dwScale,(float)h->dwRate/(float)h->dwScale);
|
|
|
|
printf("Start: %ld Len: %ld\n",h->dwStart,h->dwLength);
|
|
|
|
printf("Suggested BufferSize: %ld\n",h->dwSuggestedBufferSize);
|
|
|
|
printf("Quality %ld\n",h->dwQuality);
|
|
|
|
printf("Sample size: %ld\n",h->dwSampleSize);
|
2001-02-24 20:28:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void print_wave_header(WAVEFORMATEX *h){
|
|
|
|
printf("======= WAVE Format =======\n");
|
|
|
|
printf("Format Tag: %d (0x%X)\n",h->wFormatTag,h->wFormatTag);
|
|
|
|
printf("Channels: %d\n",h->nChannels);
|
2001-04-23 23:04:02 +00:00
|
|
|
printf("Samplerate: %ld\n",h->nSamplesPerSec);
|
|
|
|
printf("avg byte/sec: %ld\n",h->nAvgBytesPerSec);
|
2001-02-24 20:28:24 +00:00
|
|
|
printf("Block align: %d\n",h->nBlockAlign);
|
|
|
|
printf("bits/sample: %d\n",h->wBitsPerSample);
|
|
|
|
printf("cbSize: %d\n",h->cbSize);
|
2002-04-19 23:24:13 +00:00
|
|
|
if(h->wFormatTag==0x55 && h->cbSize>=12){
|
2002-08-28 22:45:48 +00:00
|
|
|
MPEGLAYER3WAVEFORMAT* h2=(MPEGLAYER3WAVEFORMAT *)h;
|
2002-04-18 18:01:25 +00:00
|
|
|
printf("mp3.wID=%d\n",h2->wID);
|
2002-11-06 23:54:29 +00:00
|
|
|
printf("mp3.fdwFlags=0x%lX\n",h2->fdwFlags);
|
2002-04-18 18:01:25 +00:00
|
|
|
printf("mp3.nBlockSize=%d\n",h2->nBlockSize);
|
|
|
|
printf("mp3.nFramesPerBlock=%d\n",h2->nFramesPerBlock);
|
|
|
|
printf("mp3.nCodecDelay=%d\n",h2->nCodecDelay);
|
|
|
|
}
|
2002-04-21 10:27:29 +00:00
|
|
|
else if (h->cbSize > 0)
|
|
|
|
{
|
|
|
|
int i;
|
2002-04-29 13:31:17 +00:00
|
|
|
uint8_t* p = ((uint8_t*)h) + sizeof(WAVEFORMATEX);
|
2002-04-21 10:27:29 +00:00
|
|
|
printf("Unknown extra header dump: ");
|
|
|
|
for (i = 0; i < h->cbSize; i++)
|
2002-04-29 13:31:17 +00:00
|
|
|
printf("[%x] ", *(p+i));
|
2002-04-21 10:27:29 +00:00
|
|
|
printf("\n");
|
|
|
|
}
|
2001-02-24 20:28:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void print_video_header(BITMAPINFOHEADER *h){
|
|
|
|
printf("======= VIDEO Format ======\n");
|
2002-11-06 23:54:29 +00:00
|
|
|
printf(" biSize %d\n", h->biSize);
|
|
|
|
printf(" biWidth %d\n", h->biWidth);
|
|
|
|
printf(" biHeight %d\n", h->biHeight);
|
2001-02-24 20:28:24 +00:00
|
|
|
printf(" biPlanes %d\n", h->biPlanes);
|
|
|
|
printf(" biBitCount %d\n", h->biBitCount);
|
2002-11-06 23:54:29 +00:00
|
|
|
printf(" biCompression %d='%.4s'\n", h->biCompression, (char *)&h->biCompression);
|
|
|
|
printf(" biSizeImage %d\n", h->biSizeImage);
|
2001-02-24 20:28:24 +00:00
|
|
|
printf("===========================\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-04-23 03:42:17 +00:00
|
|
|
void print_index(AVIINDEXENTRY *idx,int idx_size){
|
2001-02-24 20:28:24 +00:00
|
|
|
int i;
|
2001-08-11 20:37:33 +00:00
|
|
|
unsigned int pos[256];
|
|
|
|
unsigned int num[256];
|
|
|
|
for(i=0;i<256;i++) num[i]=pos[i]=0;
|
2001-04-23 03:42:17 +00:00
|
|
|
for(i=0;i<idx_size;i++){
|
2001-08-11 20:37:33 +00:00
|
|
|
int id=avi_stream_id(idx[i].ckid);
|
|
|
|
if(id<0 || id>255) id=255;
|
|
|
|
printf("%5d: %.4s %4X %08X len:%6ld pos:%7d->%7.3f %7d->%7.3f\n",i,
|
2001-04-23 23:04:02 +00:00
|
|
|
(char *)&idx[i].ckid,
|
|
|
|
(unsigned int)idx[i].dwFlags,
|
|
|
|
(unsigned int)idx[i].dwChunkOffset,
|
2001-04-23 03:42:17 +00:00
|
|
|
// idx[i].dwChunkOffset+demuxer->movi_start,
|
2001-08-11 20:37:33 +00:00
|
|
|
idx[i].dwChunkLength,
|
|
|
|
pos[id],(float)pos[id]/18747.0f,
|
|
|
|
num[id],(float)num[id]/23.976f
|
2001-02-24 20:28:24 +00:00
|
|
|
);
|
2001-08-11 20:37:33 +00:00
|
|
|
pos[id]+=idx[i].dwChunkLength;
|
|
|
|
++num[id];
|
2001-02-24 20:28:24 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|