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 |
/* destructor */ |
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 |
CXvidDecoder::~CXvidDecoder() |
void CXvidDecoder::CloseLib() |
308 |
{ |
{ |
309 |
DPRINTF("Destructor"); |
DPRINTF("Destructor"); |
310 |
|
|
311 |
if (m_create.handle != NULL) |
if (m_create.handle != NULL) { |
|
{ |
|
312 |
xvid_decore_func(m_create.handle, XVID_DEC_DESTROY, 0, 0); |
xvid_decore_func(m_create.handle, XVID_DEC_DESTROY, 0, 0); |
313 |
m_create.handle = NULL; |
m_create.handle = NULL; |
314 |
} |
} |
315 |
|
|
316 |
if (m_hdll != NULL) |
if (m_hdll != NULL) { |
|
{ |
|
317 |
FreeLibrary(m_hdll); |
FreeLibrary(m_hdll); |
318 |
m_hdll = NULL; |
m_hdll = NULL; |
319 |
} |
} |
320 |
} |
} |
321 |
|
|
322 |
|
/* destructor */ |
323 |
|
|
324 |
|
CXvidDecoder::~CXvidDecoder() |
325 |
|
{ |
326 |
|
CloseLib(); |
327 |
|
} |
328 |
|
|
329 |
|
|
330 |
|
|
331 |
/* check input type */ |
/* check input type */ |
338 |
if (*mtIn->Type() != MEDIATYPE_Video) |
if (*mtIn->Type() != MEDIATYPE_Video) |
339 |
{ |
{ |
340 |
DPRINTF("Error: Unknown Type"); |
DPRINTF("Error: Unknown Type"); |
341 |
|
CloseLib(); |
342 |
return VFW_E_TYPE_NOT_ACCEPTED; |
return VFW_E_TYPE_NOT_ACCEPTED; |
343 |
} |
} |
344 |
|
|
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 |
371 |
{ |
{ |
372 |
DPRINTF("Error: Unknown FormatType"); |
DPRINTF("Error: Unknown FormatType"); |
373 |
|
CloseLib(); |
374 |
return VFW_E_TYPE_NOT_ACCEPTED; |
return VFW_E_TYPE_NOT_ACCEPTED; |
375 |
} |
} |
376 |
|
|
386 |
{ |
{ |
387 |
|
|
388 |
case FOURCC_MP4V: |
case FOURCC_MP4V: |
389 |
if (!(g_config.supported_4cc & SUPPORT_MP4V)) return VFW_E_TYPE_NOT_ACCEPTED; |
if (!(g_config.supported_4cc & SUPPORT_MP4V)) { |
390 |
|
CloseLib(); |
391 |
|
return VFW_E_TYPE_NOT_ACCEPTED; |
392 |
|
} |
393 |
break; |
break; |
394 |
case FOURCC_DIVX : |
case FOURCC_DIVX : |
395 |
if (!(g_config.supported_4cc & SUPPORT_DIVX)) return VFW_E_TYPE_NOT_ACCEPTED; |
if (!(g_config.supported_4cc & SUPPORT_DIVX)) { |
396 |
|
CloseLib(); |
397 |
|
return VFW_E_TYPE_NOT_ACCEPTED; |
398 |
|
} |
399 |
break; |
break; |
400 |
case FOURCC_DX50 : |
case FOURCC_DX50 : |
401 |
if (!(g_config.supported_4cc & SUPPORT_DX50)) return VFW_E_TYPE_NOT_ACCEPTED; |
if (!(g_config.supported_4cc & SUPPORT_DX50)) { |
402 |
|
CloseLib(); |
403 |
|
return VFW_E_TYPE_NOT_ACCEPTED; |
404 |
|
} |
405 |
case FOURCC_XVID : |
case FOURCC_XVID : |
406 |
break; |
break; |
407 |
|
|
413 |
(hdr->biCompression>>8)&0xff, |
(hdr->biCompression>>8)&0xff, |
414 |
(hdr->biCompression>>16)&0xff, |
(hdr->biCompression>>16)&0xff, |
415 |
(hdr->biCompression>>24)&0xff); |
(hdr->biCompression>>24)&0xff); |
416 |
|
CloseLib(); |
417 |
return VFW_E_TYPE_NOT_ACCEPTED; |
return VFW_E_TYPE_NOT_ACCEPTED; |
418 |
} |
} |
419 |
return S_OK; |
return S_OK; |
756 |
|
|
757 |
if (g_config.nDeblock_UV) |
if (g_config.nDeblock_UV) |
758 |
m_frame.general |= XVID_DEBLOCKUV; |
m_frame.general |= XVID_DEBLOCKUV; |
759 |
/* |
|
760 |
if (g_config.nDering) |
if (g_config.nDering_Y) |
761 |
m_frame.general |= XVID_DERING; |
m_frame.general |= XVID_DERINGY; |
762 |
*/ |
|
763 |
|
if (g_config.nDering_UV) |
764 |
|
m_frame.general |= XVID_DERINGUV; |
765 |
|
|
766 |
if (g_config.nFilmEffect) |
if (g_config.nFilmEffect) |
767 |
m_frame.general |= XVID_FILMEFFECT; |
m_frame.general |= XVID_FILMEFFECT; |
768 |
|
|