[cvs] / xvidcore / dshow / src / CXvidDecoder.cpp Repository:
ViewVC logotype

Diff of /xvidcore/dshow/src/CXvidDecoder.cpp

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

revision 1.1, Sat Feb 22 08:22:03 2003 UTC revision 1.1.2.5, Fri Dec 12 15:09:01 2003 UTC
# Line 0  Line 1 
1    /*****************************************************************************
2     *
3     *  XVID MPEG-4 VIDEO CODEC
4     *  - XviD Decoder part of the DShow Filter  -
5     *
6     *  Copyright(C) 2002-2003 Peter Ross <pross@xvid.org>
7     *
8     *  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
10     *  the Free Software Foundation ; either version 2 of the License, or
11     *  (at your option) any later version.
12     *
13     *  This program is distributed in the hope that it will be useful,
14     *  but WITHOUT ANY WARRANTY ; without even the implied warranty of
15     *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16     *  GNU General Public License for more details.
17     *
18     *  You should have received a copy of the GNU General Public License
19     *  along with this program ; if not, write to the Free Software
20     *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
21     *
22     * $Id$
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    
34     /*
35            this requires the directx sdk
36            place these paths at the top of the Tools|Options|Directories list
37    
38            headers:
39            C:\DXVCSDK\include
40            C:\DXVCSDK\samples\Multimedia\DirectShow\BaseClasses
41    
42            libraries (optional):
43            C:\DXVCSDK\samples\Multimedia\DirectShow\BaseClasses\Release
44    */
45    
46    
47    
48    #include <windows.h>
49    
50    #include <streams.h>
51    #include <initguid.h>
52    #include <olectl.h>
53    #if (1100 > _MSC_VER)
54    #include <olectlid.h>
55    #endif
56    #include <dvdmedia.h>   // VIDEOINFOHEADER2
57    
58    #include <xvid.h>               // XviD API
59    
60    #include "IXvidDecoder.h"
61    #include "CXvidDecoder.h"
62    #include "CAbout.h"
63    
64    // Externs defined here
65    PostProcessing_Settings PPSettings;
66    
67    int rgb_flip;
68    
69    bool USE_IYUV;
70    bool USE_YV12;
71    bool USE_YUY2;
72    bool USE_YVYU;
73    bool USE_UYVY;
74    bool USE_RGB32;
75    bool USE_RGB24;
76    bool USE_RG555;
77    bool USE_RG565;
78    
79    const AMOVIESETUP_MEDIATYPE sudInputPinTypes[] =
80    {
81        { &MEDIATYPE_Video, &CLSID_XVID },
82            { &MEDIATYPE_Video, &CLSID_XVID_UC },
83            { &MEDIATYPE_Video, &CLSID_DIVX },
84            { &MEDIATYPE_Video, &CLSID_DIVX_UC },
85            { &MEDIATYPE_Video, &CLSID_DX50 },
86            { &MEDIATYPE_Video, &CLSID_DX50_UC },
87    };
88    
89    const AMOVIESETUP_MEDIATYPE sudOutputPinTypes[] =
90    {
91        { &MEDIATYPE_Video, &MEDIASUBTYPE_NULL }
92    };
93    
94    
95    const AMOVIESETUP_PIN psudPins[] =
96    {
97            {
98                    L"Input",           // String pin name
99                    FALSE,              // Is it rendered
100                    FALSE,              // Is it an output
101                    FALSE,              // Allowed none
102                    FALSE,              // Allowed many
103                    &CLSID_NULL,        // Connects to filter
104                    L"Output",          // Connects to pin
105                    sizeof(sudInputPinTypes) / sizeof(AMOVIESETUP_MEDIATYPE), // Number of types
106                    &sudInputPinTypes[0]    // The pin details
107            },
108            {
109                    L"Output",          // String pin name
110                    FALSE,              // Is it rendered
111                    TRUE,               // Is it an output
112                    FALSE,              // Allowed none
113                    FALSE,              // Allowed many
114                    &CLSID_NULL,        // Connects to filter
115                    L"Input",           // Connects to pin
116                    sizeof(sudOutputPinTypes) / sizeof(AMOVIESETUP_MEDIATYPE),      // Number of types
117                    sudOutputPinTypes       // The pin details
118            }
119    };
120    
121    
122    const AMOVIESETUP_FILTER sudXvidDecoder =
123    {
124            &CLSID_XVID,                    // Filter CLSID
125            XVID_NAME_L,                    // Filter name
126            MERIT_PREFERRED,                // Its merit
127            sizeof(psudPins) / sizeof(AMOVIESETUP_PIN),     // Number of pins
128            psudPins                                // Pin details
129    };
130    
131    
132    // List of class IDs and creator functions for the class factory. This
133    // provides the link between the OLE entry point in the DLL and an object
134    // being created. The class factory will call the static CreateInstance
135    
136    CFactoryTemplate g_Templates[] =
137    {
138            {
139                    XVID_NAME_L,
140                    &CLSID_XVID,
141                    CXvidDecoder::CreateInstance,
142                    NULL,
143                    &sudXvidDecoder
144            },
145            {
146                    XVID_NAME_L L"About",
147                    &CLSID_CABOUT,
148                    CAbout::CreateInstance
149            }
150    
151    };
152    
153    int g_cTemplates = sizeof(g_Templates) / sizeof(CFactoryTemplate);
154    
155    
156    STDAPI DllRegisterServer()
157    {
158        return AMovieDllRegisterServer2( TRUE );
159    }
160    
161    
162    STDAPI DllUnregisterServer()
163    {
164        return AMovieDllRegisterServer2( FALSE );
165    }
166    
167    
168    /* create instance */
169    
170    CUnknown * WINAPI CXvidDecoder::CreateInstance(LPUNKNOWN punk, HRESULT *phr)
171    {
172        CXvidDecoder * pNewObject = new CXvidDecoder(punk, phr);
173        if (pNewObject == NULL)
174            {
175            *phr = E_OUTOFMEMORY;
176        }
177        return pNewObject;
178    }
179    
180    
181    /* query interfaces */
182    
183    STDMETHODIMP CXvidDecoder::NonDelegatingQueryInterface(REFIID riid, void **ppv)
184    {
185            CheckPointer(ppv, E_POINTER);
186    
187            if (riid == IID_IXvidDecoder)
188            {
189                    return GetInterface((IXvidDecoder *) this, ppv);
190            }
191    
192            if (riid == IID_ISpecifyPropertyPages)
193            {
194            return GetInterface((ISpecifyPropertyPages *) this, ppv);
195            }
196    
197            return CVideoTransformFilter::NonDelegatingQueryInterface(riid, ppv);
198    }
199    
200    
201    
202    /* constructor */
203    
204    CXvidDecoder::CXvidDecoder(LPUNKNOWN punk, HRESULT *phr) :
205        CVideoTransformFilter(NAME("CXvidDecoder"), punk, CLSID_XVID)
206    {
207            DPRINTF("Constructor");
208    
209            xvid_gbl_init_t init;
210            memset(&init, 0, sizeof(init));
211            init.version = XVID_VERSION;
212            if (xvid_global(0, XVID_GBL_INIT, &init, NULL) < 0)
213            {
214                    MessageBox(0, "xvid_global() failed", "Error", 0);
215                    return;
216            }
217    
218            memset(&m_create, 0, sizeof(m_create));
219            m_create.version = XVID_VERSION;
220            m_create.handle = NULL;
221    
222            memset(&m_frame, 0, sizeof(m_frame));
223            m_frame.version = XVID_VERSION;
224    
225            HKEY hKey;
226            DWORD size;
227            RegOpenKeyEx(XVID_REG_KEY, XVID_REG_SUBKEY, 0, KEY_READ, &hKey);
228    
229            // Set the default post-processing settings
230            REG_GET_N("Brightness", PPSettings.nBrightness, 25)
231            REG_GET_N("Deblock_Y",  PPSettings.bDeblock_Y, 0)
232            REG_GET_N("Deblock_UV", PPSettings.bDeblock_UV, 0)
233            REG_GET_N("ForceColorspace", PPSettings.nForceColorspace, 0)
234    
235            RegCloseKey(hKey);
236    
237            USE_IYUV = false;
238            USE_YV12 = false;
239            USE_YUY2 = false;
240            USE_YVYU = false;
241            USE_UYVY = false;
242            USE_RGB32 = false;
243            USE_RGB24 = false;
244            USE_RG555 = false;
245            USE_RG565 = false;
246    
247            switch ( PPSettings.nForceColorspace )
248            {
249            case FORCE_NONE:
250                    USE_IYUV = true;
251                    USE_YV12 = true;
252                    USE_YUY2 = true;
253                    USE_YVYU = true;
254                    USE_UYVY = true;
255                    USE_RGB32 = true;
256                    USE_RGB24 = true;
257                    USE_RG555 = true;
258                    USE_RG565 = true;
259                    break;
260            case FORCE_YV12:
261                    USE_IYUV = true;
262                    USE_YV12 = true;
263                    break;
264            case FORCE_YUY2:
265                    USE_YUY2 = true;
266                    break;
267            case FORCE_RGB24:
268                    USE_RGB24 = true;
269                    break;
270            case FORCE_RGB32:
271                    USE_RGB32 = true;
272                    break;
273            }
274    }
275    
276    
277    
278    /* destructor */
279    
280    CXvidDecoder::~CXvidDecoder()
281    {
282            DPRINTF("Destructor");
283    
284            if (m_create.handle != NULL)
285            {
286                    xvid_decore(m_create.handle, XVID_DEC_DESTROY, 0, 0);
287                    m_create.handle = NULL;
288            }
289    }
290    
291    
292    
293    /* check input type */
294    
295    HRESULT CXvidDecoder::CheckInputType(const CMediaType * mtIn)
296    {
297            DPRINTF("CheckInputType");
298            BITMAPINFOHEADER * hdr;
299    
300            if (*mtIn->Type() != MEDIATYPE_Video)
301            {
302                    DPRINTF("Error: Unknown Type");
303                    return VFW_E_TYPE_NOT_ACCEPTED;
304            }
305    
306            if (*mtIn->FormatType() == FORMAT_VideoInfo)
307            {
308                    VIDEOINFOHEADER * vih = (VIDEOINFOHEADER *) mtIn->Format();
309                    hdr = &vih->bmiHeader;
310            }
311            else if (*mtIn->FormatType() == FORMAT_VideoInfo2)
312            {
313                    VIDEOINFOHEADER2 * vih2 = (VIDEOINFOHEADER2 *) mtIn->Format();
314                    hdr = &vih2->bmiHeader;
315            }
316            else
317            {
318                    DPRINTF("Error: Unknown FormatType");
319                    return VFW_E_TYPE_NOT_ACCEPTED;
320            }
321    
322            if (hdr->biHeight < 0)
323            {
324                    DPRINTF("colorspace: inverted input format not supported");
325            }
326    
327            m_create.width = hdr->biWidth;
328            m_create.height = hdr->biHeight;
329    
330            switch(hdr->biCompression)
331            {
332            case FOURCC_XVID :
333    //      case FOURCC_DIVX :
334    //      case FOURCC_DX50 :
335                    break;
336    
337            default :
338                    DPRINTF("Unknown fourcc: 0x%08x (%c%c%c%c)",
339                            hdr->biCompression,
340                            (hdr->biCompression)&0xff,
341                            (hdr->biCompression>>8)&0xff,
342                            (hdr->biCompression>>16)&0xff,
343                            (hdr->biCompression>>24)&0xff);
344                    return VFW_E_TYPE_NOT_ACCEPTED;
345            }
346    
347            return S_OK;
348    }
349    
350    
351    /* get list of supported output colorspaces */
352    
353    
354    HRESULT CXvidDecoder::GetMediaType(int iPosition, CMediaType *mtOut)
355    {
356            DPRINTF("GetMediaType");
357    
358            if (m_pInput->IsConnected() == FALSE)
359            {
360                    return E_UNEXPECTED;
361            }
362    
363            VIDEOINFOHEADER * vih = (VIDEOINFOHEADER *) mtOut->ReallocFormatBuffer(sizeof(VIDEOINFOHEADER));
364            if (vih == NULL)
365            {
366                    return E_OUTOFMEMORY;
367            }
368    
369            ZeroMemory(vih, sizeof (VIDEOINFOHEADER));
370            vih->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
371            vih->bmiHeader.biWidth  = m_create.width;
372            vih->bmiHeader.biHeight = m_create.height;
373            vih->bmiHeader.biPlanes = 1;
374    
375            if (iPosition < 0)
376            {
377                    return E_INVALIDARG;
378            }
379    
380            switch(iPosition)
381            {
382            case 0  :
383    if ( USE_IYUV )
384    {
385                    vih->bmiHeader.biCompression = CLSID_MEDIASUBTYPE_IYUV.Data1;
386                    vih->bmiHeader.biBitCount = 12;
387                    mtOut->SetSubtype(&CLSID_MEDIASUBTYPE_IYUV);
388                    break;
389    }
390            case 1  :
391    if ( USE_YV12 )
392    {
393                    vih->bmiHeader.biCompression = MEDIASUBTYPE_YV12.Data1;
394                    vih->bmiHeader.biBitCount = 12;
395                    mtOut->SetSubtype(&MEDIASUBTYPE_YV12);
396                    break;
397    }
398            case 2:
399    if ( USE_YUY2 )
400    {
401                    vih->bmiHeader.biCompression = MEDIASUBTYPE_YUY2.Data1;
402                    vih->bmiHeader.biBitCount = 16;
403                    mtOut->SetSubtype(&MEDIASUBTYPE_YUY2);
404                    break;
405    }
406            case 3 :
407    if ( USE_YVYU )
408    {
409                    vih->bmiHeader.biCompression = MEDIASUBTYPE_YVYU.Data1;
410                    vih->bmiHeader.biBitCount = 16;
411                    mtOut->SetSubtype(&MEDIASUBTYPE_YVYU);
412                    break;
413    }
414            case 4 :
415    if ( USE_UYVY )
416    {
417                    vih->bmiHeader.biCompression = MEDIASUBTYPE_UYVY.Data1;
418                    vih->bmiHeader.biBitCount = 16;
419                    mtOut->SetSubtype(&MEDIASUBTYPE_UYVY);
420                    break;
421    }
422            case 5 :
423    if ( USE_RGB32 )
424    {
425                    vih->bmiHeader.biCompression = BI_RGB;
426                    vih->bmiHeader.biBitCount = 32;
427                    mtOut->SetSubtype(&MEDIASUBTYPE_RGB32);
428                    break;
429    }
430            case 6 :
431    if ( USE_RGB24 )
432    {
433                    vih->bmiHeader.biCompression = BI_RGB;
434                    vih->bmiHeader.biBitCount = 24;
435                    mtOut->SetSubtype(&MEDIASUBTYPE_RGB24);
436                    break;
437    }
438            case 7 :
439    if ( USE_RG555 )
440    {
441                    vih->bmiHeader.biCompression = BI_RGB;
442                    vih->bmiHeader.biBitCount = 16;
443                    mtOut->SetSubtype(&MEDIASUBTYPE_RGB555);
444                    break;
445    }
446            case 8 :
447    if ( USE_RG565 )
448    {
449                    vih->bmiHeader.biCompression = BI_RGB;
450                    vih->bmiHeader.biBitCount = 16;
451                    mtOut->SetSubtype(&MEDIASUBTYPE_RGB565);
452                    break;
453    }
454            default :
455                    return VFW_S_NO_MORE_ITEMS;
456            }
457    
458            vih->bmiHeader.biSizeImage = GetBitmapSize(&vih->bmiHeader);
459    
460            mtOut->SetType(&MEDIATYPE_Video);
461            mtOut->SetFormatType(&FORMAT_VideoInfo);
462            mtOut->SetTemporalCompression(FALSE);
463            mtOut->SetSampleSize(vih->bmiHeader.biSizeImage);
464    
465            return S_OK;
466    }
467    
468    
469    /* (internal function) change colorspace */
470    
471    HRESULT CXvidDecoder::ChangeColorspace(GUID subtype, GUID formattype, void * format)
472    {
473            if (formattype == FORMAT_VideoInfo)
474            {
475                    VIDEOINFOHEADER * vih = (VIDEOINFOHEADER * )format;
476                    m_frame.output.stride[0] = (((vih->bmiHeader.biWidth * vih->bmiHeader.biBitCount) + 31) & ~31) >> 3;
477                    rgb_flip = (vih->bmiHeader.biHeight < 0 ? 0 : XVID_CSP_VFLIP);
478            }
479            else if (formattype == FORMAT_VideoInfo2)
480            {
481                    VIDEOINFOHEADER2 * vih2 = (VIDEOINFOHEADER2 * )format;
482                    m_frame.output.stride[0] = (((vih2->bmiHeader.biWidth * vih2->bmiHeader.biBitCount) + 31) & ~31) >> 3;
483                    rgb_flip = (vih2->bmiHeader.biHeight < 0 ? 0 : XVID_CSP_VFLIP);
484            }
485            else
486            {
487                    return S_FALSE;
488            }
489    
490            if (subtype == CLSID_MEDIASUBTYPE_IYUV)
491            {
492                    DPRINTF("IYUV");
493                    m_frame.output.csp = XVID_CSP_I420;
494                    m_frame.output.stride[0] = (m_frame.output.stride[0] * 2) / 3;  /* planar format fix */
495            }
496            else if (subtype == MEDIASUBTYPE_YV12)
497            {
498                    DPRINTF("YV12");
499                    m_frame.output.csp = XVID_CSP_YV12;
500                    m_frame.output.stride[0] = (m_frame.output.stride[0] * 2) / 3;  /* planar format fix */
501            }
502            else if (subtype == MEDIASUBTYPE_YUY2)
503            {
504                    DPRINTF("YUY2");
505                    m_frame.output.csp = XVID_CSP_YUY2;
506            }
507            else if (subtype == MEDIASUBTYPE_YVYU)
508            {
509                    DPRINTF("YVYU");
510                    m_frame.output.csp = XVID_CSP_YVYU;
511            }
512            else if (subtype == MEDIASUBTYPE_UYVY)
513            {
514                    DPRINTF("UYVY");
515                    m_frame.output.csp = XVID_CSP_UYVY;
516            }
517            else if (subtype == MEDIASUBTYPE_RGB32)
518            {
519                    DPRINTF("RGB32");
520                    m_frame.output.csp = rgb_flip | XVID_CSP_BGRA;
521            }
522            else if (subtype == MEDIASUBTYPE_RGB24)
523            {
524                    DPRINTF("RGB24");
525                    m_frame.output.csp = rgb_flip | XVID_CSP_BGR;
526            }
527            else if (subtype == MEDIASUBTYPE_RGB555)
528            {
529                    DPRINTF("RGB555");
530                    m_frame.output.csp = rgb_flip | XVID_CSP_RGB555;
531            }
532            else if (subtype == MEDIASUBTYPE_RGB565)
533            {
534                    DPRINTF("RGB565");
535                    m_frame.output.csp = rgb_flip | XVID_CSP_RGB565;
536            }
537            else if (subtype == GUID_NULL)
538            {
539                    m_frame.output.csp = XVID_CSP_NULL;
540            }
541            else
542            {
543                    return S_FALSE;
544            }
545    
546            return S_OK;
547    }
548    
549    
550    /* set output colorspace */
551    
552    HRESULT CXvidDecoder::SetMediaType(PIN_DIRECTION direction, const CMediaType *pmt)
553    {
554            DPRINTF("SetMediaType");
555    
556            if (direction == PINDIR_OUTPUT)
557            {
558                    return ChangeColorspace(*pmt->Subtype(), *pmt->FormatType(), pmt->Format());
559            }
560    
561            return S_OK;
562    }
563    
564    
565    /* check input<->output compatiblity */
566    
567    HRESULT CXvidDecoder::CheckTransform(const CMediaType *mtIn, const CMediaType *mtOut)
568    {
569            DPRINTF("CheckTransform");
570            return S_OK;
571    }
572    
573    
574    /* alloc output buffer */
575    
576    HRESULT CXvidDecoder::DecideBufferSize(IMemAllocator *pAlloc, ALLOCATOR_PROPERTIES *ppropInputRequest)
577    {
578            DPRINTF("DecideBufferSize");
579            HRESULT result;
580            ALLOCATOR_PROPERTIES ppropActual;
581    
582            if (m_pInput->IsConnected() == FALSE)
583            {
584                    return E_UNEXPECTED;
585            }
586    
587            ppropInputRequest->cBuffers = 1;
588            ppropInputRequest->cbBuffer = m_create.width * m_create.height * 4;
589            // cbAlign causes problems with the resize filter */
590            // ppropInputRequest->cbAlign = 16;
591            ppropInputRequest->cbPrefix = 0;
592    
593            result = pAlloc->SetProperties(ppropInputRequest, &ppropActual);
594            if (result != S_OK)
595            {
596                    return result;
597            }
598    
599            if (ppropActual.cbBuffer < ppropInputRequest->cbBuffer)
600            {
601                    return E_FAIL;
602            }
603    
604            return S_OK;
605    }
606    
607    
608    /* decode frame */
609    
610    HRESULT CXvidDecoder::Transform(IMediaSample *pIn, IMediaSample *pOut)
611    {
612            DPRINTF("Transform");
613            xvid_dec_stats_t stats;
614        int length;
615    
616            memset(&stats, 0, sizeof(stats));
617            stats.version = XVID_VERSION;
618    
619            if (m_create.handle == NULL)
620            {
621                    if (xvid_decore(0, XVID_DEC_CREATE, &m_create, 0) < 0)
622                    {
623                DPRINTF("*** XVID_DEC_CREATE error");
624                            return S_FALSE;
625                    }
626            }
627    
628            AM_MEDIA_TYPE * mtOut;
629            pOut->GetMediaType(&mtOut);
630            if (mtOut != NULL)
631            {
632                    HRESULT result;
633    
634                    result = ChangeColorspace(mtOut->subtype, mtOut->formattype, mtOut->pbFormat);
635                    DeleteMediaType(mtOut);
636    
637                    if (result != S_OK)
638                    {
639                DPRINTF("*** ChangeColorspace error");
640                            return result;
641                    }
642            }
643    
644            m_frame.length = pIn->GetActualDataLength();
645            if (pIn->GetPointer((BYTE**)&m_frame.bitstream) != S_OK)
646            {
647                    return S_FALSE;
648            }
649    
650            if (pOut->GetPointer((BYTE**)&m_frame.output.plane[0]) != S_OK)
651            {
652                    return S_FALSE;
653            }
654    
655            m_frame.general = XVID_LOWDELAY;
656    
657            if (pIn->IsDiscontinuity() == S_OK)
658                    m_frame.general = XVID_DISCONTINUITY;
659    
660            if (PPSettings.bDeblock_Y)
661                    m_frame.general |= XVID_DEBLOCKY;
662    
663            if (PPSettings.bDeblock_UV)
664                    m_frame.general |= XVID_DEBLOCKUV;
665    
666            if (PPSettings.bFlipVideo) {
667                    if (rgb_flip)
668                            m_frame.output.csp &= ~XVID_CSP_VFLIP;
669                    else
670                            m_frame.output.csp |= XVID_CSP_VFLIP;
671            }
672            else {
673                    if (rgb_flip)
674                            m_frame.output.csp |= XVID_CSP_VFLIP;
675                    else
676                            m_frame.output.csp &= ~XVID_CSP_VFLIP;
677            }
678    
679    repeat :
680    
681            if (pIn->IsPreroll() != S_OK)
682            {
683                    length = xvid_decore(m_create.handle, XVID_DEC_DECODE, &m_frame, &stats);
684    
685                    if (length < 0)
686                    {
687                DPRINTF("*** XVID_DEC_DECODE");
688                            return S_FALSE;
689                    }
690            }
691            else
692            {
693                    int tmp = m_frame.output.csp;
694                    m_frame.output.csp = XVID_CSP_NULL;
695    
696                    length = xvid_decore(m_create.handle, XVID_DEC_DECODE, &m_frame, &stats);
697                    if (length < 0)
698                    {
699                DPRINTF("*** XVID_DEC_DECODE");
700                            return S_FALSE;
701                    }
702    
703                    m_frame.output.csp = tmp;
704            }
705    
706            if (stats.type == XVID_TYPE_NOTHING) {
707                    DPRINTF("B-Frame decoder lag");
708                    return S_FALSE;
709            }
710    
711    
712            if (stats.type == XVID_TYPE_VOL)
713            {
714                    if (stats.data.vol.width != m_create.width ||
715                            stats.data.vol.height != m_create.height)
716                    {
717                            DPRINTF("TODO: auto-resize");
718                            return S_FALSE;
719                    }
720    
721                    m_frame.bitstream = (BYTE*)m_frame.bitstream + length;
722                    m_frame.length -= length;
723                    goto repeat;
724            }
725    
726            return S_OK;
727    }
728    
729    
730    /* get property page list */
731    
732    STDMETHODIMP CXvidDecoder::GetPages(CAUUID * pPages)
733    {
734            DPRINTF("GetPages");
735    
736            pPages->cElems = 1;
737            pPages->pElems = (GUID *)CoTaskMemAlloc(pPages->cElems * sizeof(GUID));
738            if (pPages->pElems == NULL)
739            {
740                    return E_OUTOFMEMORY;
741            }
742            pPages->pElems[0] = CLSID_CABOUT;
743    
744            return S_OK;
745    }
746    
747    
748    /* cleanup pages */
749    
750    STDMETHODIMP CXvidDecoder::FreePages(CAUUID * pPages)
751    {
752            DPRINTF("FreePages");
753            CoTaskMemFree(pPages->pElems);
754            return S_OK;
755    }

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.1.2.5

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