annotate dll_init.c @ 343:ec7b16345547

-zoom added.
author se7encode
date Wed, 11 Apr 2001 09:12:42 +0000
parents 828ec81e0d64
children b61c5c4484f8
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1 // ACM audio and VfW video codecs initialization
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2 // based on the avifile library [http://divx.euro.ru]
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
3
296
c3d7a28a0d1a audio init moved to dec_audio.c
arpi_esp
parents: 291
diff changeset
4 int init_acm_audio_codec(sh_audio_t *sh_audio){
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
5 HRESULT ret;
291
da98e96499bb sh_audio/sh_video added, general codec cleanup
arpi_esp
parents: 92
diff changeset
6 WAVEFORMATEX *in_fmt=&sh_audio->wf;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
7 unsigned long srcsize=0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
8
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
9 if(verbose) printf("======= Win32 (ACM) AUDIO Codec init =======\n");
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
10
291
da98e96499bb sh_audio/sh_video added, general codec cleanup
arpi_esp
parents: 92
diff changeset
11 sh_audio->srcstream=NULL;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
12
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
13 // if(in_fmt->nSamplesPerSec==0){ printf("Bad WAVE header!\n");exit(1); }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
14 // MSACM_RegisterAllDrivers();
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
15
291
da98e96499bb sh_audio/sh_video added, general codec cleanup
arpi_esp
parents: 92
diff changeset
16 sh_audio->o_wf.nChannels=in_fmt->nChannels;
da98e96499bb sh_audio/sh_video added, general codec cleanup
arpi_esp
parents: 92
diff changeset
17 sh_audio->o_wf.nSamplesPerSec=in_fmt->nSamplesPerSec;
da98e96499bb sh_audio/sh_video added, general codec cleanup
arpi_esp
parents: 92
diff changeset
18 sh_audio->o_wf.nAvgBytesPerSec=2*sh_audio->o_wf.nSamplesPerSec*sh_audio->o_wf.nChannels;
da98e96499bb sh_audio/sh_video added, general codec cleanup
arpi_esp
parents: 92
diff changeset
19 sh_audio->o_wf.wFormatTag=WAVE_FORMAT_PCM;
da98e96499bb sh_audio/sh_video added, general codec cleanup
arpi_esp
parents: 92
diff changeset
20 sh_audio->o_wf.nBlockAlign=2*in_fmt->nChannels;
da98e96499bb sh_audio/sh_video added, general codec cleanup
arpi_esp
parents: 92
diff changeset
21 sh_audio->o_wf.wBitsPerSample=16;
da98e96499bb sh_audio/sh_video added, general codec cleanup
arpi_esp
parents: 92
diff changeset
22 sh_audio->o_wf.cbSize=0;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
23
303
828ec81e0d64 codecs.conf support
arpi_esp
parents: 296
diff changeset
24 win32_codec_name = sh_audio->codec->dll;
291
da98e96499bb sh_audio/sh_video added, general codec cleanup
arpi_esp
parents: 92
diff changeset
25 ret=acmStreamOpen(&sh_audio->srcstream,(HACMDRIVER)NULL,
da98e96499bb sh_audio/sh_video added, general codec cleanup
arpi_esp
parents: 92
diff changeset
26 in_fmt,&sh_audio->o_wf,
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
27 NULL,0,0,0);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
28 if(ret){
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
29 if(ret==ACMERR_NOTPOSSIBLE)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
30 printf("ACM_Decoder: Unappropriate audio format\n");
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
31 else
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
32 printf("ACM_Decoder: acmStreamOpen error %d", ret);
291
da98e96499bb sh_audio/sh_video added, general codec cleanup
arpi_esp
parents: 92
diff changeset
33 sh_audio->srcstream=NULL;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
34 return 0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
35 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
36 if(verbose) printf("Audio codec opened OK! ;-)\n");
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
37
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
38 srcsize=in_fmt->nBlockAlign;
291
da98e96499bb sh_audio/sh_video added, general codec cleanup
arpi_esp
parents: 92
diff changeset
39 acmStreamSize(sh_audio->srcstream, srcsize, &srcsize, ACM_STREAMSIZEF_SOURCE);
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
40 if(srcsize<OUTBURST) srcsize=OUTBURST;
291
da98e96499bb sh_audio/sh_video added, general codec cleanup
arpi_esp
parents: 92
diff changeset
41 sh_audio->audio_out_minsize=srcsize; // audio output min. size
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
42 if(verbose) printf("Audio ACM output buffer min. size: %d\n",srcsize);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
43
291
da98e96499bb sh_audio/sh_video added, general codec cleanup
arpi_esp
parents: 92
diff changeset
44 acmStreamSize(sh_audio->srcstream, srcsize, &srcsize, ACM_STREAMSIZEF_DESTINATION);
da98e96499bb sh_audio/sh_video added, general codec cleanup
arpi_esp
parents: 92
diff changeset
45 sh_audio->audio_in_minsize=srcsize; // audio input min. size
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
46 if(verbose) printf("Audio ACM input buffer min. size: %d\n",srcsize);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
47
291
da98e96499bb sh_audio/sh_video added, general codec cleanup
arpi_esp
parents: 92
diff changeset
48 sh_audio->a_in_buffer_size=sh_audio->audio_in_minsize;
da98e96499bb sh_audio/sh_video added, general codec cleanup
arpi_esp
parents: 92
diff changeset
49 sh_audio->a_in_buffer=malloc(sh_audio->a_in_buffer_size);
da98e96499bb sh_audio/sh_video added, general codec cleanup
arpi_esp
parents: 92
diff changeset
50 sh_audio->a_in_buffer_len=0;
92
92776006958f ACM code cleanup, nosound at ACM error
arpi_esp
parents: 1
diff changeset
51
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
52 return 1;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
53 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
54
291
da98e96499bb sh_audio/sh_video added, general codec cleanup
arpi_esp
parents: 92
diff changeset
55 int acm_decode_audio(sh_audio_t *sh_audio, void* a_buffer,int len){
92
92776006958f ACM code cleanup, nosound at ACM error
arpi_esp
parents: 1
diff changeset
56 ACMSTREAMHEADER ash;
92776006958f ACM code cleanup, nosound at ACM error
arpi_esp
parents: 1
diff changeset
57 HRESULT hr;
92776006958f ACM code cleanup, nosound at ACM error
arpi_esp
parents: 1
diff changeset
58 DWORD srcsize=0;
291
da98e96499bb sh_audio/sh_video added, general codec cleanup
arpi_esp
parents: 92
diff changeset
59 acmStreamSize(sh_audio->srcstream,len , &srcsize, ACM_STREAMSIZEF_DESTINATION);
da98e96499bb sh_audio/sh_video added, general codec cleanup
arpi_esp
parents: 92
diff changeset
60 if(verbose>=3)printf("acm says: srcsize=%d (buffsize=%d) out_size=%d\n",srcsize,sh_audio->a_in_buffer_size,len);
da98e96499bb sh_audio/sh_video added, general codec cleanup
arpi_esp
parents: 92
diff changeset
61 // if(srcsize==0) srcsize=((WAVEFORMATEX *)&sh_audio->o_wf_ext)->nBlockAlign;
da98e96499bb sh_audio/sh_video added, general codec cleanup
arpi_esp
parents: 92
diff changeset
62 if(srcsize>sh_audio->a_in_buffer_size) srcsize=sh_audio->a_in_buffer_size; // !!!!!!
da98e96499bb sh_audio/sh_video added, general codec cleanup
arpi_esp
parents: 92
diff changeset
63 if(sh_audio->a_in_buffer_len<srcsize){
da98e96499bb sh_audio/sh_video added, general codec cleanup
arpi_esp
parents: 92
diff changeset
64 sh_audio->a_in_buffer_len+=
da98e96499bb sh_audio/sh_video added, general codec cleanup
arpi_esp
parents: 92
diff changeset
65 demux_read_data(sh_audio->ds,&sh_audio->a_in_buffer[sh_audio->a_in_buffer_len],
da98e96499bb sh_audio/sh_video added, general codec cleanup
arpi_esp
parents: 92
diff changeset
66 srcsize-sh_audio->a_in_buffer_len);
92
92776006958f ACM code cleanup, nosound at ACM error
arpi_esp
parents: 1
diff changeset
67 }
92776006958f ACM code cleanup, nosound at ACM error
arpi_esp
parents: 1
diff changeset
68 memset(&ash, 0, sizeof(ash));
92776006958f ACM code cleanup, nosound at ACM error
arpi_esp
parents: 1
diff changeset
69 ash.cbStruct=sizeof(ash);
92776006958f ACM code cleanup, nosound at ACM error
arpi_esp
parents: 1
diff changeset
70 ash.fdwStatus=0;
92776006958f ACM code cleanup, nosound at ACM error
arpi_esp
parents: 1
diff changeset
71 ash.dwUser=0;
291
da98e96499bb sh_audio/sh_video added, general codec cleanup
arpi_esp
parents: 92
diff changeset
72 ash.pbSrc=sh_audio->a_in_buffer;
da98e96499bb sh_audio/sh_video added, general codec cleanup
arpi_esp
parents: 92
diff changeset
73 ash.cbSrcLength=sh_audio->a_in_buffer_len;
92
92776006958f ACM code cleanup, nosound at ACM error
arpi_esp
parents: 1
diff changeset
74 ash.pbDst=a_buffer;
92776006958f ACM code cleanup, nosound at ACM error
arpi_esp
parents: 1
diff changeset
75 ash.cbDstLength=len;
291
da98e96499bb sh_audio/sh_video added, general codec cleanup
arpi_esp
parents: 92
diff changeset
76 hr=acmStreamPrepareHeader(sh_audio->srcstream,&ash,0);
92
92776006958f ACM code cleanup, nosound at ACM error
arpi_esp
parents: 1
diff changeset
77 if(hr){
92776006958f ACM code cleanup, nosound at ACM error
arpi_esp
parents: 1
diff changeset
78 printf("ACM_Decoder: acmStreamPrepareHeader error %d\n",hr);
92776006958f ACM code cleanup, nosound at ACM error
arpi_esp
parents: 1
diff changeset
79 return -1;
92776006958f ACM code cleanup, nosound at ACM error
arpi_esp
parents: 1
diff changeset
80 }
291
da98e96499bb sh_audio/sh_video added, general codec cleanup
arpi_esp
parents: 92
diff changeset
81 hr=acmStreamConvert(sh_audio->srcstream,&ash,0);
92
92776006958f ACM code cleanup, nosound at ACM error
arpi_esp
parents: 1
diff changeset
82 if(hr){
92776006958f ACM code cleanup, nosound at ACM error
arpi_esp
parents: 1
diff changeset
83 printf("ACM_Decoder: acmStreamConvert error %d\n",hr);
92776006958f ACM code cleanup, nosound at ACM error
arpi_esp
parents: 1
diff changeset
84 return -1;
92776006958f ACM code cleanup, nosound at ACM error
arpi_esp
parents: 1
diff changeset
85 }
92776006958f ACM code cleanup, nosound at ACM error
arpi_esp
parents: 1
diff changeset
86 //printf("ACM convert %d -> %d (buf=%d)\n",ash.cbSrcLengthUsed,ash.cbDstLengthUsed,a_in_buffer_len);
291
da98e96499bb sh_audio/sh_video added, general codec cleanup
arpi_esp
parents: 92
diff changeset
87 if(ash.cbSrcLengthUsed>=sh_audio->a_in_buffer_len){
da98e96499bb sh_audio/sh_video added, general codec cleanup
arpi_esp
parents: 92
diff changeset
88 sh_audio->a_in_buffer_len=0;
92
92776006958f ACM code cleanup, nosound at ACM error
arpi_esp
parents: 1
diff changeset
89 } else {
291
da98e96499bb sh_audio/sh_video added, general codec cleanup
arpi_esp
parents: 92
diff changeset
90 sh_audio->a_in_buffer_len-=ash.cbSrcLengthUsed;
da98e96499bb sh_audio/sh_video added, general codec cleanup
arpi_esp
parents: 92
diff changeset
91 memcpy(sh_audio->a_in_buffer,&sh_audio->a_in_buffer[ash.cbSrcLengthUsed],sh_audio->a_in_buffer_len);
92
92776006958f ACM code cleanup, nosound at ACM error
arpi_esp
parents: 1
diff changeset
92 }
92776006958f ACM code cleanup, nosound at ACM error
arpi_esp
parents: 1
diff changeset
93 len=ash.cbDstLengthUsed;
291
da98e96499bb sh_audio/sh_video added, general codec cleanup
arpi_esp
parents: 92
diff changeset
94 hr=acmStreamUnprepareHeader(sh_audio->srcstream,&ash,0);
92
92776006958f ACM code cleanup, nosound at ACM error
arpi_esp
parents: 1
diff changeset
95 if(hr){
92776006958f ACM code cleanup, nosound at ACM error
arpi_esp
parents: 1
diff changeset
96 printf("ACM_Decoder: acmStreamUnprepareHeader error %d\n",hr);
92776006958f ACM code cleanup, nosound at ACM error
arpi_esp
parents: 1
diff changeset
97 }
92776006958f ACM code cleanup, nosound at ACM error
arpi_esp
parents: 1
diff changeset
98 return len;
92776006958f ACM code cleanup, nosound at ACM error
arpi_esp
parents: 1
diff changeset
99 }
92776006958f ACM code cleanup, nosound at ACM error
arpi_esp
parents: 1
diff changeset
100
92776006958f ACM code cleanup, nosound at ACM error
arpi_esp
parents: 1
diff changeset
101
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
102
303
828ec81e0d64 codecs.conf support
arpi_esp
parents: 296
diff changeset
103 int init_video_codec(){
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
104 HRESULT ret;
303
828ec81e0d64 codecs.conf support
arpi_esp
parents: 296
diff changeset
105 unsigned int outfmt=sh_video->codec->outfmt[sh_video->outfmtidx];
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
106
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
107 if(verbose) printf("======= Win32 (VFW) VIDEO Codec init =======\n");
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
108
291
da98e96499bb sh_audio/sh_video added, general codec cleanup
arpi_esp
parents: 92
diff changeset
109 memset(&sh_video->o_bih, 0, sizeof(BITMAPINFOHEADER));
da98e96499bb sh_audio/sh_video added, general codec cleanup
arpi_esp
parents: 92
diff changeset
110 sh_video->o_bih.biSize = sizeof(BITMAPINFOHEADER);
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
111
303
828ec81e0d64 codecs.conf support
arpi_esp
parents: 296
diff changeset
112 win32_codec_name = sh_video->codec->dll;
291
da98e96499bb sh_audio/sh_video added, general codec cleanup
arpi_esp
parents: 92
diff changeset
113 sh_video->hic = ICOpen( 0x63646976, sh_video->bih.biCompression, ICMODE_FASTDECOMPRESS);
da98e96499bb sh_audio/sh_video added, general codec cleanup
arpi_esp
parents: 92
diff changeset
114 // sh_video->hic = ICOpen( 0x63646976, sh_video->bih.biCompression, ICMODE_DECOMPRESS);
da98e96499bb sh_audio/sh_video added, general codec cleanup
arpi_esp
parents: 92
diff changeset
115 if(!sh_video->hic){
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
116 printf("ICOpen failed! unknown codec / wrong parameters?\n");
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
117 return 0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
118 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
119
291
da98e96499bb sh_audio/sh_video added, general codec cleanup
arpi_esp
parents: 92
diff changeset
120 // sh_video->bih.biBitCount=32;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
121
291
da98e96499bb sh_audio/sh_video added, general codec cleanup
arpi_esp
parents: 92
diff changeset
122 ret = ICDecompressGetFormat(sh_video->hic, &sh_video->bih, &sh_video->o_bih);
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
123 if(ret){
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
124 printf("ICDecompressGetFormat failed: Error %d\n", ret);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
125 return 0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
126 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
127 if(verbose) printf("ICDecompressGetFormat OK\n");
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
128
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
129 // printf("ICM_DECOMPRESS_QUERY=0x%X",ICM_DECOMPRESS_QUERY);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
130
291
da98e96499bb sh_audio/sh_video added, general codec cleanup
arpi_esp
parents: 92
diff changeset
131 // sh_video->o_bih.biWidth=sh_video->bih.biWidth;
da98e96499bb sh_audio/sh_video added, general codec cleanup
arpi_esp
parents: 92
diff changeset
132 // sh_video->o_bih.biCompression = 0x32315659; // mmioFOURCC('U','Y','V','Y');
da98e96499bb sh_audio/sh_video added, general codec cleanup
arpi_esp
parents: 92
diff changeset
133 // ret=ICDecompressGetFormatSize(sh_video->hic,&sh_video->o_bih);
da98e96499bb sh_audio/sh_video added, general codec cleanup
arpi_esp
parents: 92
diff changeset
134 // sh_video->o_bih.biCompression = 3; //0x32315659;
da98e96499bb sh_audio/sh_video added, general codec cleanup
arpi_esp
parents: 92
diff changeset
135 // sh_video->o_bih.biCompression = mmioFOURCC('U','Y','V','Y');
da98e96499bb sh_audio/sh_video added, general codec cleanup
arpi_esp
parents: 92
diff changeset
136 // sh_video->o_bih.biCompression = mmioFOURCC('U','Y','V','Y');
da98e96499bb sh_audio/sh_video added, general codec cleanup
arpi_esp
parents: 92
diff changeset
137 // sh_video->o_bih.biCompression = mmioFOURCC('Y','U','Y','2');
da98e96499bb sh_audio/sh_video added, general codec cleanup
arpi_esp
parents: 92
diff changeset
138 // sh_video->o_bih.biPlanes=3;
da98e96499bb sh_audio/sh_video added, general codec cleanup
arpi_esp
parents: 92
diff changeset
139 // sh_video->o_bih.biBitCount=16;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
140
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
141 if(outfmt==IMGFMT_YUY2)
291
da98e96499bb sh_audio/sh_video added, general codec cleanup
arpi_esp
parents: 92
diff changeset
142 sh_video->o_bih.biBitCount=16;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
143 else
291
da98e96499bb sh_audio/sh_video added, general codec cleanup
arpi_esp
parents: 92
diff changeset
144 sh_video->o_bih.biBitCount=outfmt&0xFF;// //24;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
145
303
828ec81e0d64 codecs.conf support
arpi_esp
parents: 296
diff changeset
146 if(sh_video->o_bih.biBitCount==15) ++sh_video->o_bih.biBitCount;
828ec81e0d64 codecs.conf support
arpi_esp
parents: 296
diff changeset
147
291
da98e96499bb sh_audio/sh_video added, general codec cleanup
arpi_esp
parents: 92
diff changeset
148 sh_video->o_bih.biSizeImage=sh_video->o_bih.biWidth*sh_video->o_bih.biHeight*(sh_video->o_bih.biBitCount/8);
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
149
303
828ec81e0d64 codecs.conf support
arpi_esp
parents: 296
diff changeset
150 if(!(sh_video->codec->outflags[sh_video->outfmtidx]&CODECS_FLAG_FLIP))
291
da98e96499bb sh_audio/sh_video added, general codec cleanup
arpi_esp
parents: 92
diff changeset
151 sh_video->o_bih.biHeight=-sh_video->bih.biHeight; // flip image!
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
152
303
828ec81e0d64 codecs.conf support
arpi_esp
parents: 296
diff changeset
153 if(outfmt==IMGFMT_YUY2 && !(sh_video->codec->outflags[sh_video->outfmtidx]&CODECS_FLAG_YUVHACK))
291
da98e96499bb sh_audio/sh_video added, general codec cleanup
arpi_esp
parents: 92
diff changeset
154 sh_video->o_bih.biCompression = mmioFOURCC('Y','U','Y','2');
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
155
291
da98e96499bb sh_audio/sh_video added, general codec cleanup
arpi_esp
parents: 92
diff changeset
156 // sh_video->o_bih.biCompression = mmioFOURCC('U','Y','V','Y');
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
157
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
158
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
159 if(verbose) {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
160 printf("Starting decompression, format:\n");
291
da98e96499bb sh_audio/sh_video added, general codec cleanup
arpi_esp
parents: 92
diff changeset
161 printf(" biSize %d\n", sh_video->bih.biSize);
da98e96499bb sh_audio/sh_video added, general codec cleanup
arpi_esp
parents: 92
diff changeset
162 printf(" biWidth %d\n", sh_video->bih.biWidth);
da98e96499bb sh_audio/sh_video added, general codec cleanup
arpi_esp
parents: 92
diff changeset
163 printf(" biHeight %d\n", sh_video->bih.biHeight);
da98e96499bb sh_audio/sh_video added, general codec cleanup
arpi_esp
parents: 92
diff changeset
164 printf(" biPlanes %d\n", sh_video->bih.biPlanes);
da98e96499bb sh_audio/sh_video added, general codec cleanup
arpi_esp
parents: 92
diff changeset
165 printf(" biBitCount %d\n", sh_video->bih.biBitCount);
da98e96499bb sh_audio/sh_video added, general codec cleanup
arpi_esp
parents: 92
diff changeset
166 printf(" biCompression %d='%.4s'\n", sh_video->bih.biCompression, &sh_video->bih.biCompression);
da98e96499bb sh_audio/sh_video added, general codec cleanup
arpi_esp
parents: 92
diff changeset
167 printf(" biSizeImage %d\n", sh_video->bih.biSizeImage);
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
168 printf("Dest fmt:\n");
291
da98e96499bb sh_audio/sh_video added, general codec cleanup
arpi_esp
parents: 92
diff changeset
169 printf(" biSize %d\n", sh_video->o_bih.biSize);
da98e96499bb sh_audio/sh_video added, general codec cleanup
arpi_esp
parents: 92
diff changeset
170 printf(" biWidth %d\n", sh_video->o_bih.biWidth);
da98e96499bb sh_audio/sh_video added, general codec cleanup
arpi_esp
parents: 92
diff changeset
171 printf(" biHeight %d\n", sh_video->o_bih.biHeight);
da98e96499bb sh_audio/sh_video added, general codec cleanup
arpi_esp
parents: 92
diff changeset
172 printf(" biPlanes %d\n", sh_video->o_bih.biPlanes);
da98e96499bb sh_audio/sh_video added, general codec cleanup
arpi_esp
parents: 92
diff changeset
173 printf(" biBitCount %d\n", sh_video->o_bih.biBitCount);
da98e96499bb sh_audio/sh_video added, general codec cleanup
arpi_esp
parents: 92
diff changeset
174 printf(" biCompression %d='%.4s'\n", sh_video->o_bih.biCompression, &sh_video->o_bih.biCompression);
da98e96499bb sh_audio/sh_video added, general codec cleanup
arpi_esp
parents: 92
diff changeset
175 printf(" biSizeImage %d\n", sh_video->o_bih.biSizeImage);
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
176 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
177
291
da98e96499bb sh_audio/sh_video added, general codec cleanup
arpi_esp
parents: 92
diff changeset
178 ret = ICDecompressQuery(sh_video->hic, &sh_video->bih, &sh_video->o_bih);
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
179 if(ret){
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
180 printf("ICDecompressQuery failed: Error %d\n", ret);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
181 return 0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
182 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
183 if(verbose) printf("ICDecompressQuery OK\n");
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
184
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
185
291
da98e96499bb sh_audio/sh_video added, general codec cleanup
arpi_esp
parents: 92
diff changeset
186 ret = ICDecompressBegin(sh_video->hic, &sh_video->bih, &sh_video->o_bih);
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
187 if(ret){
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
188 printf("ICDecompressBegin failed: Error %d\n", ret);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
189 return 0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
190 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
191
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
192 #if 0
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
193
291
da98e96499bb sh_audio/sh_video added, general codec cleanup
arpi_esp
parents: 92
diff changeset
194 //sh_video->hic
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
195 //ICSendMessage(HIC hic,unsigned int msg,long lParam1,long lParam2)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
196 { int i;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
197 for(i=73;i<256;i++){
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
198 printf("Calling ICM_USER+%d function...",i);fflush(stdout);
291
da98e96499bb sh_audio/sh_video added, general codec cleanup
arpi_esp
parents: 92
diff changeset
199 ret = ICSendMessage(sh_video->hic,ICM_USER+i,NULL,NULL);
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
200 printf(" ret=%d\n",ret);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
201 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
202 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
203 #endif
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
204
291
da98e96499bb sh_audio/sh_video added, general codec cleanup
arpi_esp
parents: 92
diff changeset
205 sh_video->our_out_buffer = malloc(sh_video->o_bih.biSizeImage);
da98e96499bb sh_audio/sh_video added, general codec cleanup
arpi_esp
parents: 92
diff changeset
206 if(!sh_video->our_out_buffer){
da98e96499bb sh_audio/sh_video added, general codec cleanup
arpi_esp
parents: 92
diff changeset
207 printf("not enough memory for decoded picture buffer (%d bytes)\n", sh_video->o_bih.biSizeImage);
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
208 return 0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
209 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
210
303
828ec81e0d64 codecs.conf support
arpi_esp
parents: 296
diff changeset
211 if(outfmt==IMGFMT_YUY2 && (sh_video->codec->outflags[sh_video->outfmtidx]&CODECS_FLAG_YUVHACK))
291
da98e96499bb sh_audio/sh_video added, general codec cleanup
arpi_esp
parents: 92
diff changeset
212 sh_video->o_bih.biCompression = mmioFOURCC('Y','U','Y','2');
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
213
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
214 // avi_header.our_in_buffer=malloc(avi_header.video.dwSuggestedBufferSize); // FIXME!!!!
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
215
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
216 if(verbose) printf("VIDEO CODEC Init OK!!! ;-)\n");
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
217 return 1;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
218 }