19 |
* along with this program ; if not, write to the Free Software |
* along with this program ; if not, write to the Free Software |
20 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
21 |
* |
* |
22 |
* $Id: CXvidDecoder.cpp,v 1.7 2004-04-18 07:55:11 syskin Exp $ |
* $Id: CXvidDecoder.cpp,v 1.8 2004-07-11 10:22:47 syskin Exp $ |
23 |
* |
* |
24 |
****************************************************************************/ |
****************************************************************************/ |
25 |
|
|
212 |
memset(&init, 0, sizeof(init)); |
memset(&init, 0, sizeof(init)); |
213 |
init.version = XVID_VERSION; |
init.version = XVID_VERSION; |
214 |
|
|
|
ar_x = ar_y = 0; |
|
|
|
|
215 |
m_hdll = LoadLibrary(XVID_DLL_NAME); |
m_hdll = LoadLibrary(XVID_DLL_NAME); |
216 |
if (m_hdll == NULL) { |
if (m_hdll == NULL) { |
217 |
DPRINTF("dll load failed"); |
DPRINTF("dll load failed"); |
283 |
USE_RGB32 = true; |
USE_RGB32 = true; |
284 |
break; |
break; |
285 |
} |
} |
286 |
|
|
287 |
|
switch (g_config.aspect_ratio) |
288 |
|
{ |
289 |
|
case 0: // Auto mode |
290 |
|
ar_x = ar_y = 0; |
291 |
|
break; |
292 |
|
case 1: |
293 |
|
ar_x = 4; |
294 |
|
ar_y = 3; |
295 |
|
break; |
296 |
|
case 2: |
297 |
|
ar_x = 16; |
298 |
|
ar_y = 9; |
299 |
|
break; |
300 |
|
case 3: |
301 |
|
ar_x = 47; |
302 |
|
ar_y = 20; |
303 |
|
break; |
304 |
|
} |
305 |
} |
} |
306 |
|
|
307 |
void CXvidDecoder::CloseLib() |
void CXvidDecoder::CloseLib() |
348 |
hdr = &vih->bmiHeader; |
hdr = &vih->bmiHeader; |
349 |
/* PAR (x:y) is (1/ppm_X):(1/ppm_Y) where ppm is pixels-per-meter |
/* PAR (x:y) is (1/ppm_X):(1/ppm_Y) where ppm is pixels-per-meter |
350 |
which is equal to ppm_Y:ppm_X */ |
which is equal to ppm_Y:ppm_X */ |
351 |
|
if ((ar_x == 0) && (ar_y == 0)) // selected Auto-mode |
352 |
|
{ |
353 |
ar_x = vih->bmiHeader.biYPelsPerMeter * abs(hdr->biWidth); |
ar_x = vih->bmiHeader.biYPelsPerMeter * abs(hdr->biWidth); |
354 |
ar_y = vih->bmiHeader.biXPelsPerMeter * abs(hdr->biHeight); |
ar_y = vih->bmiHeader.biXPelsPerMeter * abs(hdr->biHeight); |
355 |
|
} |
356 |
DPRINTF("VIDEOINFOHEADER PAR: %d:%d -> AR %d:%d", |
DPRINTF("VIDEOINFOHEADER PAR: %d:%d -> AR %d:%d", |
357 |
vih->bmiHeader.biYPelsPerMeter,vih->bmiHeader.biXPelsPerMeter, ar_x, ar_y); |
vih->bmiHeader.biYPelsPerMeter,vih->bmiHeader.biXPelsPerMeter, ar_x, ar_y); |
358 |
} |
} |
360 |
{ |
{ |
361 |
VIDEOINFOHEADER2 * vih2 = (VIDEOINFOHEADER2 *) mtIn->Format(); |
VIDEOINFOHEADER2 * vih2 = (VIDEOINFOHEADER2 *) mtIn->Format(); |
362 |
hdr = &vih2->bmiHeader; |
hdr = &vih2->bmiHeader; |
363 |
|
if ((ar_x == 0) && (ar_y == 0)) // selected Auto-mode |
364 |
|
{ |
365 |
ar_x = vih2->dwPictAspectRatioX; |
ar_x = vih2->dwPictAspectRatioX; |
366 |
ar_y = vih2->dwPictAspectRatioY; |
ar_y = vih2->dwPictAspectRatioY; |
367 |
|
} |
368 |
DPRINTF("VIDEOINFOHEADER2 AR: %d:%d", ar_x, ar_y); |
DPRINTF("VIDEOINFOHEADER2 AR: %d:%d", ar_x, ar_y); |
369 |
} |
} |
370 |
else |
else |