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
96aacf80
Verified
Commit
96aacf80
authored
3 years ago
by
Nicolas Werner
Browse files
Options
Downloads
Patches
Plain Diff
Small fixes to video thumbnailing
parent
15c94620
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Pipeline
#2855
passed
3 years ago
Stage: build
Stage: deploy
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/timeline/InputBar.cpp
+17
-34
17 additions, 34 deletions
src/timeline/InputBar.cpp
with
17 additions
and
34 deletions
src/timeline/InputBar.cpp
+
17
−
34
View file @
96aacf80
...
@@ -55,33 +55,7 @@ MediaUpload::thumbnailDataUrl() const
...
@@ -55,33 +55,7 @@ MediaUpload::thumbnailDataUrl() const
bool
bool
InputVideoSurface
::
present
(
const
QVideoFrame
&
frame
)
InputVideoSurface
::
present
(
const
QVideoFrame
&
frame
)
{
{
QImage
::
Format
format
=
QImage
::
Format_Invalid
;
QImage
::
Format
format
=
QVideoFrame
::
imageFormatFromPixelFormat
(
frame
.
pixelFormat
());
switch
(
frame
.
pixelFormat
())
{
case
QVideoFrame
::
Format_ARGB32
:
format
=
QImage
::
Format_ARGB32
;
break
;
case
QVideoFrame
::
Format_ARGB32_Premultiplied
:
format
=
QImage
::
Format_ARGB32_Premultiplied
;
break
;
case
QVideoFrame
::
Format_RGB24
:
format
=
QImage
::
Format_RGB888
;
break
;
case
QVideoFrame
::
Format_BGR24
:
format
=
QImage
::
Format_BGR888
;
break
;
case
QVideoFrame
::
Format_RGB32
:
format
=
QImage
::
Format_RGB32
;
break
;
case
QVideoFrame
::
Format_RGB565
:
format
=
QImage
::
Format_RGB16
;
break
;
case
QVideoFrame
::
Format_RGB555
:
format
=
QImage
::
Format_RGB555
;
break
;
default:
format
=
QImage
::
Format_Invalid
;
}
if
(
format
==
QImage
::
Format_Invalid
)
{
if
(
format
==
QImage
::
Format_Invalid
)
{
emit
newImage
({});
emit
newImage
({});
...
@@ -95,11 +69,14 @@ InputVideoSurface::present(const QVideoFrame &frame)
...
@@ -95,11 +69,14 @@ InputVideoSurface::present(const QVideoFrame &frame)
}
}
// this is a shallow operation. it just refer the frame buffer
// this is a shallow operation. it just refer the frame buffer
QImage
image
(
frametodraw
.
bits
(),
QImage
image
(
qAsConst
(
frametodraw
)
.
bits
(),
frametodraw
.
width
(),
frametodraw
.
width
(),
frametodraw
.
height
(),
frametodraw
.
height
(),
frametodraw
.
bytesPerLine
(),
frametodraw
.
bytesPerLine
(),
format
);
format
);
image
.
detach
();
frametodraw
.
unmap
();
emit
newImage
(
std
::
move
(
image
));
emit
newImage
(
std
::
move
(
image
));
return
true
;
return
true
;
...
@@ -820,14 +797,16 @@ MediaUpload::MediaUpload(std::unique_ptr<QIODevice> source_,
...
@@ -820,14 +797,16 @@ MediaUpload::MediaUpload(std::unique_ptr<QIODevice> source_,
}
else
if
(
mimeClass_
==
u"video"
||
mimeClass_
==
u"audio"
)
{
}
else
if
(
mimeClass_
==
u"video"
||
mimeClass_
==
u"audio"
)
{
auto
mediaPlayer
=
new
QMediaPlayer
(
auto
mediaPlayer
=
new
QMediaPlayer
(
this
,
this
,
mimeClass_
==
u"video"
?
QFlags
{
QMediaPlayer
::
StreamPlayback
,
QMediaPlayer
::
VideoSurface
}
mimeClass_
==
u"video"
?
QFlags
{
QMediaPlayer
::
VideoSurface
}
:
QMediaPlayer
::
Flags
{});
:
QFlags
{
QMediaPlayer
::
StreamPlayback
});
mediaPlayer
->
setMuted
(
true
);
mediaPlayer
->
setMuted
(
true
);
if
(
mimeClass_
==
u"video"
)
{
if
(
mimeClass_
==
u"video"
)
{
auto
newSurface
=
new
InputVideoSurface
(
this
);
auto
newSurface
=
new
InputVideoSurface
(
this
);
connect
(
connect
(
newSurface
,
&
InputVideoSurface
::
newImage
,
this
,
[
this
,
mediaPlayer
](
QImage
img
)
{
newSurface
,
&
InputVideoSurface
::
newImage
,
this
,
[
this
,
mediaPlayer
](
QImage
img
)
{
if
(
img
.
size
().
isEmpty
())
return
;
mediaPlayer
->
stop
();
mediaPlayer
->
stop
();
auto
orientation
=
mediaPlayer
->
metaData
(
QMediaMetaData
::
Orientation
).
toInt
();
auto
orientation
=
mediaPlayer
->
metaData
(
QMediaMetaData
::
Orientation
).
toInt
();
...
@@ -882,10 +861,14 @@ MediaUpload::MediaUpload(std::unique_ptr<QIODevice> source_,
...
@@ -882,10 +861,14 @@ MediaUpload::MediaUpload(std::unique_ptr<QIODevice> source_,
if
(
mediaPlayer
->
duration
()
>
0
)
if
(
mediaPlayer
->
duration
()
>
0
)
this
->
duration_
=
mediaPlayer
->
duration
();
this
->
duration_
=
mediaPlayer
->
duration
();
dimensions_
=
mediaPlayer
->
metaData
(
QMediaMetaData
::
Resolution
).
toSize
();
auto
dimensions
=
mediaPlayer
->
metaData
(
QMediaMetaData
::
Resolution
).
toSize
();
auto
orientation
=
mediaPlayer
->
metaData
(
QMediaMetaData
::
Orientation
).
toInt
();
if
(
!
dimensions
.
isEmpty
())
{
if
(
orientation
==
90
||
orientation
==
270
)
{
dimensions_
=
dimensions
;
dimensions_
.
transpose
();
auto
orientation
=
mediaPlayer
->
metaData
(
QMediaMetaData
::
Orientation
).
toInt
();
if
(
orientation
==
90
||
orientation
==
270
)
{
dimensions_
.
transpose
();
}
}
}
});
});
connect
(
mediaPlayer
,
&
QMediaPlayer
::
durationChanged
,
[
this
,
mediaPlayer
](
qint64
duration
)
{
connect
(
mediaPlayer
,
&
QMediaPlayer
::
durationChanged
,
[
this
,
mediaPlayer
](
qint64
duration
)
{
...
...
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