Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
PlayWallDesktop
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
PlayWall
PlayWallDesktop
Commits
b13af013
Commit
b13af013
authored
3 years ago
by
Tobias Ullerich
Browse files
Options
Downloads
Patches
Plain Diff
#173 - Add null check for ffmpeg and ffprobe initialization
parent
ea8e9855
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
PlayWallPlugins/PlayWallPluginContentPlayer/src/main/scala/de/tobias/playpad/plugin/content/util/FfmpegUtils.scala
+22
-2
22 additions, 2 deletions
...a/de/tobias/playpad/plugin/content/util/FfmpegUtils.scala
with
22 additions
and
2 deletions
PlayWallPlugins/PlayWallPluginContentPlayer/src/main/scala/de/tobias/playpad/plugin/content/util/FfmpegUtils.scala
+
22
−
2
View file @
b13af013
...
@@ -8,6 +8,7 @@ import de.tobias.playpad.profile.Profile
...
@@ -8,6 +8,7 @@ import de.tobias.playpad.profile.Profile
import
javafx.util.Pair
import
javafx.util.Pair
import
net.bramp.ffmpeg.builder.FFmpegBuilder
import
net.bramp.ffmpeg.builder.FFmpegBuilder
import
net.bramp.ffmpeg.
{
FFmpeg
,
FFmpegExecutor
,
FFprobe
}
import
net.bramp.ffmpeg.
{
FFmpeg
,
FFmpegExecutor
,
FFprobe
}
import
org.apache.commons.lang3.StringUtils
import
java.nio.file.
{
Files
,
Path
}
import
java.nio.file.
{
Files
,
Path
}
...
@@ -21,11 +22,26 @@ object FfmpegUtils {
...
@@ -21,11 +22,26 @@ object FfmpegUtils {
val
profile
=
Profile
.
currentProfile
()
val
profile
=
Profile
.
currentProfile
()
val
contentPluginConfiguration
=
profile
.
getCustomSettings
(
ContentPluginMain
.
zoneConfigurationKey
).
asInstanceOf
[
ContentPlayerPluginConfiguration
]
val
contentPluginConfiguration
=
profile
.
getCustomSettings
(
ContentPluginMain
.
zoneConfigurationKey
).
asInstanceOf
[
ContentPlayerPluginConfiguration
]
if
(
StringUtils
.
isNotEmpty
(
contentPluginConfiguration
.
ffmpegExecutable
)
&&
StringUtils
.
isNotEmpty
(
contentPluginConfiguration
.
ffprobeExecutable
))
{
ffmpeg
=
new
FFmpeg
(
contentPluginConfiguration
.
ffmpegExecutable
)
ffmpeg
=
new
FFmpeg
(
contentPluginConfiguration
.
ffmpegExecutable
)
ffprobe
=
new
FFprobe
(
contentPluginConfiguration
.
ffprobeExecutable
)
ffprobe
=
new
FFprobe
(
contentPluginConfiguration
.
ffprobeExecutable
)
}
}
}
def
checkInitialization
()
:
Boolean
=
{
if
(
ffprobe
==
null
||
ffmpeg
==
null
)
{
initialize
()
return
ffprobe
!=
null
&&
ffmpeg
!=
null
}
true
}
def
getResolution
(
path
:
Path
)
:
Pair
[
Int
,
Int
]
=
{
def
getResolution
(
path
:
Path
)
:
Pair
[
Int
,
Int
]
=
{
if
(!
checkInitialization
())
{
return
null
}
val
probeResult
=
ffprobe
.
probe
(
path
.
toAbsolutePath
.
toString
)
val
probeResult
=
ffprobe
.
probe
(
path
.
toAbsolutePath
.
toString
)
val
stream
=
probeResult
.
streams
.
head
val
stream
=
probeResult
.
streams
.
head
...
@@ -36,6 +52,10 @@ object FfmpegUtils {
...
@@ -36,6 +52,10 @@ object FfmpegUtils {
}
}
def
convertMediaVStack
(
path
:
Path
)
:
Unit
=
{
def
convertMediaVStack
(
path
:
Path
)
:
Unit
=
{
if
(!
checkInitialization
())
{
return
}
val
globalSettings
=
PlayPadPlugin
.
getInstance
.
getGlobalSettings
val
globalSettings
=
PlayPadPlugin
.
getInstance
.
getGlobalSettings
val
convertPath
=
globalSettings
.
getCachePath
.
resolve
(
path
.
getFileName
+
".mp4"
)
val
convertPath
=
globalSettings
.
getCachePath
.
resolve
(
path
.
getFileName
+
".mp4"
)
...
...
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