Skip to content

Commit 3d58329

Browse files
committed
Introduced video probe.
1 parent 1ee342a commit 3d58329

16 files changed

+380
-18
lines changed

PiOmxTextures.pro

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,9 @@ CONFIG += qt no_private_qt_headers_warning
2626
TEMPLATE = subdirs
2727

2828
SUBDIRS = \
29-
piomxtextures_lib \
30-
piomxtextures_qt_driver \
31-
piomxtextures_app \
29+
piomxtextures_lib \
30+
piomxtextures_qt_driver \
31+
piomxtextures_app \
3232
piomxtextures_pocplayer \
33-
piomxtextures_samples
33+
piomxtextures_samples \
34+
piomxtextures_qmlutils

changelog.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
Changelog
22

3+
Version 5.2.1
4+
=============
5+
1. Added duration changed signal.
6+
2. Bump to ffmpeg 2.8.6.
7+
38
Version 5.2.0
49
=============
510
1. Bump ffmpeg to 2.8.5.
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
/*
2+
* Project: PiOmxTexturesQmlUtils
3+
* Author: Luca Carlon
4+
* Date: 03.12.2016
5+
*
6+
* Copyright (c) 2016 Luca Carlon. All rights reserved.
7+
*
8+
* This file is part of PiOmxTexturesQmlUtils.
9+
*
10+
* PiOmxTexturesQmlUtils is free software: you can redistribute it and/or modify
11+
* it under the terms of the GNU Lesser General Public License as published by
12+
* the Free Software Foundation, either version 3 of the License, or
13+
* (at your option) any later version.
14+
*
15+
* PiOmxTexturesQmlUtils is distributed in the hope that it will be useful,
16+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
17+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18+
* GNU Lesser General Public License for more details.
19+
*
20+
* You should have received a copy of the GNU Lesser General Public License
21+
* along with PiOmxTexturesQmlUtils. If not, see <http://www.gnu.org/licenses/>.
22+
*/
23+
24+
/*------------------------------------------------------------------------------
25+
| includes
26+
+-----------------------------------------------------------------------------*/
27+
#include "omx_piomxtexturesplugin.h"
28+
29+
/*------------------------------------------------------------------------------
30+
| OMX_PiOmxTexturesPlugin::OMX_PiOmxTexturesPlugin
31+
+-----------------------------------------------------------------------------*/
32+
OMX_PiOmxTexturesPlugin::OMX_PiOmxTexturesPlugin(QObject* parent) :
33+
QQmlExtensionPlugin(parent)
34+
{
35+
36+
}
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
/*
2+
* Project: PiOmxTexturesQmlUtils
3+
* Author: Luca Carlon
4+
* Date: 03.12.2016
5+
*
6+
* Copyright (c) 2016 Luca Carlon. All rights reserved.
7+
*
8+
* This file is part of PiOmxTexturesQmlUtils.
9+
*
10+
* PiOmxTexturesQmlUtils is free software: you can redistribute it and/or modify
11+
* it under the terms of the GNU Lesser General Public License as published by
12+
* the Free Software Foundation, either version 3 of the License, or
13+
* (at your option) any later version.
14+
*
15+
* PiOmxTexturesQmlUtils is distributed in the hope that it will be useful,
16+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
17+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18+
* GNU Lesser General Public License for more details.
19+
*
20+
* You should have received a copy of the GNU Lesser General Public License
21+
* along with PiOmxTexturesQmlUtils. If not, see <http://www.gnu.org/licenses/>.
22+
*/
23+
24+
#ifndef OMX_PIOMXTEXTURESPLUGIN_H
25+
#define OMX_PIOMXTEXTURESPLUGIN_H
26+
27+
/*------------------------------------------------------------------------------
28+
| includes
29+
+-----------------------------------------------------------------------------*/
30+
#include <QQmlExtensionPlugin>
31+
#include <QtQml>
32+
#include <QObject>
33+
#include <QProcess>
34+
35+
#include "omx_logging.h"
36+
#include "pot_videoprobe.h"
37+
38+
/*------------------------------------------------------------------------------
39+
| OMX_PiOmxTexturesPlugin class
40+
+-----------------------------------------------------------------------------*/
41+
class OMX_PiOmxTexturesPlugin : public QQmlExtensionPlugin
42+
{
43+
Q_OBJECT
44+
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface")
45+
46+
public:
47+
OMX_PiOmxTexturesPlugin(QObject* parent = 0);
48+
49+
void registerTypes(const char* uri) {
50+
log_info("PiOmxTexturesQmlUtils version %s built %s, %s.",
51+
VERSION, __DATE__, __TIME__);
52+
53+
log_info("Registering POT_VideoProbe QML type...");
54+
Q_ASSERT(uri == QLatin1String("PiOmxTexturesQmlUtils"));
55+
qmlRegisterType<POT_VideoProbe>(uri, 0, 1, "POT_VideoProbe");
56+
}
57+
};
58+
59+
#endif // OMX_PIOMXTEXTURESPLUGIN_H
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
#
2+
# Project: PiOmxTexturesVideoLayer
3+
# Author: Luca Carlon
4+
# Date: 01.10.2016
5+
#
6+
# Copyright (c) 2016 Luca Carlon. All rights reserved.
7+
#
8+
# This file is part of PiOmxTexturesVideoLayer.
9+
#
10+
# PiOmxTexturesQmlUtils is free software: you can redistribute it and/or modify
11+
# it under the terms of the GNU Lesser General Public License as published by
12+
# the Free Software Foundation, either version 3 of the License, or
13+
# (at your option) any later version.
14+
#
15+
# PiOmxTexturesQmlUtils is distributed in the hope that it will be useful,
16+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
17+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18+
# GNU Lesser General Public License for more details.
19+
#
20+
# You should have received a copy of the GNU Lesser General Public License
21+
# along with PiOmxTexturesQmlUtils. If not, see <http://www.gnu.org/licenses/>.
22+
#
23+
24+
TEMPLATE = lib
25+
26+
VERSION = 0.1.0
27+
DEFINES += VERSION=\\\"$$VERSION\\\"
28+
29+
QT += quick qml multimedia
30+
CONFIG += qt plugin
31+
QMAKE_CXXFLAGS += -std=c++11
32+
33+
INCLUDEPATH += \
34+
$$_PRO_FILE_PWD_/../3rdparty/LightLogger \
35+
$$_PRO_FILE_PWD_/../3rdparty/LightSmartPtr \
36+
$$_PRO_FILE_PWD_/../piomxtextures_src
37+
38+
HEADERS += \
39+
omx_piomxtexturesplugin.h \
40+
pot_videoprobe.h
41+
42+
SOURCES += \
43+
omx_piomxtexturesplugin.cpp \
44+
pot_videoprobe.cpp
45+
46+
RESOURCES += resources.qrc
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
/*
2+
* Project: PiOmxTexturesQmlUtils
3+
* Author: Luca Carlon
4+
* Date: 03.12.2016
5+
*
6+
* Copyright (c) 2016 Luca Carlon. All rights reserved.
7+
*
8+
* This file is part of PiOmxTexturesQmlUtils.
9+
*
10+
* PiOmxTexturesQmlUtils is free software: you can redistribute it and/or modify
11+
* it under the terms of the GNU Lesser General Public License as published by
12+
* the Free Software Foundation, either version 3 of the License, or
13+
* (at your option) any later version.
14+
*
15+
* PiOmxTexturesQmlUtils is distributed in the hope that it will be useful,
16+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
17+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18+
* GNU Lesser General Public License for more details.
19+
*
20+
* You should have received a copy of the GNU Lesser General Public License
21+
* along with PiOmxTexturesQmlUtils. If not, see <http://www.gnu.org/licenses/>.
22+
*/
23+
24+
/*------------------------------------------------------------------------------
25+
| includes
26+
+-----------------------------------------------------------------------------*/
27+
#include <QMediaObject>
28+
#include <QMediaPlayer>
29+
30+
#include "pot_videoprobe.h"
31+
32+
/*------------------------------------------------------------------------------
33+
| POT_VideoProbe::POT_VideoProbe
34+
+-----------------------------------------------------------------------------*/
35+
POT_VideoProbe::POT_VideoProbe(QObject* parent) :
36+
QVideoProbe(parent)
37+
{
38+
// Do nothing.
39+
}
40+
41+
/*------------------------------------------------------------------------------
42+
| POT_VideoProbe::source
43+
+-----------------------------------------------------------------------------*/
44+
QObject* POT_VideoProbe::source()
45+
{
46+
return m_source;
47+
}
48+
49+
/*------------------------------------------------------------------------------
50+
| POT_VideoProbe::setSource
51+
+-----------------------------------------------------------------------------*/
52+
void POT_VideoProbe::setSource(QObject* source)
53+
{
54+
if (m_source == source)
55+
return;
56+
m_source = source;
57+
58+
QMediaPlayer* player = NULL;
59+
if (m_source)
60+
player = qvariant_cast<QMediaPlayer*>(m_source->property("mediaObject"));
61+
62+
if (!QVideoProbe::setSource((QMediaObject*)player)) {
63+
qWarning("Failed to set probe.");
64+
m_source = NULL;
65+
return;
66+
}
67+
68+
emit sourceChanged();
69+
}
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
/*
2+
* Project: PiOmxTexturesQmlUtils
3+
* Author: Luca Carlon
4+
* Date: 03.12.2016
5+
*
6+
* Copyright (c) 2016 Luca Carlon. All rights reserved.
7+
*
8+
* This file is part of PiOmxTexturesQmlUtils.
9+
*
10+
* PiOmxTexturesQmlUtils is free software: you can redistribute it and/or modify
11+
* it under the terms of the GNU Lesser General Public License as published by
12+
* the Free Software Foundation, either version 3 of the License, or
13+
* (at your option) any later version.
14+
*
15+
* PiOmxTexturesQmlUtils is distributed in the hope that it will be useful,
16+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
17+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18+
* GNU Lesser General Public License for more details.
19+
*
20+
* You should have received a copy of the GNU Lesser General Public License
21+
* along with PiOmxTexturesQmlUtils. If not, see <http://www.gnu.org/licenses/>.
22+
*/
23+
24+
#ifndef POT_VIDEOPROBE_H
25+
#define POT_VIDEOPROBE_H
26+
27+
/*------------------------------------------------------------------------------
28+
| includes
29+
+-----------------------------------------------------------------------------*/
30+
#include <QQuickItem>
31+
#include <QVideoProbe>
32+
33+
/*------------------------------------------------------------------------------
34+
| POT_VideoProbe class
35+
+-----------------------------------------------------------------------------*/
36+
class POT_VideoProbe : public QVideoProbe
37+
{
38+
Q_OBJECT
39+
40+
Q_PROPERTY(QObject* source READ source WRITE setSource NOTIFY sourceChanged)
41+
42+
public:
43+
POT_VideoProbe(QObject* parent = 0);
44+
45+
QObject* source();
46+
void setSource(QObject* source);
47+
48+
signals:
49+
void sourceChanged();
50+
51+
private:
52+
QObject* m_source;
53+
};
54+
55+
#endif // POT_VIDEOPROBE_H
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<RCC>
2+
<qresource prefix="/"/>
3+
</RCC>

piomxtextures_qt_driver/mediaplayer/mediaplayer.pro

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,8 @@ HEADERS += \
5353
$$PWD/openmaxilmetadataprovider.h \
5454
$$PWD/openmaxilavailabilitycontrol.h \
5555
$$PWD/openmaxilplayerserviceplugin.h \
56-
$$PWD/openmaxilvideorenderercontrol.h
56+
$$PWD/openmaxilvideorenderercontrol.h \
57+
openmaxilvideoprobe.h
5758

5859
SOURCES += \
5960
$$PWD/openmaxilplayercontrol.cpp \
@@ -62,7 +63,8 @@ SOURCES += \
6263
$$PWD/openmaxilmetadataprovider.cpp \
6364
$$PWD/openmaxilavailabilitycontrol.cpp \
6465
$$PWD/openmaxilplayerserviceplugin.cpp \
65-
$$PWD/openmaxilvideorenderercontrol.cpp
66+
$$PWD/openmaxilvideorenderercontrol.cpp \
67+
openmaxilvideoprobe.cpp
6668

6769
OTHER_FILES += \
6870
mediaplayer.json

piomxtextures_qt_driver/mediaplayer/openmaxilplayerservice.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
#include "openmaxilavailabilitycontrol.h"
3838
#include "openmaxilvideorenderercontrol.h"
3939
#include "openmaxilstreamscontrol.h"
40+
#include "openmaxilvideoprobe.h"
4041

