Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Val Doroshchuk
qtgstreamerextras
Commits
0b5045ed
Commit
0b5045ed
authored
Dec 10, 2018
by
Val Doroshchuk
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tests
parent
a9d2faf9
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
64 additions
and
8 deletions
+64
-8
src/gstreamerextras/qgstreamerpipeline.cpp
src/gstreamerextras/qgstreamerpipeline.cpp
+1
-1
tests/auto/integration/qgstreamerpipeline/tst_qgstreamerpipeline.cpp
...integration/qgstreamerpipeline/tst_qgstreamerpipeline.cpp
+61
-4
tests/auto/integration/qgstreamerplaybin/tst_qgstreamerplaybin.cpp
...o/integration/qgstreamerplaybin/tst_qgstreamerplaybin.cpp
+2
-3
No files found.
src/gstreamerextras/qgstreamerpipeline.cpp
View file @
0b5045ed
...
...
@@ -163,7 +163,7 @@ void QGstreamerPipeline::setPipeline(const QString &desc)
QString
pl
=
QLatin1String
(
"gst-pipeline:"
)
+
desc
;
if
(
d
->
source
)
d
->
source
->
setProperty
(
"source"
,
QVariant
::
fromValue
<
QUrl
>
(
QUrl
(
pl
))
)
;
d
->
source
->
setProperty
(
"source"
,
QVariant
::
fromValue
<
QUrl
>
(
pl
));
else
d
->
mediaPlayer
->
setMedia
(
QMediaContent
(
pl
));
...
...
tests/auto/integration/qgstreamerpipeline/tst_qgstreamerpipeline.cpp
View file @
0b5045ed
...
...
@@ -26,11 +26,11 @@
**
****************************************************************************/
#include <QtTest/QtTest>
#include <QMediaPlayer>
#include <QGstreamerPipeline>
#include <QMediaPlayer>
#include <QAbstractVideoSurface>
#include <QVideoWidget>
#include <QtTest/QtTest>
QT_USE_NAMESPACE
...
...
@@ -40,6 +40,8 @@ class tst_QGstreamerPipeline: public QObject
private
slots
:
void
testMediaPlayer
();
void
testPipeline
();
void
testPipelineSurface
();
void
testPipelineWidget
();
void
testSetProperty
();
private:
...
...
@@ -47,6 +49,25 @@ private:
QGstreamerPipeline
*
control
=
nullptr
;
};
struct
Surface
:
QAbstractVideoSurface
{
Surface
(
QObject
*
parent
=
nullptr
)
:
QAbstractVideoSurface
(
parent
)
{
}
QList
<
QVideoFrame
::
PixelFormat
>
supportedPixelFormats
(
QAbstractVideoBuffer
::
HandleType
)
const
override
{
return
QList
<
QVideoFrame
::
PixelFormat
>
()
<<
QVideoFrame
::
Format_ARGB32
;
}
bool
isFormatSupported
(
const
QVideoSurfaceFormat
&
)
const
override
{
return
true
;
}
bool
start
(
const
QVideoSurfaceFormat
&
)
override
{
return
true
;
}
void
stop
()
override
{
}
bool
present
(
const
QVideoFrame
&
)
override
{
return
true
;
}
};
void
tst_QGstreamerPipeline
::
testMediaPlayer
()
{
QMediaPlayer
mediaPlayer
;
...
...
@@ -69,6 +90,42 @@ void tst_QGstreamerPipeline::testPipeline()
QCOMPARE
(
p
.
pipeline
(),
pl
);
}
void
tst_QGstreamerPipeline
::
testPipelineSurface
()
{
QMediaPlayer
mediaPlayer
;
Surface
*
s
=
new
Surface
(
this
);
mediaPlayer
.
setVideoOutput
(
s
);
QGstreamerPipeline
p
(
&
mediaPlayer
);
QSignalSpy
spy
(
&
p
,
&
QGstreamerPipeline
::
pipelineChanged
);
QString
pl
=
"videotestsrc ! xvimagesink name=qtvideosink"
;
p
.
setPipeline
(
pl
);
mediaPlayer
.
play
();
QTRY_COMPARE
(
spy
.
count
(),
1
);
QCOMPARE
(
mediaPlayer
.
error
(),
QMediaPlayer
::
NoError
);
QCOMPARE
(
p
.
pipeline
(),
pl
);
}
void
tst_QGstreamerPipeline
::
testPipelineWidget
()
{
QMediaPlayer
mediaPlayer
;
QVideoWidget
w
;
mediaPlayer
.
setVideoOutput
(
&
w
);
QGstreamerPipeline
p
(
&
mediaPlayer
);
QSignalSpy
spy
(
&
p
,
&
QGstreamerPipeline
::
pipelineChanged
);
QString
pl
=
"videotestsrc ! xvimagesink name=qtvideosink"
;
p
.
setPipeline
(
pl
);
mediaPlayer
.
play
();
QTRY_COMPARE
(
spy
.
count
(),
1
);
QCOMPARE
(
mediaPlayer
.
error
(),
QMediaPlayer
::
NoError
);
QCOMPARE
(
p
.
pipeline
(),
pl
);
}
void
tst_QGstreamerPipeline
::
testSetProperty
()
{
QMediaPlayer
mediaPlayer
;
...
...
@@ -81,5 +138,5 @@ void tst_QGstreamerPipeline::testSetProperty()
QCOMPARE
(
mediaPlayer
.
error
(),
QMediaPlayer
::
NoError
);
}
QTEST_
GUILESS_
MAIN
(
tst_QGstreamerPipeline
)
QTEST_MAIN
(
tst_QGstreamerPipeline
)
#include "tst_qgstreamerpipeline.moc"
tests/auto/integration/qgstreamerplaybin/tst_qgstreamerplaybin.cpp
View file @
0b5045ed
...
...
@@ -26,11 +26,10 @@
**
****************************************************************************/
#include <QtTest/QtTest>
#include <QMediaPlayer>
#include <QGstreamerPlaybin>
#include <QMediaPlayer>
#include <QAbstractVideoSurface>
#include <QtTest/QtTest>
QT_USE_NAMESPACE
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment