Results 1 to 4 of 4

Thread: video-streaming MythTV

  1. #1
    Join Date
    Apr 2010
    Posts
    13
    Qt products
    Qt3 Qt4 Qt/Embedded

    Default video-streaming MythTV

    Hello I have implemented a video streaming client based on a Qt MythUI client. There is a server implemented in JAVA for sending images an frames and threre is also other client developed in Qt for reveiving all the images and representing them . The code of the client is developed in a class called NetworkControl and it is the following :

    Qt Code:
    1. void NetworkControl::aceptar_conexiones()
    2. {
    3.  
    4. QTcpSocket *soket = new QTcpSocket(this);
    5. const QString direc ="xxxxxxxxxx";
    6. quint16 port = 4445;
    7. soket->connectToHOst(direc,port)
    8. connect(soket,SIGNAL(readyRead()),this,SLOT(leercaracter()))
    9.  
    10. }
    11.  
    12.  
    13.  
    14.  
    15.  
    16. void NetworkControl::leerCaracter()
    17. {
    18.  
    19. QTcpSocket *socket (QTcpSocket *)sender();
    20. QBYteArray *b1 = socket->readAll();
    21.  
    22. QImage ax= new QImage("xxxxxxxx");
    23.  
    24. ax->Load(b1);
    25.  
    26. }
    To copy to clipboard, switch view to plain text mode 

    I am working in a Mythtv system ( http://www.mythtv.org/wiki/User_Manu...l_Installation ) . I have the following doubts:

    1 - How to obtain a QByteArray from a a QImage ( is ax->Load(b1) the correct way of obtaining it ?)
    2 - I have to represent the QImage on a screen. I am working with the class MythImage ( http://www.cuymedia.net/mythtv-0.20/...8h-source.html ) y MythUIImage ( http://cuymedia.net/mythtv-trunk/myth
    uiimage_8h-source.html ) .
    How to convert from QImage to MythImage ? How to convert from MythImage to MythUIImage ?
    3- Is there other way of representing images in Mythtv ?
    Thanks
    Gorka
    Last edited by high_flyer; 27th April 2011 at 08:31. Reason: code tags

  2. #2
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: video-streaming MythTV

    1 - How to obtain a QByteArray from a a QImage
    Qt Code:
    1. QByteArray baImage(image.bits(),iImageByteSize);
    To copy to clipboard, switch view to plain text mode 
    How to convert from QImage to MythImage ?
    Since MythImage subclasses QImage, you could use for example loadFromData() or fromData() and give it QImage::bits() as input.
    Last edited by high_flyer; 27th April 2011 at 10:16. Reason: typo
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

  3. #3
    Join Date
    Apr 2011
    Posts
    10
    Thanks
    4
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: video-streaming MythTV

    Hello :
    I obtain the QImage using the following code :


    Qt Code:
    1. QTcpSocket *socket (QTcpSocket *)sender();
    2. QBYteArray *b1 = socket->readAll();
    3. QImage ax= new QImage("xxxxxxxx");
    4. ax->Load(b1);
    To copy to clipboard, switch view to plain text mode 


    NOw I have two questions

    1) When I asked you how to pass from a QImage to a MythIMage you told me :


    "Since MythImage subclasses QImage, you could use for example loadFromData() or fromData() and give it QImage::bis() as input "
    ¿ What does QImage::bis() mean ?

    2) In JAVA I implement the following QTcpServer for sending Images :


    Qt Code:
    1. ServerSocket servidor = new ServerSocket(4445);
    2. Socket conexion = null;
    3. salida = new Vector<ObjectOutputStream>();
    4.  
    5. // iniciar la captura desde la webcam
    6. CaptureStream captureStream = iniciarCaptura();
    7.  
    8. conexion = servidor.accept();
    9. salida.add(new ObjectOutputStream(conexion .getOutputStream()));
    To copy to clipboard, switch view to plain text mode 
    Where iniciarcaptura() is the following method :

    Qt Code:
    1. private CaptureStream iniciarCaptura() throws IOException,
    2. CaptureException
    3. {
    4. CaptureStream captureStream = null;
    5. List list = system.getCaptureDeviceInfoList();
    6. for (int i = 0; i < list.size(); ++i)
    7. {
    8. CaptureDeviceInfo info = (CaptureDeviceInfo)list.get(i);
    9.  
    10. ptureStream = system.openCaptureDeviceStream(info.getDeviceID());
    11.  
    12. List<VideoFormat> ls = captureStream.enumVideoFormats();
    13.  
    14. captureStream.setVideoFormat(ls.get(0));
    15.  
    16. captureStream.setObserver(new MyCaptureObserver());
    17.  
    18. break;
    19. }
    20.  
    21. return captureStream;
    22. }
    To copy to clipboard, switch view to plain text mode 

    The question is

    Is
    QTcpSocket *socket (QTcpSocket *)sender();
    QBYteArray *b1 = socket->readAll();
    the best way of reading Images in the receptor ?

    Thanks
    Gorka
    Last edited by high_flyer; 27th April 2011 at 10:13. Reason: code tags

  4. #4
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: video-streaming MythTV

    ¿ What does QImage::bis() mean ?
    Read the docs.
    I had a typo it should be QImage::bits().
    the best way of reading Images in the receptor ?
    depends on the way you evaluate what "best" is.
    It is a valid way for sure.
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

Similar Threads

  1. Video Streaming
    By Madhumitha in forum Newbie
    Replies: 1
    Last Post: 23rd February 2011, 07:31
  2. Video streaming
    By somnathbanik in forum Newbie
    Replies: 9
    Last Post: 4th November 2010, 10:38
  3. Video Streaming
    By stefandetter in forum Qt Programming
    Replies: 1
    Last Post: 4th June 2008, 09:59
  4. Video streaming with QT4
    By QiT in forum Qt Programming
    Replies: 1
    Last Post: 10th April 2008, 18:09

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.