Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
nheko
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Nheko Reborn
nheko
Commits
61d2d1c6
Verified
Commit
61d2d1c6
authored
3 years ago
by
Nicolas Werner
Browse files
Options
Downloads
Patches
Plain Diff
Support exif rotation on received videos
fixes #674
parent
131c64ec
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Pipeline
#2067
passed
3 years ago
Stage: build
Stage: deploy
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
resources/qml/delegates/PlayableMediaMessage.qml
+1
-0
1 addition, 0 deletions
resources/qml/delegates/PlayableMediaMessage.qml
src/ui/MxcMediaProxy.cpp
+32
-0
32 additions, 0 deletions
src/ui/MxcMediaProxy.cpp
src/ui/MxcMediaProxy.h
+7
-16
7 additions, 16 deletions
src/ui/MxcMediaProxy.h
with
40 additions
and
16 deletions
resources/qml/delegates/PlayableMediaMessage.qml
+
1
−
0
View file @
61d2d1c6
...
...
@@ -67,6 +67,7 @@ Item {
fillMode
:
VideoOutput
.
PreserveAspectFit
source
:
mxcmedia
flushMode
:
VideoOutput
.
FirstFrame
orientation
:
mxcmedia
.
orientation
}
}
...
...
This diff is collapsed.
Click to expand it.
src/ui/MxcMediaProxy.cpp
+
32
−
0
View file @
61d2d1c6
...
...
@@ -7,6 +7,7 @@
#include
<QDir>
#include
<QFile>
#include
<QFileInfo>
#include
<QMediaMetaData>
#include
<QMediaObject>
#include
<QMediaPlayer>
#include
<QMimeDatabase>
...
...
@@ -23,6 +24,28 @@
#include
"MatrixClient.h"
#include
"timeline/TimelineModel.h"
MxcMediaProxy
::
MxcMediaProxy
(
QObject
*
parent
)
:
QMediaPlayer
(
parent
)
{
connect
(
this
,
&
MxcMediaProxy
::
eventIdChanged
,
&
MxcMediaProxy
::
startDownload
);
connect
(
this
,
&
MxcMediaProxy
::
roomChanged
,
&
MxcMediaProxy
::
startDownload
);
connect
(
this
,
qOverload
<
QMediaPlayer
::
Error
>
(
&
MxcMediaProxy
::
error
),
[
this
](
QMediaPlayer
::
Error
error
)
{
nhlog
::
ui
()
->
info
(
"Media player error {} and errorStr {}"
,
error
,
this
->
errorString
().
toStdString
());
});
connect
(
this
,
&
MxcMediaProxy
::
mediaStatusChanged
,
[
this
](
QMediaPlayer
::
MediaStatus
status
)
{
nhlog
::
ui
()
->
info
(
"Media player status {} and error {}"
,
status
,
this
->
error
());
});
connect
(
this
,
qOverload
<
const
QString
&
,
const
QVariant
&>
(
&
MxcMediaProxy
::
metaDataChanged
),
[
this
](
QString
t
,
QVariant
)
{
if
(
t
==
QMediaMetaData
::
Orientation
)
emit
orientationChanged
();
});
}
void
MxcMediaProxy
::
setVideoSurface
(
QAbstractVideoSurface
*
surface
)
{
...
...
@@ -37,6 +60,15 @@ MxcMediaProxy::getVideoSurface()
return
m_surface
;
}
int
MxcMediaProxy
::
orientation
()
const
{
nhlog
::
ui
()
->
debug
(
"metadata: {}"
,
availableMetaData
().
join
(
","
).
toStdString
());
auto
orientation
=
metaData
(
QMediaMetaData
::
Orientation
).
toInt
();
nhlog
::
ui
()
->
debug
(
"Video orientation: {}"
,
orientation
);
return
orientation
;
}
void
MxcMediaProxy
::
startDownload
()
{
...
...
This diff is collapsed.
Click to expand it.
src/ui/MxcMediaProxy.h
+
7
−
16
View file @
61d2d1c6
...
...
@@ -25,23 +25,10 @@ class MxcMediaProxy : public QMediaPlayer
Q_PROPERTY
(
QString
eventId
READ
eventId
WRITE
setEventId
NOTIFY
eventIdChanged
)
Q_PROPERTY
(
QAbstractVideoSurface
*
videoSurface
READ
getVideoSurface
WRITE
setVideoSurface
)
Q_PROPERTY
(
bool
loaded
READ
loaded
NOTIFY
loadedChanged
)
Q_PROPERTY
(
int
orientation
READ
orientation
NOTIFY
orientationChanged
)
public:
MxcMediaProxy
(
QObject
*
parent
=
nullptr
)
:
QMediaPlayer
(
parent
)
{
connect
(
this
,
&
MxcMediaProxy
::
eventIdChanged
,
&
MxcMediaProxy
::
startDownload
);
connect
(
this
,
&
MxcMediaProxy
::
roomChanged
,
&
MxcMediaProxy
::
startDownload
);
connect
(
this
,
qOverload
<
QMediaPlayer
::
Error
>
(
&
MxcMediaProxy
::
error
),
[
this
](
QMediaPlayer
::
Error
error
)
{
nhlog
::
ui
()
->
info
(
"Media player error {} and errorStr {}"
,
error
,
this
->
errorString
().
toStdString
());
});
connect
(
this
,
&
MxcMediaProxy
::
mediaStatusChanged
,
[
this
](
QMediaPlayer
::
MediaStatus
status
)
{
nhlog
::
ui
()
->
info
(
"Media player status {} and error {}"
,
status
,
this
->
error
());
});
}
MxcMediaProxy
(
QObject
*
parent
=
nullptr
);
bool
loaded
()
const
{
return
buffer
.
size
()
>
0
;
}
QString
eventId
()
const
{
return
eventId_
;
}
...
...
@@ -59,12 +46,16 @@ public:
void
setVideoSurface
(
QAbstractVideoSurface
*
surface
);
QAbstractVideoSurface
*
getVideoSurface
();
int
orientation
()
const
;
signals
:
void
roomChanged
();
void
eventIdChanged
();
void
loadedChanged
();
void
newBuffer
(
QMediaContent
,
QIODevice
*
buf
);
void
orientationChanged
();
private
slots
:
void
startDownload
();
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment