28.11.2012 Views

Procesamiento digital de video en tiempo real y - Maestría en ...

Procesamiento digital de video en tiempo real y - Maestría en ...

Procesamiento digital de video en tiempo real y - Maestría en ...

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>Procesami<strong>en</strong>to</strong> <strong>digital</strong> <strong>de</strong> vi<strong>de</strong>o <strong>en</strong> <strong>tiempo</strong> <strong>real</strong> y “vi<strong>de</strong>o wall” con la PC 68<br />

Se <strong>de</strong>clara un arreglo global g_Templates objeto CFactoryTemplate para informar a<br />

la clase factory como acce<strong>de</strong>r a la función CreateInstance:<br />

// La clase factory llamará a CreateInstance<br />

CFactoryTemplate g_Templates[] = {<br />

{ L"Image Effects"<br />

, &CLSID_EZrgb24<br />

, CEZrgb24::CreateInstance<br />

, NULL<br />

, &sudEZrgb24 }<br />

,<br />

{ L"Special Effects"<br />

, &CLSID_EZrgb24PropertyPage<br />

, CEZrgb24Properties::CreateInstance }<br />

};<br />

Observe que se ha añadido parámetros para la pagina propietaria que manejará el filtro.<br />

Se g<strong>en</strong>era un GUID par el objeto filtro, este i<strong>de</strong>ntificador, permite que nuestro filtro<br />

t<strong>en</strong>ga un numero único <strong>en</strong> todo el mundo, y así su posible uso <strong>en</strong> ambi<strong>en</strong>tes distribuidos.<br />

Para g<strong>en</strong>erar un GUID, se ejecuta el programa g<strong>en</strong>erador uuidg<strong>en</strong>.exe ubicado <strong>en</strong> el<br />

subdirectorio bin <strong>de</strong> directX. Finalm<strong>en</strong>te se agrega el GUID para nuestro filtro quedando<br />

como sigue:<br />

DEFINE_GUID(CLSID_EZrgb24,<br />

0x8b498501, 0x1218, 0x11cf, 0xad, 0xc4, 0x0, 0xa0, 0xd1, 0x0, 0x4, 0x1b);<br />

Dado que nuestro filtro implem<strong>en</strong>ta una interfaz que no se <strong>en</strong>cu<strong>en</strong>tra hecha <strong>en</strong> la<br />

clase base, nos referimos a la clase propietaria, <strong>en</strong>tonces <strong>de</strong>bemos escribir la función<br />

NonDelegatingQueryInterface y regresar apuntadores a la interfaz implem<strong>en</strong>tada. La<br />

función se coloca <strong>en</strong> la sección public <strong>de</strong> la <strong>de</strong>finición <strong>de</strong> nuestra clase filtro.<br />

// NonDelegatingQueryInterface<br />

//<br />

// Pres<strong>en</strong>ta las paginas propietarias IIPEffect y ISpecifyPropertyPages<br />

//<br />

STDMETHODIMP CEZrgb24::NonDelegatingQueryInterface(REFIID riid, void **ppv)<br />

{<br />

CheckPointer(ppv,E_POINTER);<br />

if (riid == IID_IIPEffect) {<br />

return GetInterface((IIPEffect *) this, ppv);<br />

} else if (riid == IID_ISpecifyPropertyPages) {<br />

return GetInterface((ISpecifyPropertyPages *) this, ppv);<br />

} else {<br />

return CTransformFilter::NonDelegatingQueryInterface(riid, ppv);<br />

}<br />

} // NonDelegatingQueryInterface<br />

El Manejador <strong>de</strong>l gráfico <strong>de</strong> filtros utiliza las <strong>en</strong>tradas <strong>de</strong> registro <strong>de</strong> nuestro filtro<br />

para configurarlo asi como a sus conexiones. Nosotros proveemos la información <strong>de</strong><br />

registro <strong>de</strong> nuestro filtro <strong>en</strong> las estructuras AMOVIESETUP_MEDIATYPE,<br />

AMOVIESETUP_PIN, y AMOVIESETUP_FILTER.<br />

La estructura AMOVIESETUP_MEDIATYPE manti<strong>en</strong>e información <strong>de</strong> registro<br />

acerca <strong>de</strong> los tipos <strong>de</strong> media que nuestro filtro soporta.<br />

// Información <strong>de</strong> Setup<br />

const AMOVIESETUP_MEDIATYPE sudPinTypes =

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!