Results 1 to 9 of 9

Thread: Qt application with live Active X camera feed.

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2006
    Posts
    70
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    13
    Thanked 5 Times in 5 Posts

    Default Re: Qt application with live Active X camera feed.

    This should be all the code you would need. Just create a basic Qt app with a custom widget. Then place the above code in the constructor for the widget.

  2. #2
    Join Date
    Sep 2010
    Posts
    2
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Qt application with live Active X camera feed.

    Hi, I know the last message for this thread was in 2006, but I try !

    I want to do exactly the same thing. So I have created a new widget which has a QAxWidget. Here is the constructor code of my new widget class :

    Qt Code:
    1. AxisMediaControlWidget::AxisMediaControlWidget(QWidget *parent, Qt::WFlags flags)
    2. : QWidget(parent, flags)
    3. {
    4. m_axis = new QAxWidget(this);
    5. m_glay = new QGridLayout(this);
    6.  
    7. m_axis->setControl(QString::fromUtf8("{745395C8-D0E1-4227-8586-624CA9A10A8D}"));
    8. m_axis->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
    9. m_axis->setObjectName(QString::fromUtf8("CAxismediacontrol"));
    10.  
    11. EXCEPINFO excepInfo;
    12. memset(&excepInfo, 0, sizeof excepInfo);
    13.  
    14. UINT nArgErr = (UINT)-1; // initialize to invalid arg
    15.  
    16. DISPPARAMS dispparams;
    17. memset(&dispparams, 0, sizeof dispparams);
    18. dispparams.cArgs = 1;
    19. dispparams.cNamedArgs = 1;
    20. DISPID dispidNamed = DISPID_PROPERTYPUT;
    21. dispparams.rgdispidNamedArgs = &dispidNamed;
    22. VARIANT* pArg = new VARIANT[dispparams.cArgs];
    23. dispparams.rgvarg = pArg;
    24. memset(pArg, 0, sizeof(VARIANT) * dispparams.cArgs);
    25.  
    26. IDispatch *iface = 0;
    27. m_axis->queryInterface((QUuid)IID_IDispatch, (void**)&iface);
    28. if (iface)
    29. {
    30. pArg->vt = VT_EMPTY;
    31. dispparams.cArgs = 0;
    32. dispparams.cNamedArgs = 0;
    33. iface->Invoke(102, IID_NULL, 0, DISPATCH_METHOD, &dispparams, 0, &excepInfo, &nArgErr);
    34.  
    35. dispparams.cArgs = 1;
    36. dispparams.cNamedArgs = 1;
    37. // put_PTZControlURL
    38. pArg->bstrVal = (L"http://10.67.148.30/axis-cgi/com/ptz.cgi");
    39. iface->Invoke(0x1e, IID_NULL, 0, DISPATCH_PROPERTYPUT, &dispparams, 0, &excepInfo, &nArgErr);
    40.  
    41. // put_UIMode
    42. pArg->bstrVal = _T("ptz-absolute");
    43. iface->Invoke(0x3, IID_NULL, 0, DISPATCH_PROPERTYPUT, &dispparams, 0, &excepInfo, &nArgErr);
    44.  
    45. pArg->vt = VT_BOOL;
    46. pArg->boolVal = VARIANT_TRUE;
    47. iface->Invoke(0x12, IID_NULL, 0, DISPATCH_PROPERTYPUT, &dispparams, 0, &excepInfo, &nArgErr);
    48.  
    49. iface->Invoke(0x11, IID_NULL, 0, DISPATCH_PROPERTYPUT, &dispparams, 0, &excepInfo, &nArgErr);
    50.  
    51. iface->Invoke(0x10, IID_NULL, 0, DISPATCH_PROPERTYPUT, &dispparams, 0, &excepInfo, &nArgErr);
    52.  
    53. iface->Invoke(0x73, IID_NULL, 0, DISPATCH_PROPERTYPUT, &dispparams, 0, &excepInfo, &nArgErr);
    54.  
    55. iface->Invoke(0x75, IID_NULL, 0, DISPATCH_PROPERTYPUT, &dispparams, 0, &excepInfo, &nArgErr);
    56.  
    57. pArg->vt = VT_BSTR;
    58. pArg->bstrVal = (L"default,+ptz");
    59. iface->Invoke(0x13, IID_NULL, 0, DISPATCH_PROPERTYPUT, &dispparams, 0, &excepInfo, &nArgErr);
    60.  
    61. pArg->bstrVal = (L"http://10.67.148.30/axis-cgi/mjpg/video.cgi");
    62. iface->Invoke(1, IID_NULL, 0, DISPATCH_PROPERTYPUT, &dispparams, 0, &excepInfo, &nArgErr);
    63.  
    64. pArg->bstrVal = (L"mjpg");
    65. iface->Invoke(9, IID_NULL, 0, DISPATCH_PROPERTYPUT, &dispparams, 0, &excepInfo, &nArgErr);
    66.  
    67. // Play
    68. pArg->vt = VT_EMPTY;
    69. dispparams.cArgs = 0;
    70. dispparams.cNamedArgs = 0;
    71. dispparams.rgdispidNamedArgs = 0;
    72. dispparams.rgvarg = 0;
    73. iface->Invoke(101, IID_NULL, 0, DISPATCH_METHOD, &dispparams, 0, &excepInfo, &nArgErr);
    74.  
    75. iface->Release();
    76. }
    77. m_glay->addWidget(m_axis, 0, 0);
    78. }
    To copy to clipboard, switch view to plain text mode 

    When I display my new widget in a QDialog, I have the tool bar I want to display but the frame where the video must be displayed stay white.

    Do you have an idea why it doesn't work ?

  3. #3
    Join Date
    Aug 2011
    Posts
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Qt application with live Active X camera feed.

    Only for future readers who will find this post from google like me :-) There is more simple way to do it. My code:

    Qt Code:
    1. #include <ActiveQt/qaxwidget.h>
    2. #include <QtGui/qapplication.h>
    3.  
    4. int main(int argc, char *argv[])
    5. {
    6. QApplication a(argc, argv);
    7. w.setControl(QString::fromUtf8("{745395C8-D0E1-4227-8586-624CA9A10A8D}"));
    8. w.setObjectName(QString::fromUtf8("Axis Video"));
    9. w.setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
    10. w.show();
    11.  
    12. w.dynamicCall("MediaURL", "http://10.0.0.10/axis-cgi/mjpg/video.cgi");
    13. w.dynamicCall("MediaType", "mjpeg-unicast");
    14. w.dynamicCall("StretchToFit", "true");
    15. w.dynamicCall("Play()");
    16. return a.exec();
    17. }
    To copy to clipboard, switch view to plain text mode 

  4. #4
    Join Date
    Sep 2012
    Posts
    1
    Qt products
    PyQt3 PyQt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Qt application with live Active X camera feed.

    May be this software could help to you, its really awesome http://www.videocapx.com

Similar Threads

  1. Problem with Painter in Qt4.4.1
    By merry in forum Qt Programming
    Replies: 1
    Last Post: 1st September 2008, 13:47

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.