Results 1 to 6 of 6

Thread: Open customized video file

  1. #1
    Join Date
    May 2010
    Posts
    11
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Windows

    Question Open customized video file

    Hi

    I would like to use my own customized QIODevice to open a video file in QT using Phonon. This should theoretically allow me to play specially encrypted video files. I noticed that MediaSource ( QIODevice * ioDevice ) can take an QIODevice and as a test I tried a basic QFile as a source.

    Qt Code:
    1. VideoPlayer* video = new VideoPlayer(Phonon::VideoCategory);
    2.  
    3. main->setWidget(video); // My own class that puts the VideoPlayer on the window at the correct position.
    4.  
    5. QFile* f = new QFile("data/myvideo.MP4");
    6. if (f->open(QIODevice::ReadOnly))
    7. {
    8. video->play(MediaSource(f));
    9. }
    To copy to clipboard, switch view to plain text mode 

    When I debug the code, the file opens successfully, but I only get a "black box" with no video or audio.

    When I replace MediaSource(f) with MediaSource("data/myvideo.MP4"), it works but I would like to be able to modify (decrypt) the stream before it get send to the VideoPlayer.

    Any ideas?

  2. #2
    Join Date
    Sep 2009
    Location
    UK
    Posts
    2,447
    Thanks
    6
    Thanked 348 Times in 333 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Open customized video file

    Which OS?

    I'm thinking of the caveat: "Under Windows, we only support QIODevices containing the avi, mp3, or mpg formats"

  3. #3
    Join Date
    Jan 2006
    Location
    Belgium
    Posts
    1,938
    Thanked 268 Times in 268 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Wiki edits
    20

    Default Re: Open customized video file

    Is this one Windows? If so, the documentation says:

    Warning: On Windows, we only support QIODevices containing the avi, mp3, or mpg formats. Use the constructor that takes a file name to open files (the Qt backend does not use a QFile internally).

  4. #4
    Join Date
    May 2010
    Posts
    11
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Open customized video file

    Yes, I am developing for Windows now. Will probably port to other platforms at a later stage.

    If QT does not support QFile internally, are there maybe another way to manipulate the byte stream before passing it to the Phonon Framework without rewriting QT's source code?

  5. #5
    Join Date
    Sep 2009
    Location
    UK
    Posts
    2,447
    Thanks
    6
    Thanked 348 Times in 333 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Open customized video file

    Depending on the size of the video, perhaps QBuffer? It does mean holding the entire content in memory, which isn't ideal and maybe impossible.

    Otherwise, difficult, as the player will assume a file and treat as such, so you can't really stream it.

  6. #6
    Join Date
    Jan 2006
    Location
    Belgium
    Posts
    1,938
    Thanked 268 Times in 268 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Wiki edits
    20

    Default Re: Open customized video file

    Quote Originally Posted by cass View Post
    If QT does not support QFile internally, are there maybe another way to manipulate the byte stream before passing it to the Phonon Framework without rewriting QT's source code?
    Note that Phonon was only designed to create simple playback of media files.

Similar Threads

  1. Phonon - how to loop a video file
    By Mrdata in forum Newbie
    Replies: 6
    Last Post: 24th July 2015, 18:31
  2. Replies: 5
    Last Post: 15th June 2010, 07:42
  3. Replies: 4
    Last Post: 16th February 2010, 17:42
  4. open a video file in a new window...
    By jiapei100 in forum Qt Programming
    Replies: 0
    Last Post: 19th September 2009, 14:53
  5. Playing Video file using Qt
    By sarode in forum Qt Programming
    Replies: 3
    Last Post: 26th March 2007, 18:35

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.