showing video file

Forum for software developers to discuss BCI2000 software development
Locked
khosravifard
Posts: 11
Joined: 30 Dec 2012, 10:02

showing video file

Post by khosravifard » 25 Jan 2013, 06:57

Hi,I am a freshman to BCI2000 and I want to use an embedded video file in this software, how can I start it? shall I use this file as an new application or shall I do something with FilePlayBack?

if I need to write a new application which classes should be used? because there is an audio player class (midiplayer class),but I have no idea about class that support the video file.
I appreciate your answer inadvance .

mellinger
Posts: 1163
Joined: 12 Feb 2003, 11:06

Re: showing video file

Post by mellinger » 30 Jan 2013, 12:13

Hi,

it would be difficult to introduce proper video playback support to BCI2000.
As a hack, the following might work:
Create a new class that inherits from VisualStimulus (you might use a copy of the ImageStimulus class to get started).
Inside the OnChange() member of the new class, a pointer to a QPaintDevice is available in the DrawContext argument, as DrawContext::handle::device. In most situations, this can be cast to a QWidget:

Code: Select all

QWidget* p = dynamic_cast<QWidget*>( inDC.handle.device );
If the cast succeeds, p will be non-null, and may be used as a parent for Qt widgets within the display screen. So you can add a Phonon::VideoPlayer* member to the class, initialize it to null in the constructor, and delete it in the desctructor. Inside the OnChange() member function, you can test for that member to be null, and assign it a new, invisible Phonon::VideoPlayer instance with the p pointer as a parent.
http://qt-project.org/doc/qt-4.8/phonon ... layer.html

Then, from the Stimulus::OnPresent() override in your class, you can make the video player object visible, and start playback. From the Stimulus::OnConceal() override, you can halt playback, and make the player invisible.

In principle, this should work but I cannot say anything about reliability of timing. Make sure to use the video player's load() member function to assign a movie file during OnChange() -- this makes sure that calling play() without argument during OnPresent() will start playing without delay.

Let me know if you need additional help.

Regards,
Juergen

Locked

Who is online

Users browsing this forum: No registered users and 3 guests