7

I´m quite new to Qt development and I´m using Qt5 Beta1 on MacOSX.

For the last two days I´ve been reading the docs and looking for information about the different possibilities that I have in order to implement a widget that displays the frame of a video which corresponds to a concrete moment in time. A good old preview, in short. First I thought that, since I did not need anything fancy, Phonon would be the right choice, as it´s called to be "on a higher level (than QTMultimedia) and in many cases more suitable for application developers." I read its documentation and even found some discussions that could help me starting, like this; http://www.qtcentre.org/threads/13221-QT-4-4-Phonon-Video-Rendering-a-single-frame. But then, when I tried to make something on my own, I realized that I did not have the Phonon library. Surprised from it, I research about Phonon and Qt5. And that´s when all the trouble began.

I started reading conversation such as this one: http://comments.gmane.org/gmane.comp.lib.qt.user/1581 or this one: http://comments.gmane.org/gmane.comp.lib.qt.devel/3905 or this other link: https://bugreports.qt.io/browse/QTBUG-26471. And I got really confused, without knowing if it was a good idea to download the Phonon library or it was not going to be supported on Qt5 after some time. So I decided to go a step back and think again about using QTMultimedia instead of Phonon. I looked at their VideoWidget example http://doc.qt.io/qt-4.8/qt-multimedia-videowidget-example.html and when I tried to run it, it threw several errors (I´m posting just the beginning of the output):

In file included from ../VideoExample/videoplayer.cpp:43:
In file included from ../VideoExample/videowidget.h:44:
../VideoExample/videowidgetsurface.h:57:11: warning: 'VideoWidgetSurface::isFormatSupported' hides overloaded virtual function [-Woverloaded-virtual]
 bool isFormatSupported(const QVideoSurfaceFormat &format, QVideoSurfaceFormat *similar) const;
      ^
../../Downloads/qt-everywhere-opensource-src-5.0.0-beta1/qtbase/include/QtMultimedia/../../../qtmultimedia/src/multimedia/video/qabstractvideosurface.h:78:18: note: hidden overloaded virtual function 'QAbstractVideoSurface::isFormatSupported' declared here
virtual bool isFormatSupported(const QVideoSurfaceFormat &format) const;
             ^
../VideoExample/videoplayer.cpp:61:40: error: expected a type
 QAbstractButton *openButton = new QPushButton(tr("Open..."));
                                   ^
../VideoExample/videoplayer.cpp:62:6: error: no matching member function for call to 'connect'
 connect(openButton, SIGNAL(clicked()), this, SLOT(openFile()));
 ^~~~~~~
../../Downloads/qt-everywhere-opensource-src-5.0.0-beta1/qtbase/include/QtCore/../../src/corelib/kernel/qobject.h:211:36: note: candidate function not viable: cannot convert argument of incomplete type 'QAbstractButton *' to 'const QObject *'
static QMetaObject::Connection connect(const QObject *sender, const char *signal,

And this is the moment when I felt I was completely lost and wrote here :/

So my actual questions are:

  1. Does anyone knows the actual state of Phonon and if it´s a good idea to use it for Qt5? Is so, what do I have to make it work? I guess I´m mixing concepts here, but I´m terribly lost between what belongs to Qt and what no, and what are the implications of both possibilities.
  2. Any idea why the example from QTMultimedia does not work?

In general, thoughts about this topic would be greatly appreciated.

4

2 回答 2

6

Qt 5( Qt 和关键技术)中似乎不包含 Phonon 框架。

您测试的示例似乎仅适用于 Qt 4.7,而不适用于 Qt 5。可以在此处找到 Qt 5.0 版本。Qt 5.1 版本可以在这里找到。

于 2012-11-28T17:09:08.570 回答
0

尝试安装声子开发套件。

yum install phonon-devel

于 2014-01-09T14:56:14.933 回答