[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 1271, Wed Dec 17 17:08:29 2003 UTC revision 1301, Fri Jan 2 13:18:28 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.1.2.6 2003-12-17 17:08:29 Isibaar Exp $   * $Id: CXvidDecoder.cpp,v 1.1.2.8 2004-01-02 13:18:28 syskin Exp $
23   *   *
24   ****************************************************************************/   ****************************************************************************/
25    
# Line 201  Line 201 
201    
202  /* constructor */  /* constructor */
203    
204    #define XVID_DLL_NAME "xvidcore.dll"
205    
206  CXvidDecoder::CXvidDecoder(LPUNKNOWN punk, HRESULT *phr) :  CXvidDecoder::CXvidDecoder(LPUNKNOWN punk, HRESULT *phr) :
207      CVideoTransformFilter(NAME("CXvidDecoder"), punk, CLSID_XVID)      CVideoTransformFilter(NAME("CXvidDecoder"), punk, CLSID_XVID)
208  {  {
# Line 209  Line 211 
211          xvid_gbl_init_t init;          xvid_gbl_init_t init;
212          memset(&init, 0, sizeof(init));          memset(&init, 0, sizeof(init));
213          init.version = XVID_VERSION;          init.version = XVID_VERSION;
214          if (xvid_global(0, XVID_GBL_INIT, &init, NULL) < 0)  
215            m_hdll = LoadLibrary(XVID_DLL_NAME);
216            if (m_hdll == NULL) {
217                    DPRINTF("dll load failed");
218                    MessageBox(0, XVID_DLL_NAME " not found","Error", 0);
219                    return;
220            }
221    
222            xvid_global_func = (int (__cdecl *)(void *, int, void *, void *))GetProcAddress(m_hdll, "xvid_global");
223            if (xvid_global_func == NULL) {
224                    MessageBox(0, "xvid_global() not found", "Error", 0);
225                    return;
226            }
227    
228            xvid_decore_func = (int (__cdecl *)(void *, int, void *, void *))GetProcAddress(m_hdll, "xvid_decore");
229            if (xvid_decore_func == NULL) {
230                    MessageBox(0, "xvid_decore() not found", "Error", 0);
231                    return;
232            }
233    
234            if (xvid_global_func(0, XVID_GBL_INIT, &init, NULL) < 0)
235          {          {
236                  MessageBox(0, "xvid_global() failed", "Error", 0);                  MessageBox(0, "xvid_global() failed", "Error", 0);
237                  return;                  return;
# Line 228  Line 250 
250    
251          // Set the default post-processing settings          // Set the default post-processing settings
252          REG_GET_N("Brightness", PPSettings.nBrightness, 25)          REG_GET_N("Brightness", PPSettings.nBrightness, 25)
253          REG_GET_N("Deblock_Y",  PPSettings.bDeblock_Y, 0)          REG_GET_N("Deblock_Y",  PPSettings.bDeblock_Y, 1)
254          REG_GET_N("Deblock_UV", PPSettings.bDeblock_UV, 0)          REG_GET_N("Deblock_UV", PPSettings.bDeblock_UV, 1)
255          REG_GET_N("Dering",  PPSettings.bDering, 0)          REG_GET_N("Dering",  PPSettings.bDering, 1)
256          REG_GET_N("FilmEffect", PPSettings.bFilmEffect, 0)          REG_GET_N("FilmEffect", PPSettings.bFilmEffect, 1)
257          REG_GET_N("ForceColorspace", PPSettings.nForceColorspace, 0)          REG_GET_N("ForceColorspace", PPSettings.nForceColorspace, 0)
258    
259          RegCloseKey(hKey);          RegCloseKey(hKey);
# Line 285  Line 307 
307    
308          if (m_create.handle != NULL)          if (m_create.handle != NULL)
309          {          {
310                  xvid_decore(m_create.handle, XVID_DEC_DESTROY, 0, 0);                  xvid_decore_func(m_create.handle, XVID_DEC_DESTROY, 0, 0);
311                  m_create.handle = NULL;                  m_create.handle = NULL;
312          }          }
313    
314            if (m_hdll != NULL)
315            {
316                    FreeLibrary(m_hdll);
317                    m_hdll = NULL;
318            }
319  }  }
320    
321    
# Line 620  Line 648 
648    
649          if (m_create.handle == NULL)          if (m_create.handle == NULL)
650          {          {
651                  if (xvid_decore(0, XVID_DEC_CREATE, &m_create, 0) < 0)                  if (xvid_decore_func(0, XVID_DEC_CREATE, &m_create, 0) < 0)
652                  {                  {
653              DPRINTF("*** XVID_DEC_CREATE error");              DPRINTF("*** XVID_DEC_CREATE error");
654                          return S_FALSE;                          return S_FALSE;
# Line 688  Line 716 
716    
717          if (pIn->IsPreroll() != S_OK)          if (pIn->IsPreroll() != S_OK)
718          {          {
719                  length = xvid_decore(m_create.handle, XVID_DEC_DECODE, &m_frame, &stats);                  length = xvid_decore_func(m_create.handle, XVID_DEC_DECODE, &m_frame, &stats);
720    
721                  if (length < 0)                  if (length < 0)
722                  {                  {
# Line 697  Line 725 
725                  }                  }
726          }          }
727          else          else
728          {          {       /* Preroll frame - won't be displayed */
729                  int tmp = m_frame.output.csp;                  int tmp = m_frame.output.csp;
730                    int tmp_gen = m_frame.general;
731    
732                  m_frame.output.csp = XVID_CSP_NULL;                  m_frame.output.csp = XVID_CSP_NULL;
733    
734                  length = xvid_decore(m_create.handle, XVID_DEC_DECODE, &m_frame, &stats);                  /* Disable postprocessing to speed-up seeking */
735                    m_frame.general &= ~XVID_DEBLOCKY;
736                    m_frame.general &= ~XVID_DEBLOCKUV;
737    /*              m_frame.general &= ~XVID_DERING; */
738                    m_frame.general &= ~XVID_FILMEFFECT;
739    
740                    length = xvid_decore_func(m_create.handle, XVID_DEC_DECODE, &m_frame, &stats);
741                  if (length < 0)                  if (length < 0)
742                  {                  {
743              DPRINTF("*** XVID_DEC_DECODE");              DPRINTF("*** XVID_DEC_DECODE");
# Line 709  Line 745 
745                  }                  }
746    
747                  m_frame.output.csp = tmp;                  m_frame.output.csp = tmp;
748                    m_frame.general = tmp_gen;
749          }          }
750    
751          if (stats.type == XVID_TYPE_NOTHING) {          if (stats.type == XVID_TYPE_NOTHING) {
# Line 726  Line 763 
763                          return S_FALSE;                          return S_FALSE;
764                  }                  }
765    
766                    pOut->SetDiscontinuity(TRUE);
767                    pOut->SetSyncPoint(TRUE);
768    
769                  m_frame.bitstream = (BYTE*)m_frame.bitstream + length;                  m_frame.bitstream = (BYTE*)m_frame.bitstream + length;
770                  m_frame.length -= length;                  m_frame.length -= length;
771                  goto repeat;                  goto repeat;
772          }          }
773    
774            if (pIn->IsPreroll() == S_OK) {
775                    return S_FALSE;
776            }
777    
778          return S_OK;          return S_OK;
779  }  }
780    

Legend:
Removed from v.1271  
changed lines
  Added in v.1301

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