Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. Using Camera with DirectShow in Windows Mobile
Forum Updated to NodeBB v4.3 + New Features

Using Camera with DirectShow in Windows Mobile

Scheduled Pinned Locked Moved Mobile and Embedded
9 Posts 3 Posters 6.2k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • H Offline
    H Offline
    Headman
    wrote on 15 Mar 2011, 11:34 last edited by
    #1

    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.

    1 Reply Last reply
    0
    • A Offline
      A Offline
      andre
      wrote on 15 Mar 2011, 11:38 last edited by
      #2

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

      1 Reply Last reply
      0
      • T Offline
        T Offline
        tobias.hunger
        wrote on 15 Mar 2011, 12:56 last edited by
        #3

        How is this Qt related?

        1 Reply Last reply
        0
        • H Offline
          H Offline
          Headman
          wrote on 15 Mar 2011, 13:05 last edited by
          #4

          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

          1 Reply Last reply
          0
          • A Offline
            A Offline
            andre
            wrote on 15 Mar 2011, 13:14 last edited by
            #5

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

            1 Reply Last reply
            0
            • H Offline
              H Offline
              Headman
              wrote on 15 Mar 2011, 13:59 last edited by
              #6

              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?)

              1 Reply Last reply
              0
              • A Offline
                A Offline
                andre
                wrote on 15 Mar 2011, 16:15 last edited by
                #7

                [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?

                1 Reply Last reply
                0
                • H Offline
                  H Offline
                  Headman
                  wrote on 16 Mar 2011, 09:29 last edited by
                  #8

                  sure, they are

                  1 Reply Last reply
                  0
                  • A Offline
                    A Offline
                    andre
                    wrote on 16 Mar 2011, 09:45 last edited by
                    #9

                    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...

                    1 Reply Last reply
                    0

                    1/9

                    15 Mar 2011, 11:34

                    • Login

                    • Login or register to search.
                    1 out of 9
                    • First post
                      1/9
                      Last post
                    0
                    • Categories
                    • Recent
                    • Tags
                    • Popular
                    • Users
                    • Groups
                    • Search
                    • Get Qt Extensions
                    • Unsolved