4142
#include "omx_logging.h"
4243

@@ -62,7 +63,12 @@ OpenMAXILPlayerService::OpenMAXILPlayerService(QObject *parent):
6263
m_streamsControl = new OpenMAXILStreamsControl(this);
6364
m_availabilityControl = new OpenMAXILAvailabilityControl(this);
6465
m_videoRenderer = new OpenMAXILVideoRendererControl(m_control, this);
66+
m_videoProbe = new OpenMAXILVideoProbe(this);
67+
6568
m_control->setVideoRenderer(m_videoRenderer);
69+
70+
connect(m_videoRenderer, SIGNAL(frameReady(QVideoFrame)),
71+
m_videoProbe, SIGNAL(videoFrameProbed(QVideoFrame)));
6672
}
6773

6874
/*------------------------------------------------------------------------------
@@ -83,6 +89,9 @@ QMediaControl *OpenMAXILPlayerService::requestControl(const char *name)
8389
if (qstrcmp(name, QMetaDataReaderControl_iid) == 0)
8490
return m_metaData;
8591

92+
if (qstrcmp(name, QMediaVideoProbeControl_iid) == 0)
93+
return m_videoProbe;
94+
8695
#if 0
8796
if (qstrcmp(name, QMediaStreamsControl_iid) == 0)
8897
return 0;

0 commit comments

Comments
 (0)