Using Camera with DirectShow in Windows Mobile



  • Has anybody experience with this?

    I used the CodeExample from Microsofts WM SDK, included all libs and call the functions in my own code in the same order. No Compiling error but it doesn´t work.



  • "It doesn't work" is way too vague to give any meaningful answer to.


  • Moderators

    How is this Qt related?



  • The CodeExample:
    Windows Mobile 6 SDK\Samples\PocketPC\CPP\win32\CameraCapture

    I included graphmanager.cpp and cpropertybag.cpp (and Headers) into my QT-Project.

    In my QDialog i´ve a frame where I want to show the Preview of the Camera, todo this i included the code from the Example in a function called InitializeGraph()

    @
    bool Beladezustand::InitializeGraph()
    {

    HRESULT hr;
        wchar_t szDevicename[MAX_PATH] = L"\0";
        CPropertyBag PropBag;
        CComVariant varCamName;
        CComPtr<IGraphBuilder> pFilterGraph;
            CComPtr<ICaptureGraphBuilder2> pCaptureGraphBuilder;
            CComPtr<IBaseFilter> pVideoCaptureFilter;
            CComPtr<IPersistPropertyBag> pPropertyBag;
        CComPtr<IMediaControl> pMediaControl;
            IVideoWindow *pVidWin;
    
            //Capture Graph anlegen
            hr = CoCreateInstance(CLSID_CaptureGraphBuilder, NULL, CLSCTX_INPROC_SERVER, IID_ICaptureGraphBuilder2, (void **)&pCaptureGraphBuilder);
        hr = CoCreateInstance(CLSID_FilterGraph, NULL, CLSCTX_INPROC_SERVER,IID_IGraphBuilder, (void **)&pFilterGraph);
        hr = pCaptureGraphBuilder->SetFiltergraph( pFilterGraph );
            //Media Control abrufen
            hr = pFilterGraph->QueryInterface(IID_IMediaControl,(void **)&pMediaControl);
        //Video Window abrufen
            hr = pFilterGraph->QueryInterface(IID_IVideoWindow,(void **)&pVidWin);
        //Capture Filter anlegen
            hr = CoCreateInstance(CLSID_VideoCapture, NULL, CLSCTX_INPROC,IID_IBaseFilter, (void**)&pVideoCaptureFilter);
        //IPersistPropertyBag abrufen
            hr = pVideoCaptureFilter->QueryInterface( &pPropertyBag );
            //Kamera laden
        GetFirstCameraDriver(szDevicename);
        varCamName = szDevicename;
        hr = PropBag.Write( L"VCapName", &varCamName );
        hr = pPropertyBag->Load( &PropBag, NULL );
        hr = pFilterGraph->AddFilter( pVideoCaptureFilter, L"Video Capture Filter Source" );
       
        //Mit dem Preview PIN verbinden
            hr = pCaptureGraphBuilder->RenderStream(&PIN_CATEGORY_PREVIEW, &MEDIATYPE_Video, pVideoCaptureFilter, NULL, NULL);
            //Das Preview Fenster setzen
    

    // CRect rc;
    // ::GetClientRect(m_hWnd,&rc);

            hr = pVidWin->put_Owner((OAHWND)frame->winId());               //<-- QT Frame where i want to show the Camera-Preview in
    
        hr = pVidWin->put_WindowStyle(WS_CHILD | WS_CLIPSIBLINGS);
        long pWidth, pHeight;
        hr = pVidWin->get_Width(&pWidth);
        hr = pVidWin->get_Height(&pHeight);
            hr = pVidWin->put_Height(215);
            hr = pVidWin->put_Width(162);
        //hr = pVidWin->SetWindowPosition(0,0,162,215);
        //Den Stream abspielen (Preview anzeigen)
            hr = pMediaControl->Run();
    

    }
    @

    I just wonder why the CodeExample from MS works and why not in my Qt-Project. Perhaps it works but the the delivered frame->winId() does not work for the MS functions...

    EDIT: please sorround code by @-tags, Gerolf



  • Are you using the same compiler as the libs you link against?



  • Hm, I compiled the CodeExample with VisualStudio 2008, my QT Projekt with QTCreator 1.3.0 (Qt 4.6.0) using nmake.exe (which is VS2008 or not?)



  • [quote author="Headman" date="1300197594"]Hm, I compiled the CodeExample with VisualStudio 2008, my QT Projekt with QTCreator 1.3.0 (Qt 4.6.0) using nmake.exe (which is VS2008 or not?)[/quote]
    And your Qt libs are compiled with that as well, are they not?



  • sure, they are



  • I have no experience with debugging on windows mobile. Is there a way to get some debug output when trying to start the application? Does that yield anything?

    Are you sure all your libraries and your application are in the same compile mode (debug or release)? I am just giving some suggestions on what might be wrong here...


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.