diff --git a/PiOmxTextures.pro b/PiOmxTextures.pro index d7f06ba..c715305 100644 --- a/PiOmxTextures.pro +++ b/PiOmxTextures.pro @@ -26,8 +26,9 @@ CONFIG += qt no_private_qt_headers_warning TEMPLATE = subdirs SUBDIRS = \ - piomxtextures_lib \ - piomxtextures_qt_driver \ - piomxtextures_app \ + piomxtextures_lib \ + piomxtextures_qt_driver \ + piomxtextures_app \ piomxtextures_pocplayer \ - piomxtextures_samples + piomxtextures_samples \ + piomxtextures_qmlutils diff --git a/changelog.txt b/changelog.txt index 3157775..2e22ceb 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,5 +1,10 @@ Changelog +Version 5.2.1 +============= +1. Added duration changed signal. +2. Bump to ffmpeg 2.8.6. + Version 5.2.0 ============= 1. Bump ffmpeg to 2.8.5. diff --git a/piomxtextures_qmlutils/omx_piomxtexturesplugin.cpp b/piomxtextures_qmlutils/omx_piomxtexturesplugin.cpp new file mode 100644 index 0000000..e4aa613 --- /dev/null +++ b/piomxtextures_qmlutils/omx_piomxtexturesplugin.cpp @@ -0,0 +1,36 @@ +/* + * Project: PiOmxTexturesQmlUtils + * Author: Luca Carlon + * Date: 03.12.2016 + * + * Copyright (c) 2016 Luca Carlon. All rights reserved. + * + * This file is part of PiOmxTexturesQmlUtils. + * + * PiOmxTexturesQmlUtils is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * PiOmxTexturesQmlUtils is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with PiOmxTexturesQmlUtils. If not, see . + */ + +/*------------------------------------------------------------------------------ +| includes ++-----------------------------------------------------------------------------*/ +#include "omx_piomxtexturesplugin.h" + +/*------------------------------------------------------------------------------ +| OMX_PiOmxTexturesPlugin::OMX_PiOmxTexturesPlugin ++-----------------------------------------------------------------------------*/ +OMX_PiOmxTexturesPlugin::OMX_PiOmxTexturesPlugin(QObject* parent) : + QQmlExtensionPlugin(parent) +{ + +} diff --git a/piomxtextures_qmlutils/omx_piomxtexturesplugin.h b/piomxtextures_qmlutils/omx_piomxtexturesplugin.h new file mode 100644 index 0000000..db2d30a --- /dev/null +++ b/piomxtextures_qmlutils/omx_piomxtexturesplugin.h @@ -0,0 +1,59 @@ +/* + * Project: PiOmxTexturesQmlUtils + * Author: Luca Carlon + * Date: 03.12.2016 + * + * Copyright (c) 2016 Luca Carlon. All rights reserved. + * + * This file is part of PiOmxTexturesQmlUtils. + * + * PiOmxTexturesQmlUtils is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * PiOmxTexturesQmlUtils is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with PiOmxTexturesQmlUtils. If not, see . + */ + +#ifndef OMX_PIOMXTEXTURESPLUGIN_H +#define OMX_PIOMXTEXTURESPLUGIN_H + +/*------------------------------------------------------------------------------ +| includes ++-----------------------------------------------------------------------------*/ +#include +#include +#include +#include + +#include "omx_logging.h" +#include "pot_videoprobe.h" + +/*------------------------------------------------------------------------------ +| OMX_PiOmxTexturesPlugin class ++-----------------------------------------------------------------------------*/ +class OMX_PiOmxTexturesPlugin : public QQmlExtensionPlugin +{ + Q_OBJECT + Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface") + +public: + OMX_PiOmxTexturesPlugin(QObject* parent = 0); + + void registerTypes(const char* uri) { + log_info("PiOmxTexturesQmlUtils version %s built %s, %s.", + VERSION, __DATE__, __TIME__); + + log_info("Registering POT_VideoProbe QML type..."); + Q_ASSERT(uri == QLatin1String("PiOmxTexturesQmlUtils")); + qmlRegisterType(uri, 0, 1, "POT_VideoProbe"); + } +}; + +#endif // OMX_PIOMXTEXTURESPLUGIN_H diff --git a/piomxtextures_qmlutils/piomxtextures_qmlutils.pro b/piomxtextures_qmlutils/piomxtextures_qmlutils.pro new file mode 100644 index 0000000..e85b683 --- /dev/null +++ b/piomxtextures_qmlutils/piomxtextures_qmlutils.pro @@ -0,0 +1,46 @@ +# +# Project: PiOmxTexturesVideoLayer +# Author: Luca Carlon +# Date: 01.10.2016 +# +# Copyright (c) 2016 Luca Carlon. All rights reserved. +# +# This file is part of PiOmxTexturesVideoLayer. +# +# PiOmxTexturesQmlUtils is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# PiOmxTexturesQmlUtils is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public License +# along with PiOmxTexturesQmlUtils. If not, see . +# + +TEMPLATE = lib + +VERSION = 0.1.0 +DEFINES += VERSION=\\\"$$VERSION\\\" + +QT += quick qml multimedia +CONFIG += qt plugin +QMAKE_CXXFLAGS += -std=c++11 + +INCLUDEPATH += \ + $$_PRO_FILE_PWD_/../3rdparty/LightLogger \ + $$_PRO_FILE_PWD_/../3rdparty/LightSmartPtr \ + $$_PRO_FILE_PWD_/../piomxtextures_src + +HEADERS += \ + omx_piomxtexturesplugin.h \ + pot_videoprobe.h + +SOURCES += \ + omx_piomxtexturesplugin.cpp \ + pot_videoprobe.cpp + +RESOURCES += resources.qrc diff --git a/piomxtextures_qmlutils/pot_videoprobe.cpp b/piomxtextures_qmlutils/pot_videoprobe.cpp new file mode 100644 index 0000000..490f6cf --- /dev/null +++ b/piomxtextures_qmlutils/pot_videoprobe.cpp @@ -0,0 +1,69 @@ +/* + * Project: PiOmxTexturesQmlUtils + * Author: Luca Carlon + * Date: 03.12.2016 + * + * Copyright (c) 2016 Luca Carlon. All rights reserved. + * + * This file is part of PiOmxTexturesQmlUtils. + * + * PiOmxTexturesQmlUtils is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * PiOmxTexturesQmlUtils is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with PiOmxTexturesQmlUtils. If not, see . + */ + +/*------------------------------------------------------------------------------ +| includes ++-----------------------------------------------------------------------------*/ +#include +#include + +#include "pot_videoprobe.h" + +/*------------------------------------------------------------------------------ +| POT_VideoProbe::POT_VideoProbe ++-----------------------------------------------------------------------------*/ +POT_VideoProbe::POT_VideoProbe(QObject* parent) : + QVideoProbe(parent) +{ + // Do nothing. +} + +/*------------------------------------------------------------------------------ +| POT_VideoProbe::source ++-----------------------------------------------------------------------------*/ +QObject* POT_VideoProbe::source() +{ + return m_source; +} + +/*------------------------------------------------------------------------------ +| POT_VideoProbe::setSource ++-----------------------------------------------------------------------------*/ +void POT_VideoProbe::setSource(QObject* source) +{ + if (m_source == source) + return; + m_source = source; + + QMediaPlayer* player = NULL; + if (m_source) + player = qvariant_cast(m_source->property("mediaObject")); + + if (!QVideoProbe::setSource((QMediaObject*)player)) { + qWarning("Failed to set probe."); + m_source = NULL; + return; + } + + emit sourceChanged(); +} diff --git a/piomxtextures_qmlutils/pot_videoprobe.h b/piomxtextures_qmlutils/pot_videoprobe.h new file mode 100644 index 0000000..18aab31 --- /dev/null +++ b/piomxtextures_qmlutils/pot_videoprobe.h @@ -0,0 +1,55 @@ +/* + * Project: PiOmxTexturesQmlUtils + * Author: Luca Carlon + * Date: 03.12.2016 + * + * Copyright (c) 2016 Luca Carlon. All rights reserved. + * + * This file is part of PiOmxTexturesQmlUtils. + * + * PiOmxTexturesQmlUtils is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * PiOmxTexturesQmlUtils is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with PiOmxTexturesQmlUtils. If not, see . + */ + +#ifndef POT_VIDEOPROBE_H +#define POT_VIDEOPROBE_H + +/*------------------------------------------------------------------------------ +| includes ++-----------------------------------------------------------------------------*/ +#include +#include + +/*------------------------------------------------------------------------------ +| POT_VideoProbe class ++-----------------------------------------------------------------------------*/ +class POT_VideoProbe : public QVideoProbe +{ + Q_OBJECT + + Q_PROPERTY(QObject* source READ source WRITE setSource NOTIFY sourceChanged) + +public: + POT_VideoProbe(QObject* parent = 0); + + QObject* source(); + void setSource(QObject* source); + +signals: + void sourceChanged(); + +private: + QObject* m_source; +}; + +#endif // POT_VIDEOPROBE_H diff --git a/piomxtextures_qmlutils/resources.qrc b/piomxtextures_qmlutils/resources.qrc new file mode 100644 index 0000000..4d8ed66 --- /dev/null +++ b/piomxtextures_qmlutils/resources.qrc @@ -0,0 +1,3 @@ + + + diff --git a/piomxtextures_qt_driver/mediaplayer/mediaplayer.pro b/piomxtextures_qt_driver/mediaplayer/mediaplayer.pro index b52f4d9..59f47ad 100644 --- a/piomxtextures_qt_driver/mediaplayer/mediaplayer.pro +++ b/piomxtextures_qt_driver/mediaplayer/mediaplayer.pro @@ -53,7 +53,8 @@ HEADERS += \ $$PWD/openmaxilmetadataprovider.h \ $$PWD/openmaxilavailabilitycontrol.h \ $$PWD/openmaxilplayerserviceplugin.h \ - $$PWD/openmaxilvideorenderercontrol.h + $$PWD/openmaxilvideorenderercontrol.h \ + openmaxilvideoprobe.h SOURCES += \ $$PWD/openmaxilplayercontrol.cpp \ @@ -62,7 +63,8 @@ SOURCES += \ $$PWD/openmaxilmetadataprovider.cpp \ $$PWD/openmaxilavailabilitycontrol.cpp \ $$PWD/openmaxilplayerserviceplugin.cpp \ - $$PWD/openmaxilvideorenderercontrol.cpp + $$PWD/openmaxilvideorenderercontrol.cpp \ + openmaxilvideoprobe.cpp OTHER_FILES += \ mediaplayer.json diff --git a/piomxtextures_qt_driver/mediaplayer/openmaxilplayerservice.cpp b/piomxtextures_qt_driver/mediaplayer/openmaxilplayerservice.cpp index f2b5813..6063a87 100644 --- a/piomxtextures_qt_driver/mediaplayer/openmaxilplayerservice.cpp +++ b/piomxtextures_qt_driver/mediaplayer/openmaxilplayerservice.cpp @@ -37,6 +37,7 @@ #include "openmaxilavailabilitycontrol.h" #include "openmaxilvideorenderercontrol.h" #include "openmaxilstreamscontrol.h" +#include "openmaxilvideoprobe.h" #include "omx_logging.h" @@ -62,7 +63,12 @@ OpenMAXILPlayerService::OpenMAXILPlayerService(QObject *parent): m_streamsControl = new OpenMAXILStreamsControl(this); m_availabilityControl = new OpenMAXILAvailabilityControl(this); m_videoRenderer = new OpenMAXILVideoRendererControl(m_control, this); + m_videoProbe = new OpenMAXILVideoProbe(this); + m_control->setVideoRenderer(m_videoRenderer); + + connect(m_videoRenderer, SIGNAL(frameReady(QVideoFrame)), + m_videoProbe, SIGNAL(videoFrameProbed(QVideoFrame))); } /*------------------------------------------------------------------------------ @@ -83,6 +89,9 @@ QMediaControl *OpenMAXILPlayerService::requestControl(const char *name) if (qstrcmp(name, QMetaDataReaderControl_iid) == 0) return m_metaData; + if (qstrcmp(name, QMediaVideoProbeControl_iid) == 0) + return m_videoProbe; + #if 0 if (qstrcmp(name, QMediaStreamsControl_iid) == 0) return 0; diff --git a/piomxtextures_qt_driver/mediaplayer/openmaxilplayerservice.h b/piomxtextures_qt_driver/mediaplayer/openmaxilplayerservice.h index b35c21e..e97d320 100644 --- a/piomxtextures_qt_driver/mediaplayer/openmaxilplayerservice.h +++ b/piomxtextures_qt_driver/mediaplayer/openmaxilplayerservice.h @@ -34,16 +34,12 @@ class QMediaPlayerControl; class QMediaPlaylist; class QMediaPlaylistNavigator; -class QGstreamerMetaData; class OpenMAXILPlayerControl; -class QGstreamerPlayerSession; class OpenMAXILMetaDataProvider; class OpenMAXILStreamsControl; -class QGstreamerVideoRenderer; -class QGstreamerVideoOverlay; -class QGstreamerVideoWidgetControl; class OpenMAXILAvailabilityControl; class OpenMAXILVideoRendererControl; +class OpenMAXILVideoProbe; class OpenMAXILPlayerService : public QMediaService { @@ -60,6 +56,7 @@ class OpenMAXILPlayerService : public QMediaService OpenMAXILMetaDataProvider *m_metaData; OpenMAXILStreamsControl *m_streamsControl; OpenMAXILAvailabilityControl *m_availabilityControl; + OpenMAXILVideoProbe* m_videoProbe; QMediaControl *m_videoOutput; #if 0 diff --git a/piomxtextures_qt_driver/mediaplayer/openmaxilvideoprobe.cpp b/piomxtextures_qt_driver/mediaplayer/openmaxilvideoprobe.cpp new file mode 100644 index 0000000..a814cdd --- /dev/null +++ b/piomxtextures_qt_driver/mediaplayer/openmaxilvideoprobe.cpp @@ -0,0 +1,36 @@ +/* + * Project: PiOmxTextures + * Author: Luca Carlon + * Date: 03.07.2016 + * + * Copyright (c) 2016 Luca Carlon. All rights reserved. + * + * This file is part of PiOmxTextures. + * + * PiOmxTextures is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * PiOmxTextures is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with PiOmxTextures. If not, see . + */ + +/*------------------------------------------------------------------------------ +| includes ++-----------------------------------------------------------------------------*/ +#include "openmaxilvideoprobe.h" + +/*------------------------------------------------------------------------------ +| OpenMAXILVideoProbe::OpenMAXILVideoProbe ++-----------------------------------------------------------------------------*/ +OpenMAXILVideoProbe::OpenMAXILVideoProbe(QObject* parent) : + QMediaVideoProbeControl(parent) +{ + // Do nothing. +} diff --git a/piomxtextures_qt_driver/mediaplayer/openmaxilvideoprobe.h b/piomxtextures_qt_driver/mediaplayer/openmaxilvideoprobe.h new file mode 100644 index 0000000..59850f3 --- /dev/null +++ b/piomxtextures_qt_driver/mediaplayer/openmaxilvideoprobe.h @@ -0,0 +1,42 @@ +/* + * Project: PiOmxTextures + * Author: Luca Carlon + * Date: 03.07.2016 + * + * Copyright (c) 2016 Luca Carlon. All rights reserved. + * + * This file is part of PiOmxTextures. + * + * PiOmxTextures is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * PiOmxTextures is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with PiOmxTextures. If not, see . + */ + +#ifndef OPENMAXILVIDEOPROBE_H +#define OPENMAXILVIDEOPROBE_H + +/*------------------------------------------------------------------------------ +| includes ++-----------------------------------------------------------------------------*/ +#include + +/*------------------------------------------------------------------------------ +| OpenMAXILVideoProbe class ++-----------------------------------------------------------------------------*/ +class OpenMAXILVideoProbe : public QMediaVideoProbeControl +{ + Q_OBJECT +public: + OpenMAXILVideoProbe(QObject* parent = 0); +}; + +#endif // OPENMAXILVIDEOPROBE_H diff --git a/piomxtextures_qt_driver/mediaplayer/openmaxilvideorenderercontrol.cpp b/piomxtextures_qt_driver/mediaplayer/openmaxilvideorenderercontrol.cpp index 5bc3e82..78ed867 100644 --- a/piomxtextures_qt_driver/mediaplayer/openmaxilvideorenderercontrol.cpp +++ b/piomxtextures_qt_driver/mediaplayer/openmaxilvideorenderercontrol.cpp @@ -289,6 +289,8 @@ void OpenMAXILVideoRendererControl::onUpdateTriggered() m_buffer->setHandle(t); m_surface->present(*m_frame); + emit frameReady(*m_frame); + #ifdef OMX_RENDER_WATCHDOG handleWatchdogFile(); #endif // OMX_RENDER_WATCHDOG diff --git a/piomxtextures_qt_driver/mediaplayer/openmaxilvideorenderercontrol.h b/piomxtextures_qt_driver/mediaplayer/openmaxilvideorenderercontrol.h index 53aa6dc..3d418f4 100644 --- a/piomxtextures_qt_driver/mediaplayer/openmaxilvideorenderercontrol.h +++ b/piomxtextures_qt_driver/mediaplayer/openmaxilvideorenderercontrol.h @@ -27,10 +27,10 @@ /*------------------------------------------------------------------------------ | includes +-----------------------------------------------------------------------------*/ -#include "QtMultimedia/qvideorenderercontrol.h" -#include "QtMultimedia/qvideoframe.h" -#include "QtMultimedia/qvideosurfaceformat.h" -#include "QtMultimedia/qmediaplayer.h" +#include +#include +#include +#include #include #include @@ -64,6 +64,9 @@ public slots: bool eventFilter(QObject*, QEvent*); #endif // OGL_CONTEXT_FROM_SURFACE +signals: + void frameReady(const QVideoFrame& frame); + private: OpenMAXILPlayerControl* m_control; OMX_MediaProcessor* m_mediaProcessor; diff --git a/piomxtextures_src/omx_mediaprocessor.cpp b/piomxtextures_src/omx_mediaprocessor.cpp index 14c6943..f91c06f 100644 --- a/piomxtextures_src/omx_mediaprocessor.cpp +++ b/piomxtextures_src/omx_mediaprocessor.cpp @@ -1118,9 +1118,6 @@ void OMX_MediaProcessor::flushStreams(double pts) m_omx_reader->FreePacket(m_omx_pkt); m_omx_pkt = NULL; } - - if (pts != DVD_NOPTS_VALUE) - m_av_clock->OMXMediaTime(pts); } /*------------------------------------------------------------------------------