[svn] / branches / dev-api-4 / xvidcore / dshow / src / CXvidDecoder.cpp Repository:
ViewVC logotype

Diff of /branches/dev-api-4/xvidcore/dshow/src/CXvidDecoder.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1054, Mon Jun 9 13:55:56 2003 UTC revision 1345, Sat Jan 31 13:44:56 2004 UTC
# Line 3  Line 3 
3   *  XVID MPEG-4 VIDEO CODEC   *  XVID MPEG-4 VIDEO CODEC
4   *  - XviD Decoder part of the DShow Filter  -   *  - XviD Decoder part of the DShow Filter  -
5   *   *
6   *  Copyright(C) 2002-2003 Peter Ross <pross@xvid.org>   *  Copyright(C) 2002-2004 Peter Ross <pross@xvid.org>
7   *   *
8   *  This program is free software ; you can redistribute it and/or modify   *  This program is free software ; you can redistribute it and/or modify
9   *  it under the terms of the GNU General Public License as published by   *  it under the terms of the GNU General Public License as published by
# Line 19  Line 19 
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.1.2.2 2003-06-09 13:49:00 edgomez Exp $   * $Id: CXvidDecoder.cpp,v 1.1.2.16 2004-01-31 13:44:33 suxen_drol Exp $
23     *
24     ****************************************************************************/
25    
26    /****************************************************************************
27     *
28     * 2003/12/11 - added some additional options, mainly to make the deblocking
29     *              code from xvidcore available. Most of the new code is taken
30     *              from Nic's dshow filter, (C) Nic, http://nic.dnsalias.com
31   *   *
32   ****************************************************************************/   ****************************************************************************/
33    
# Line 52  Line 60 
60  #include "IXvidDecoder.h"  #include "IXvidDecoder.h"
61  #include "CXvidDecoder.h"  #include "CXvidDecoder.h"
62  #include "CAbout.h"  #include "CAbout.h"
63    #include "config.h"
64    #include "debug.h"
65    
66    
67    static int rgb_flip;
68    static bool USE_IYUV;
69    static bool USE_YV12;
70    static bool USE_YUY2;
71    static bool USE_YVYU;
72    static bool USE_UYVY;
73    static bool USE_RGB32;
74    static bool USE_RGB24;
75    static bool USE_RG555;
76    static bool USE_RG565;
77    
78  const AMOVIESETUP_MEDIATYPE sudInputPinTypes[] =  const AMOVIESETUP_MEDIATYPE sudInputPinTypes[] =
79  {  {
80      { &MEDIATYPE_Video, &CLSID_XVID },      { &MEDIATYPE_Video, &CLSID_XVID },
# Line 62  Line 83 
83          { &MEDIATYPE_Video, &CLSID_DIVX_UC },          { &MEDIATYPE_Video, &CLSID_DIVX_UC },
84          { &MEDIATYPE_Video, &CLSID_DX50 },          { &MEDIATYPE_Video, &CLSID_DX50 },
85          { &MEDIATYPE_Video, &CLSID_DX50_UC },          { &MEDIATYPE_Video, &CLSID_DX50_UC },
86            { &MEDIATYPE_Video, &CLSID_MP4V },
87  };  };
88    
89  const AMOVIESETUP_MEDIATYPE sudOutputPinTypes[] =  const AMOVIESETUP_MEDIATYPE sudOutputPinTypes[] =
# Line 128  Line 150 
150    
151  };  };
152    
 int g_cTemplates = sizeof(g_Templates) / sizeof(CFactoryTemplate);  
   
153    
154    /* note: g_cTemplates must be global; used by strmbase.lib(dllentry.cpp,dllsetup.cpp) */
155    int g_cTemplates = sizeof(g_Templates) / sizeof(CFactoryTemplate);
156    
157    
158  STDAPI DllRegisterServer()  STDAPI DllRegisterServer()
# Line 179  Line 201 
201    
202    
203    
 /* dummy decore() */  
   
 static int dummy_xvid_decore(void * handle, int opt, void * param1, void * param2)  
 {  
         return XVID_ERR_FAIL;  
 }  
   
   
   
