Skip to content

Commit

Permalink
Introduced video probe.
Browse files Browse the repository at this point in the history
  • Loading branch information
carlonluca committed Mar 19, 2016
1 parent 1ee342a commit 3d58329
Show file tree
Hide file tree
Showing 16 changed files with 380 additions and 18 deletions.
9 changes: 5 additions & 4 deletions PiOmxTextures.pro
Original file line number Diff line number Diff line change
Expand Up @@ -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
5 changes: 5 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
36 changes: 36 additions & 0 deletions piomxtextures_qmlutils/omx_piomxtexturesplugin.cpp
Original file line number Diff line number Diff line change
@@ -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 <http://www.gnu.org/licenses/>.
*/

/*------------------------------------------------------------------------------
| includes
+-----------------------------------------------------------------------------*/
#include "omx_piomxtexturesplugin.h"

/*------------------------------------------------------------------------------
| OMX_PiOmxTexturesPlugin::OMX_PiOmxTexturesPlugin
+-----------------------------------------------------------------------------*/
OMX_PiOmxTexturesPlugin::OMX_PiOmxTexturesPlugin(QObject* parent) :
QQmlExtensionPlugin(parent)
{

}
59 changes: 59 additions & 0 deletions piomxtextures_qmlutils/omx_piomxtexturesplugin.h
Original file line number Diff line number Diff line change
@@ -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 <http://www.gnu.org/licenses/>.
*/

#ifndef OMX_PIOMXTEXTURESPLUGIN_H
#define OMX_PIOMXTEXTURESPLUGIN_H

/*------------------------------------------------------------------------------
| includes
+-----------------------------------------------------------------------------*/
#include <QQmlExtensionPlugin>
#include <QtQml>
#include <QObject>
#include <QProcess>

#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<POT_VideoProbe>(uri, 0, 1, "POT_VideoProbe");
}
};

#endif // OMX_PIOMXTEXTURESPLUGIN_H
46 changes: 46 additions & 0 deletions piomxtextures_qmlutils/piomxtextures_qmlutils.pro
Original file line number Diff line number Diff line change
@@ -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 <http://www.gnu.org/licenses/>.
#

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
69 changes: 69 additions & 0 deletions piomxtextures_qmlutils/pot_videoprobe.cpp
Original file line number Diff line number Diff line change
@@ -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 <http://www.gnu.org/licenses/>.
*/

/*------------------------------------------------------------------------------
| includes
+-----------------------------------------------------------------------------*/
#include <QMediaObject>
#include <QMediaPlayer>

#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<QMediaPlayer*>(m_source->property("mediaObject"));

if (!QVideoProbe::setSource((QMediaObject*)player)) {
qWarning("Failed to set probe.");
m_source = NULL;
return;
}

emit sourceChanged();
}
55 changes: 55 additions & 0 deletions piomxtextures_qmlutils/pot_videoprobe.h
Original file line number Diff line number Diff line change
@@ -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 <http://www.gnu.org/licenses/>.
*/

#ifndef POT_VIDEOPROBE_H
#define POT_VIDEOPROBE_H

/*------------------------------------------------------------------------------
| includes
+-----------------------------------------------------------------------------*/
#include <QQuickItem>
#include <QVideoProbe>

/*------------------------------------------------------------------------------
| 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
3 changes: 3 additions & 0 deletions piomxtextures_qmlutils/resources.qrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<RCC>
<qresource prefix="/"/>
</RCC>
6 changes: 4 additions & 2 deletions piomxtextures_qt_driver/mediaplayer/mediaplayer.pro
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand All @@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
#include "openmaxilavailabilitycontrol.h"
#include "openmaxilvideorenderercontrol.h"
#include "openmaxilstreamscontrol.h"
#include "openmaxilvideoprobe.h"

#include "omx_logging.h"

Expand All @@ -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)));
}

/*------------------------------------------------------------------------------
Expand All @@ -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;
Expand Down
7 changes: 2 additions & 5 deletions piomxtextures_qt_driver/mediaplayer/openmaxilplayerservice.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand All @@ -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
Expand Down
Loading

0 comments on commit 3d58329

Please sign in to comment.