To compile the VideoCapture module

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Jérôme Le Bougeant

    #1

    To compile the VideoCapture module

    Hello (and sorry for my English),



    I downloaded the VideoCapture module on the
    http://videocapture.sourceforge.net/ site. I tested it with a webcam and
    that functions.

    Now I want to compile his file .cpp (vidcap.cpp). Thereafter, the idea is to
    be able to modify the code to include my own modifications.

    For the moment I only try to compile, but does not arrive :(

    I will try to pose my problem :

    First of all I am under Windows xp because I must use DirectX. I use the
    MinGW compiler. I use following script (setup.py) to be able to compile :




    nomModule = 'vidcap'

    from distutils.core import setup, Extension

    setup(name = nomModule, ext_modules = [ Extension(nomMo dule, sources = [
    nomModule+'.cpp '],\

    include_dirs=["C:\DX90SDK\Inc lude","C:\DX90S DK\Samples\C++\ DirectShow\Base Classes"],\

    library_dirs=["C:\Python23\li bs","C:\DX90SDK \Lib","C:\Pytho n23\Enthought\M ingW\lib"])
    ])

    The include_dirs enable me to indicate the access path has my .h that I
    need. And library_dirs in theory the libraries which I need (I say in theory
    because I do not have the impression that it takes into account, but we will
    return later).

    I try so the first compilation with : python setup.py build

    I have a few errors

    I try to resolve them

    Here the modifications which I have of bringing :

    In strmif.h:

    line 6164 : replace #ifndef _WINGDI_ by #ifndef _WINGDI_H

    line 20557 : Add EXTERN_GUID definition just before first EXTERN_GUID():

    #ifndef EXTERN_GUID

    #define EXTERN_GUID(g,l 1,s1,s2,c1,c2,c 3,c4,c5,c6,c7,c 8)
    DEFINE_GUID(g,l 1,s1,s2,c1,c2,c 3,c4,c5,c6,c7,c 8)

    #endif

    line 28736 : Fix the tagVMRGUID struct (GUID -::GUID)

    ::GUID *pGUID;

    ::GUID GUID;

    Put UrlMon.h in the file include of DX90SDK (recover it in Microsoft
    Platform SDK) in the same way for MsXml.h.

    Then to define uCLSSPEC and QUERYCONTEXT, I have includes their definition
    directly in my file .cpp :

    //--------------------------------------------------------------------------------------

    // definitions recuperées de c:\Program Files\Microsoft Plateform
    SDK\include\WTy pes.h

    typedef struct tagCSPLATFORM

    {

    DWORD dwPlatformId;

    DWORD dwVersionHi;

    DWORD dwVersionLo;

    DWORD dwProcessorArch ;

    } CSPLATFORM;

    #ifndef _LCID_DEFINED

    #define _LCID_DEFINED

    typedef DWORD LCID;

    #endif // !_LCID_DEFINED

    typedef struct tagQUERYCONTEXT

    {

    DWORD dwContext;

    CSPLATFORM Platform;

    LCID Locale;

    DWORD dwVersionHi;

    DWORD dwVersionLo;

    } QUERYCONTEXT;

    typedef WCHAR OLECHAR;

    typedef OLECHAR *LPOLESTR;

    typedef struct __MIDL___MIDL_i tf_wtypes_0003_ 0001

    {

    DWORD tyspec;

    union __MIDL___MIDL_i tf_wtypes_0003_ 0005

    {

    CLSID clsid;

    LPOLESTR pFileExt;

    LPOLESTR pMimeType;

    LPOLESTR pProgId;

    LPOLESTR pFileName;

    struct

    {

    LPOLESTR pPackageName;

    GUID PolicyId;

    } ByName;

    struct

    {

    GUID ObjectId;

    GUID PolicyId;

    } ByObjectId;

    } tagged_union;

    } uCLSSPEC;

    //--------------------------------------------------------------------------------------

    Last thing modified in vidcap.cpp :

    line 774 : /*statichere*/ PyTypeObject Dev_Type = {


    Comment out statichere, because it was already declared in extern.



    After all these modifications, I compile again and no errors but...

    Here what I obtain with compilation :


    running install

    running build

    running build_ext

    building 'vidcap' extension

    C:\Python23\Ent hought\MingW\bi n\gcc.exe -mno-cygwin -mdll -O -Wall -IC:\DX90SDK\Inc lude
    -IC:\DX

    90SDK\Samples\C ++\DirectShow\B aseClasses -Ic:\Python23\in clude -Ic:\Python23\PC
    -c vidcap.cpp -

    o build\temp.win3 2-2.3\Release\vid cap.o

    In file included from C:/DX90SDK/Include/dshow.h:46,

    from vidcap.cpp:24:

    C:/DX90SDK/Include/strmif.h:2: warning: ignoring #pragma warning

    In file included from C:/DX90SDK/Include/dshow.h:46,

    from vidcap.cpp:24:

    C:/DX90SDK/Include/strmif.h:877: warning: ignoring #pragma warning

    C:/DX90SDK/Include/strmif.h:878: warning: ignoring #pragma warning

    C:/DX90SDK/Include/strmif.h:30645: warning: ignoring #pragma warning

    In file included from C:/DX90SDK/Include/dshow.h:49,

    from vidcap.cpp:24:

    C:/DX90SDK/Include/control.h:2: warning: ignoring #pragma warning

    In file included from vidcap.cpp:73:

    C:/DX90SDK/Include/qedit.h:2: warning: ignoring #pragma warning

    In file included from C:/DX90SDK/Include/qedit.h:492,

    from vidcap.cpp:73:

    C:/DX90SDK/Include/dxtrans.h:2: warning: ignoring #pragma warning

    In file included from C:/DX90SDK/Include/d3d.h:189,

    from C:/DX90SDK/Include/dxtrans.h:278,

    from C:/DX90SDK/Include/qedit.h:492,

    from vidcap.cpp:73:

    C:/DX90SDK/Include/d3dtypes.h:26: warning: ignoring #pragma warning

    C:/DX90SDK/Include/d3dtypes.h:2116 : warning: ignoring #pragma warning

    In file included from C:/DX90SDK/Include/dxtrans.h:280,

    from C:/DX90SDK/Include/qedit.h:492,

    from vidcap.cpp:73:

    C:/DX90SDK/Include/urlmon.h:17: warning: ignoring #pragma warning

    In file included from C:/DX90SDK/Include/urlmon.h:278,

    from C:/DX90SDK/Include/dxtrans.h:280,

    from C:/DX90SDK/Include/qedit.h:492,

    from vidcap.cpp:73:

    C:/DX90SDK/Include/msxml.h:17: warning: ignoring #pragma warning

    In file included from C:/DX90SDK/Include/dxtrans.h:280,

    from C:/DX90SDK/Include/qedit.h:492,

    from vidcap.cpp:73:

    C:/DX90SDK/Include/urlmon.h:301: warning: ignoring #pragma comment

    In file included from C:/DX90SDK/Include/qedit.h:493,

    from vidcap.cpp:73:

    C:/DX90SDK/Include/amstream.h:2: warning: ignoring #pragma warning

    In file included from C:/DX90SDK/Include/amstream.h:107,

    from C:/DX90SDK/Include/qedit.h:493,

    from vidcap.cpp:73:

    C:/DX90SDK/Include/mmstream.h:2: warning: ignoring #pragma warning

    In file included from C:/DX90SDK/Include/amstream.h:108,

    from C:/DX90SDK/Include/qedit.h:493,

    from vidcap.cpp:73:

    C:/DX90SDK/Include/strmif.h:2: warning: ignoring #pragma warning

    In file included from C:/DX90SDK/Include/amstream.h:122,

    from C:/DX90SDK/Include/qedit.h:493,

    from vidcap.cpp:73:

    C:/DX90SDK/Include/mmstream.h:2: warning: ignoring #pragma warning

    In file included from C:/DX90SDK/Include/amstream.h:123,

    from C:/DX90SDK/Include/qedit.h:493,

    from vidcap.cpp:73:

    C:/DX90SDK/Include/ddstream.h:2: warning: ignoring #pragma warning

    In file included from C:/DX90SDK/Include/ddstream.h:59,

    from C:/DX90SDK/Include/amstream.h:123,

    from C:/DX90SDK/Include/qedit.h:493,

    from vidcap.cpp:73:

    C:/DX90SDK/Include/mmstream.h:2: warning: ignoring #pragma warning

    In file included from C:/DX90SDK/Include/amstream.h:124,

    from C:/DX90SDK/Include/qedit.h:493,

    from vidcap.cpp:73:

    C:/DX90SDK/Include/austream.h:2: warning: ignoring #pragma warning

    In file included from C:/DX90SDK/Include/austream.h:71,

    from C:/DX90SDK/Include/amstream.h:124,

    from C:/DX90SDK/Include/qedit.h:493,

    from vidcap.cpp:73:

    C:/DX90SDK/Include/mmstream.h:2: warning: ignoring #pragma warning

    writing build\temp.win3 2-2.3\Release\vid cap.def

    cc -mno-cygwin -shared -s build\temp.win3 2-2.3\Release\vid cap.o
    build\temp.win3 2-2.3\Release\vid cap.def -LC:\Python23\li bs -LC:\DX90SDK\Lib
    -LC:\Python23\En thought\MingW\l ib -Lc:\Python23\li bs -Lc:\Python23\PC Build -lpython23
    -o build\lib.win32-2.3\vidcap.pyd

    error: command 'cc' failed: No such file or directory

    I obtain warning, but I think that we can be to ignore them.

    (#pragma warning( disable: 4049 ) /* more than 64k source lines */)

    Then my problem it is that it does not create my module .pyd. Maybe linker
    error ? But I don't see why that command 'cc' failed ! (I use gcc)

    I think the part C:\Python23\Ent hought\MingW\bi n\g in beginning line was
    disappeared !

    I try to run all this command line, i.e. :

    C:\Python23\Ent hought\MingW\bi n\gcc -mno-cygwin -shared -s
    build\temp.win3 2-2.3\Release\vid cap.o
    build\temp.win3 2-2.3\Release\vid cap.def -LC:\Python23\li bs -LC:\DX90SDK\Lib
    -LC:\Python23\En thought\MingW\l ib -Lc:\Python23\li bs -Lc:\Python23\PC Build -lpython23
    -o build\lib.win32-2.3\vidcap.pyd


    Here a part of result :


    build\temp.win3 2-2.3\Release\vid cap.o(.text+0x5 70):vidcap.cpp: undefined
    reference to `IID_IGraphBuil der'

    build\temp.win3 2-2.3\Release\vid cap.o(.text+0x5 79):vidcap.cpp: undefined
    reference to `CLSID_FilterGr aph'

    build\temp.win3 2-2.3\Release\vid cap.o(.text+0x5 7e):vidcap.cpp: undefined
    reference to `CoCreateInstan ce@20'

    build\temp.win3 2-2.3\Release\vid cap.o(.text+0x5 9e):vidcap.cpp: undefined
    reference to `IID_ICaptureGr aphBuilder2'

    build\temp.win3 2-2.3\Release\vid cap.o(.text+0x5 a7):vidcap.cpp: undefined
    reference to `CLSID_CaptureG raphBuilder2'

    build\temp.win3 2-2.3\Release\vid cap.o(.text+0x5 ac):vidcap.cpp: undefined
    reference to `CoCreateInstan ce@20'

    ....


    I think it is a problem of linker error. However I show the right directory
    to recover libraries
    (-LC:\Python23\li bs -LC:\DX90SDK\Lib -LC:\Python23\En thought\MingW\l ib), but
    apparently does not take into account.





    In short, how to make ?

    If I did not take the right method of resolution of my problem, how then I
    do to proceed ?




    Thanks for any ideas.







    Ps : I also wanted to compile it under dev-cpp to see. Result, same problem,
    but only 5 or 6 linker errors.

    I include in the parameters of linker :

    C:/Python23/libs/libpython23.a

    C:/DX90SDK/Lib/amstrmid.lib

    C:/Python23/Enthought/MingW/lib/libole32.a

    C:/Python23/Enthought/MingW/lib/liboleaut32.a







    Regards,




    Jérôme


Working...