204  /* constructor */  /* constructor */
205    
206  #define XVID_DLL_NAME           "xvid.dll"  #define XVID_DLL_NAME "xvidcore.dll"
 #define XVID_GLOBAL_NAME        "xvid_global"  
 #define XVID_DECORE_NAME        "xvid_decore"  
207    
208  CXvidDecoder::CXvidDecoder(LPUNKNOWN punk, HRESULT *phr) :  CXvidDecoder::CXvidDecoder(LPUNKNOWN punk, HRESULT *phr) :
209      CVideoTransformFilter(NAME("CXvidDecoder"), punk, CLSID_XVID)      CVideoTransformFilter(NAME("CXvidDecoder"), punk, CLSID_XVID)
210  {  {
211          DPRINTF("Constructor");          DPRINTF("Constructor");
212    
213          m_xvid_decore = dummy_xvid_decore;          xvid_gbl_init_t init;
214            memset(&init, 0, sizeof(init));
215            init.version = XVID_VERSION;
216    
217            ar_x = ar_y = 0;
218    
219          m_hdll = LoadLibrary(XVID_DLL_NAME);          m_hdll = LoadLibrary(XVID_DLL_NAME);
220          if (m_hdll == NULL) {          if (m_hdll == NULL) {
# Line 208  Line 223 
223                  return;                  return;
224          }          }
225    
226          m_xvid_global = (int (__cdecl *)(void *, int, void *, void *))GetProcAddress(m_hdll, XVID_GLOBAL_NAME);          xvid_global_func = (int (__cdecl *)(void *, int, void *, void *))GetProcAddress(m_hdll, "xvid_global");
227          if (m_xvid_global == NULL) {          if (xvid_global_func == NULL) {
228                  MessageBox(0, XVID_GLOBAL_NAME "() not found", "Error", 0);                  MessageBox(0, "xvid_global() not found", "Error", 0);
229                  return;                  return;
230          }          }
231    
232          m_xvid_decore = (int (__cdecl *)(void *, int, void *, void *))GetProcAddress(m_hdll, XVID_DECORE_NAME);          xvid_decore_func = (int (__cdecl *)(void *, int, void *, void *))GetProcAddress(m_hdll, "xvid_decore");
233          if (m_xvid_decore == NULL) {          if (xvid_decore_func == NULL) {
234                  MessageBox(0, XVID_DECORE_NAME "() not found", "Error", 0);                  MessageBox(0, "xvid_decore() not found", "Error", 0);
235                  return;                  return;
236          }          }
237    
238          xvid_gbl_init_t init;          if (xvid_global_func(0, XVID_GBL_INIT, &init, NULL) < 0)
         memset(&init, 0, sizeof(init));  
         init.version = XVID_VERSION;  
         if (m_xvid_global(0, XVID_GBL_INIT, &init, NULL) < 0)  
239          {          {
240                  MessageBox(0, XVID_GLOBAL_NAME "() failed", "Error", 0);                  MessageBox(0, "xvid_global() failed", "Error", 0);
241                  return;                  return;
242          }          }
243    
# Line 235  Line 247 
247    
248          memset(&m_frame, 0, sizeof(m_frame));          memset(&m_frame, 0, sizeof(m_frame));
249          m_frame.version = XVID_VERSION;          m_frame.version = XVID_VERSION;
250    
251            LoadRegistryInfo();
252    
253            USE_IYUV = false;
254            USE_YV12 = false;
255            USE_YUY2 = false;
256            USE_YVYU = false;
257            USE_UYVY = false;
258            USE_RGB32 = false;
259            USE_RGB24 = false;
260            USE_RG555 = false;
261            USE_RG565 = false;
262    
263            switch ( g_config.nForceColorspace )
264            {
265            case FORCE_NONE:
266                    USE_IYUV = true;
267                    USE_YV12 = true;
268                    USE_YUY2 = true;
269                    USE_YVYU = true;
270                    USE_UYVY = true;
271                    USE_RGB32 = true;
272                    USE_RGB24 = true;
273                    USE_RG555 = true;
274                    USE_RG565 = true;
275                    break;
276            case FORCE_YV12:
277                    USE_IYUV = true;
278                    USE_YV12 = true;
279                    break;
280            case FORCE_YUY2:
281                    USE_YUY2 = true;
282                    break;
283            case FORCE_RGB24:
284                    USE_RGB24 = true;
285                    break;
286            case FORCE_RGB32:
287                    USE_RGB32 = true;
288                    break;
289            }
290  }  }
291    
292    
# Line 247  Line 299 
299    
300          if (m_create.handle != NULL)          if (m_create.handle != NULL)
301          {          {
302                  m_xvid_decore(m_create.handle, XVID_DEC_DESTROY, 0, 0);                  xvid_decore_func(m_create.handle, XVID_DEC_DESTROY, 0, 0);
303                  m_create.handle = NULL;                  m_create.handle = NULL;
304          }          }
305    
# Line 277  Line 329 
329          {          {
330                  VIDEOINFOHEADER * vih = (VIDEOINFOHEADER *) mtIn->Format();                  VIDEOINFOHEADER * vih = (VIDEOINFOHEADER *) mtIn->Format();
331                  hdr = &vih->bmiHeader;                  hdr = &vih->bmiHeader;
332                    /* PAR (x:y) is (1/ppm_X):(1/ppm_Y) where ppm is pixels-per-meter
333                       which is equal to ppm_Y:ppm_X */
334                    ar_x = vih->bmiHeader.biYPelsPerMeter*hdr->biWidth;
335                    ar_y = vih->bmiHeader.biXPelsPerMeter*hdr->biHeight;
336          }          }
337          else if (*mtIn->FormatType() == FORMAT_VideoInfo2)          else if (*mtIn->FormatType() == FORMAT_VideoInfo2)
338          {          {
339                  VIDEOINFOHEADER2 * vih2 = (VIDEOINFOHEADER2 *) mtIn->Format();                  VIDEOINFOHEADER2 * vih2 = (VIDEOINFOHEADER2 *) mtIn->Format();
340                  hdr = &vih2->bmiHeader;                  hdr = &vih2->bmiHeader;
341                    ar_x = vih2->dwPictAspectRatioX;
342                    ar_y = vih2->dwPictAspectRatioY;
343          }          }
344          else          else
345          {          {
# Line 299  Line 357 
357    
358          switch(hdr->biCompression)          switch(hdr->biCompression)
359          {          {
360    
361            case FOURCC_MP4V:
362                    if (!(g_config.supported_4cc & SUPPORT_MP4V)) return VFW_E_TYPE_NOT_ACCEPTED;
363                    break;
364            case FOURCC_DIVX :
365                    if (!(g_config.supported_4cc & SUPPORT_DIVX)) return VFW_E_TYPE_NOT_ACCEPTED;
366                    break;
367            case FOURCC_DX50 :
368                    if (!(g_config.supported_4cc & SUPPORT_DX50)) return VFW_E_TYPE_NOT_ACCEPTED;
369          case FOURCC_XVID :          case FOURCC_XVID :
 //      case FOURCC_DIVX :  
 //      case FOURCC_DX50 :  
370                  break;                  break;
371    
372    
373          default :          default :
374                  DPRINTF("Unknown fourcc: 0x%08x (%c%c%c%c)",                  DPRINTF("Unknown fourcc: 0x%08x (%c%c%c%c)",
375                          hdr->biCompression,                          hdr->biCompression,
# Line 313  Line 379 
379                          (hdr->biCompression>>24)&0xff);                          (hdr->biCompression>>24)&0xff);
380                  return VFW_E_TYPE_NOT_ACCEPTED;                  return VFW_E_TYPE_NOT_ACCEPTED;
381          }          }
   
382          return S_OK;          return S_OK;
383  }  }
384    
385    
 #define USE_IYUV  
 #define USE_YV12  
 #define USE_YUY2  
 #define USE_YVYU  
 #define USE_UYVY  
 #define USE_RGB32  
 #define USE_RGB24  
 #define USE_RG555  
 #define USE_RG565  
   
