[svn] / branches / release-1_3-branch / xvidcore / dshow / src / CXvidDecoder.cpp Repository:
ViewVC logotype

Diff of /branches/release-1_3-branch/xvidcore/dshow/src/CXvidDecoder.cpp

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

revision 1397, Thu Apr 1 11:11:28 2004 UTC revision 1488, Sun Jul 11 10:22:47 2004 UTC
# 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.3 2004-04-01 11:11:28 suxen_drol Exp $   * $Id: CXvidDecoder.cpp,v 1.8 2004-07-11 10:22:47 syskin Exp $
23   *   *
24   ****************************************************************************/   ****************************************************************************/
25    
# Line 212  Line 212 
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");
# Line 285  Line 283 
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()
 /* destructor */  
   
 CXvidDecoder::~CXvidDecoder()  
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 */
# Line 320  Line 338 
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    
# Line 329  Line 348 
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          }          }
# Line 338  Line 360 
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    
# Line 360  Line 386 
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    
# Line 378  Line 413 
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;
# Line 713  Line 749 
749          m_frame.general = XVID_LOWDELAY;          m_frame.general = XVID_LOWDELAY;
750    
751          if (pIn->IsDiscontinuity() == S_OK)          if (pIn->IsDiscontinuity() == S_OK)
752                  m_frame.general = XVID_DISCONTINUITY;                  m_frame.general |= XVID_DISCONTINUITY;
753    
754          if (g_config.nDeblock_Y)          if (g_config.nDeblock_Y)
755                  m_frame.general |= XVID_DEBLOCKY;                  m_frame.general |= XVID_DEBLOCKY;
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    

Legend:
Removed from v.1397  
changed lines
  Added in v.1488

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