386  /* get list of supported output colorspaces */  /* get list of supported output colorspaces */
387    
388    
389  HRESULT CXvidDecoder::GetMediaType(int iPosition, CMediaType *mtOut)  HRESULT CXvidDecoder::GetMediaType(int iPosition, CMediaType *mtOut)
390  {  {
391          DPRINTF("GetMediaType");          DPRINTF("GetMediaType");
# Line 339  Line 395 
395                  return E_UNEXPECTED;                  return E_UNEXPECTED;
396          }          }
397    
398          VIDEOINFOHEADER * vih = (VIDEOINFOHEADER *) mtOut->ReallocFormatBuffer(sizeof(VIDEOINFOHEADER));          VIDEOINFOHEADER2 * vih = (VIDEOINFOHEADER2 *) mtOut->ReallocFormatBuffer(sizeof(VIDEOINFOHEADER2));
399          if (vih == NULL)          if (vih == NULL)
400          {          {
401                  return E_OUTOFMEMORY;                  return E_OUTOFMEMORY;
# Line 358  Line 414 
414    
415          switch(iPosition)          switch(iPosition)
416          {          {
417    
418          case 0  :          case 0  :
419  #ifdef USE_IYUV  if ( USE_YUY2 )
420                  vih->bmiHeader.biCompression = MEDIASUBTYPE_IYUV.Data1;  {
                 vih->bmiHeader.biBitCount = 12;  
                 mtOut->SetSubtype(&MEDIASUBTYPE_IYUV);  
                 break;  
 #endif  
         case 1  :  
 #ifdef USE_YV12  
                 vih->bmiHeader.biCompression = MEDIASUBTYPE_YV12.Data1;  
                 vih->bmiHeader.biBitCount = 12;  
                 mtOut->SetSubtype(&MEDIASUBTYPE_YV12);  
                 break;  
 #endif  
         case 2:  
 #ifdef USE_YUY2  
421                  vih->bmiHeader.biCompression = MEDIASUBTYPE_YUY2.Data1;                  vih->bmiHeader.biCompression = MEDIASUBTYPE_YUY2.Data1;
422                  vih->bmiHeader.biBitCount = 16;                  vih->bmiHeader.biBitCount = 16;
423                  mtOut->SetSubtype(&MEDIASUBTYPE_YUY2);                  mtOut->SetSubtype(&MEDIASUBTYPE_YUY2);
424                  break;                  break;
425  #endif  }
426          case 3 :          case 1 :
427  #ifdef USE_YVYU  if ( USE_YVYU )
428    {
429                  vih->bmiHeader.biCompression = MEDIASUBTYPE_YVYU.Data1;                  vih->bmiHeader.biCompression = MEDIASUBTYPE_YVYU.Data1;
430                  vih->bmiHeader.biBitCount = 16;                  vih->bmiHeader.biBitCount = 16;
431                  mtOut->SetSubtype(&MEDIASUBTYPE_YVYU);                  mtOut->SetSubtype(&MEDIASUBTYPE_YVYU);
432                  break;                  break;
433  #endif  }
434          case 4 :          case 2 :
435  #ifdef USE_UYVY  if ( USE_UYVY )
436    {
437                  vih->bmiHeader.biCompression = MEDIASUBTYPE_UYVY.Data1;                  vih->bmiHeader.biCompression = MEDIASUBTYPE_UYVY.Data1;
438                  vih->bmiHeader.biBitCount = 16;                  vih->bmiHeader.biBitCount = 16;
439                  mtOut->SetSubtype(&MEDIASUBTYPE_UYVY);                  mtOut->SetSubtype(&MEDIASUBTYPE_UYVY);
440                  break;                  break;
441  #endif  }
442            case 3  :
443                    if ( USE_IYUV )
444    {
445                    vih->bmiHeader.biCompression = CLSID_MEDIASUBTYPE_IYUV.Data1;
446                    vih->bmiHeader.biBitCount = 12;
447                    mtOut->SetSubtype(&CLSID_MEDIASUBTYPE_IYUV);
448                    break;
449    }
450            case 4  :
451    if ( USE_YV12 )
452    {
453                    vih->bmiHeader.biCompression = MEDIASUBTYPE_YV12.Data1;
454                    vih->bmiHeader.biBitCount = 12;
455                    mtOut->SetSubtype(&MEDIASUBTYPE_YV12);
456                    break;
457    }
458          case 5 :          case 5 :
459  #ifdef USE_RGB32  if ( USE_RGB32 )
460    {
461                  vih->bmiHeader.biCompression = BI_RGB;                  vih->bmiHeader.biCompression = BI_RGB;
462                  vih->bmiHeader.biBitCount = 32;                  vih->bmiHeader.biBitCount = 32;
463                  mtOut->SetSubtype(&MEDIASUBTYPE_RGB32);                  mtOut->SetSubtype(&MEDIASUBTYPE_RGB32);
464                  break;                  break;
465  #endif  }
466          case 6 :          case 6 :
467  #ifdef USE_RGB24  if ( USE_RGB24 )
468    {
469                  vih->bmiHeader.biCompression = BI_RGB;                  vih->bmiHeader.biCompression = BI_RGB;
470                  vih->bmiHeader.biBitCount = 24;                  vih->bmiHeader.biBitCount = 24;
471                  mtOut->SetSubtype(&MEDIASUBTYPE_RGB24);                  mtOut->SetSubtype(&MEDIASUBTYPE_RGB24);
472                  break;                  break;
473  #endif  }
474          case 7 :          case 7 :
475  #ifdef USE_RG555  if ( USE_RG555 )
476    {
477                  vih->bmiHeader.biCompression = BI_RGB;                  vih->bmiHeader.biCompression = BI_RGB;
478                  vih->bmiHeader.biBitCount = 16;                  vih->bmiHeader.biBitCount = 16;
479                  mtOut->SetSubtype(&MEDIASUBTYPE_RGB555);                  mtOut->SetSubtype(&MEDIASUBTYPE_RGB555);
480                  break;                  break;
481  #endif  }
482          case 8 :          case 8 :
483  #ifdef USE_RG565  if ( USE_RG565 )
484    {
485                  vih->bmiHeader.biCompression = BI_RGB;                  vih->bmiHeader.biCompression = BI_RGB;
486                  vih->bmiHeader.biBitCount = 16;                  vih->bmiHeader.biBitCount = 16;
487                  mtOut->SetSubtype(&MEDIASUBTYPE_RGB565);                  mtOut->SetSubtype(&MEDIASUBTYPE_RGB565);
488                  break;                  break;
489  #endif  }
490          default :          default :
491                  return VFW_S_NO_MORE_ITEMS;                  return VFW_S_NO_MORE_ITEMS;
492          }          }
493    
494          vih->bmiHeader.biSizeImage = GetBitmapSize(&vih->bmiHeader);          vih->bmiHeader.biSizeImage = GetBitmapSize(&vih->bmiHeader);
495    
496            if (ar_x != 0 && ar_y != 0) {
497                    vih->dwPictAspectRatioX = ar_x;
498                    vih->dwPictAspectRatioY = ar_y;
499            } else { // just to be safe
500                    vih->dwPictAspectRatioX = m_create.width;
501                    vih->dwPictAspectRatioY = m_create.height;
502            }
503    
504          mtOut->SetType(&MEDIATYPE_Video);          mtOut->SetType(&MEDIATYPE_Video);
505          mtOut->SetFormatType(&FORMAT_VideoInfo);          mtOut->SetFormatType(&FORMAT_VideoInfo2);
506          mtOut->SetTemporalCompression(FALSE);          mtOut->SetTemporalCompression(FALSE);
507          mtOut->SetSampleSize(vih->bmiHeader.biSizeImage);          mtOut->SetSampleSize(vih->bmiHeader.biSizeImage);
508    
# Line 440  Line 514 
514    
515  HRESULT CXvidDecoder::ChangeColorspace(GUID subtype, GUID formattype, void * format)  HRESULT CXvidDecoder::ChangeColorspace(GUID subtype, GUID formattype, void * format)
516  {  {
         int rgb_flip;  
   
517          if (formattype == FORMAT_VideoInfo)          if (formattype == FORMAT_VideoInfo)
518          {          {
519                  VIDEOINFOHEADER * vih = (VIDEOINFOHEADER * )format;                  VIDEOINFOHEADER * vih = (VIDEOINFOHEADER * )format;
# Line 459  Line 531 
531                  return S_FALSE;                  return S_FALSE;
532          }          }
533    
534          if (subtype == MEDIASUBTYPE_IYUV)          if (subtype == CLSID_MEDIASUBTYPE_IYUV)
535          {          {
536                  DPRINTF("IYUV");                  DPRINTF("IYUV");
537                    rgb_flip = 0;
538                  m_frame.output.csp = XVID_CSP_I420;                  m_frame.output.csp = XVID_CSP_I420;
539                  m_frame.output.stride[0] = (m_frame.output.stride[0] * 2) / 3;  /* planar format fix */                  m_frame.output.stride[0] = (m_frame.output.stride[0] * 2) / 3;  /* planar format fix */
540          }          }
541          else if (subtype == MEDIASUBTYPE_YV12)          else if (subtype == MEDIASUBTYPE_YV12)
542          {          {
543                  DPRINTF("YV12");                  DPRINTF("YV12");
544                    rgb_flip = 0;
545                  m_frame.output.csp = XVID_CSP_YV12;                  m_frame.output.csp = XVID_CSP_YV12;
546                  m_frame.output.stride[0] = (m_frame.output.stride[0] * 2) / 3;  /* planar format fix */                  m_frame.output.stride[0] = (m_frame.output.stride[0] * 2) / 3;  /* planar format fix */
547          }          }
548          else if (subtype == MEDIASUBTYPE_YUY2)          else if (subtype == MEDIASUBTYPE_YUY2)
549          {          {
550                  DPRINTF("YUY2");                  DPRINTF("YUY2");
551                    rgb_flip = 0;
552                  m_frame.output.csp = XVID_CSP_YUY2;                  m_frame.output.csp = XVID_CSP_YUY2;
553          }          }
554          else if (subtype == MEDIASUBTYPE_YVYU)          else if (subtype == MEDIASUBTYPE_YVYU)
555          {          {
556                  DPRINTF("YVYU");                  DPRINTF("YVYU");
557                    rgb_flip = 0;
558                  m_frame.output.csp = XVID_CSP_YVYU;                  m_frame.output.csp = XVID_CSP_YVYU;
559          }          }
560          else if (subtype == MEDIASUBTYPE_UYVY)          else if (subtype == MEDIASUBTYPE_UYVY)
561          {          {
562                  DPRINTF("UYVY");                  DPRINTF("UYVY");
563                    rgb_flip = 0;
564                  m_frame.output.csp = XVID_CSP_UYVY;                  m_frame.output.csp = XVID_CSP_UYVY;
565          }          }
566          else if (subtype == MEDIASUBTYPE_RGB32)          else if (subtype == MEDIASUBTYPE_RGB32)
# Line 590  Line 667 
667    
668          if (m_create.handle == NULL)          if (m_create.handle == NULL)
669          {          {
670                  if (m_xvid_decore(0, XVID_DEC_CREATE, &m_create, 0) < 0)                  if (xvid_decore_func(0, XVID_DEC_CREATE, &m_create, 0) < 0)
671                  {                  {
672              DPRINTF("*** XVID_DEC_CREATE error");              DPRINTF("*** XVID_DEC_CREATE error");
673                          return S_FALSE;                          return S_FALSE;
# Line 625  Line 702 
702          }          }
703    
704          m_frame.general = XVID_LOWDELAY;          m_frame.general = XVID_LOWDELAY;
705    
706          if (pIn->IsDiscontinuity() == S_OK)          if (pIn->IsDiscontinuity() == S_OK)
707                  m_frame.general = XVID_DISCONTINUITY;                  m_frame.general = XVID_DISCONTINUITY;
708    
709            if (g_config.nDeblock_Y)
710                    m_frame.general |= XVID_DEBLOCKY;
711    
712            if (g_config.nDeblock_UV)
713                    m_frame.general |= XVID_DEBLOCKUV;
714    /*
715            if (g_config.nDering)
716                    m_frame.general |= XVID_DERING;
717    */
718            if (g_config.nFilmEffect)
719                    m_frame.general |= XVID_FILMEFFECT;
720    
721            m_frame.output.csp &= ~XVID_CSP_VFLIP;
722            m_frame.output.csp |= rgb_flip^(g_config.nFlipVideo ? XVID_CSP_VFLIP : 0);
723    
724  repeat :  repeat :
725    
726          if (pIn->IsPreroll() != S_OK)          if (pIn->IsPreroll() != S_OK)
727          {          {
728                  length = m_xvid_decore(m_create.handle, XVID_DEC_DECODE, &m_frame, &stats);                  length = xvid_decore_func(m_create.handle, XVID_DEC_DECODE, &m_frame, &stats);
729    
730                  if (length < 0)                  if (length < 0)
731                  {                  {
732              DPRINTF("*** XVID_DEC_DECODE");              DPRINTF("*** XVID_DEC_DECODE");
# Line 640  Line 734 
734                  }                  }
735          }          }
736          else          else
737          {          {       /* Preroll frame - won't be displayed */
738                  int tmp = m_frame.output.csp;                  int tmp = m_frame.output.csp;
739                    int tmp_gen = m_frame.general;
740    
741                  m_frame.output.csp = XVID_CSP_NULL;                  m_frame.output.csp = XVID_CSP_NULL;
742    
743                  length = m_xvid_decore(m_create.handle, XVID_DEC_DECODE, &m_frame, &stats);                  /* Disable postprocessing to speed-up seeking */
744                    m_frame.general &= ~XVID_DEBLOCKY;
745                    m_frame.general &= ~XVID_DEBLOCKUV;
746    /*              m_frame.general &= ~XVID_DERING; */
747                    m_frame.general &= ~XVID_FILMEFFECT;
748    
749                    length = xvid_decore_func(m_create.handle, XVID_DEC_DECODE, &m_frame, &stats);
750                  if (length < 0)                  if (length < 0)
751                  {                  {
752              DPRINTF("*** XVID_DEC_DECODE");              DPRINTF("*** XVID_DEC_DECODE");
# Line 652  Line 754 
754                  }                  }
755    
756                  m_frame.output.csp = tmp;                  m_frame.output.csp = tmp;
757                    m_frame.general = tmp_gen;
758          }          }
759    
760            if (stats.type == XVID_TYPE_NOTHING && length > 0) {
761                    DPRINTF("B-Frame decoder lag");
762                    return S_FALSE;
763            }
764    
765    
766          if (stats.type == XVID_TYPE_VOL)          if (stats.type == XVID_TYPE_VOL)
767          {          {
768                  if (stats.data.vol.width != m_create.width ||                  if (stats.data.vol.width != m_create.width ||
# Line 663  Line 772 
772                          return S_FALSE;                          return S_FALSE;
773                  }                  }
774    
775                    pOut->SetDiscontinuity(TRUE);
776                    pOut->SetSyncPoint(TRUE);
777    
778                  m_frame.bitstream = (BYTE*)m_frame.bitstream + length;                  m_frame.bitstream = (BYTE*)m_frame.bitstream + length;
779                  m_frame.length -= length;                  m_frame.length -= length;
780                  goto repeat;                  goto repeat;
781          }          }
782    
783            if (pIn->IsPreroll() == S_OK) {
784                    return S_FALSE;
785            }
786    
787          return S_OK;          return S_OK;
788  }  }
789    

Legend:
Removed from v.1054  
changed lines
  Added in v.1345

No admin address has been configured
ViewVC Help
Powered by ViewVC 1.0.4