mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2024-11-25 15:45:38 +00:00
Added theme support for disabling audio playback for each defined video.
This commit is contained in:
parent
29514d4db9
commit
f803e23fd2
|
@ -111,6 +111,7 @@ std::map<std::string, std::map<std::string, ThemeData::ElementPropertyType>>
|
|||
{"defaultImage", PATH},
|
||||
{"imageType", STRING},
|
||||
{"gameselector", STRING},
|
||||
{"audio", BOOLEAN},
|
||||
{"interpolation", STRING},
|
||||
{"pillarboxes", BOOLEAN},
|
||||
{"scanlines", BOOLEAN},
|
||||
|
|
|
@ -32,6 +32,7 @@ VideoComponent::VideoComponent()
|
|||
, mMediaViewerMode {false}
|
||||
, mScreensaverMode {false}
|
||||
, mTargetIsMax {false}
|
||||
, mPlayAudio {true}
|
||||
, mDrawPillarboxes {true}
|
||||
, mRenderScanlines {false}
|
||||
, mLegacyTheme {false}
|
||||
|
@ -132,6 +133,9 @@ void VideoComponent::applyTheme(const std::shared_ptr<ThemeData>& theme,
|
|||
mVideoAreaPos = elem->get<glm::vec2>("pos") * scale;
|
||||
}
|
||||
|
||||
if (elem->has("audio"))
|
||||
mPlayAudio = elem->get<bool>("audio");
|
||||
|
||||
if (elem->has("interpolation")) {
|
||||
const std::string interpolation {elem->get<std::string>("interpolation")};
|
||||
if (interpolation == "linear") {
|
||||
|
|
|
@ -121,6 +121,7 @@ protected:
|
|||
bool mMediaViewerMode;
|
||||
bool mScreensaverMode;
|
||||
bool mTargetIsMax;
|
||||
bool mPlayAudio;
|
||||
bool mDrawPillarboxes;
|
||||
bool mRenderScanlines;
|
||||
bool mLegacyTheme;
|
||||
|
|
|
@ -1351,7 +1351,9 @@ void VideoFFmpegComponent::startVideoStream()
|
|||
}
|
||||
|
||||
// Audio stream setup, optional as some videos do not have any audio tracks.
|
||||
// Audio can also be disabled per video via the theme configuration.
|
||||
|
||||
if (mPlayAudio) {
|
||||
mAudioStreamIndex =
|
||||
av_find_best_stream(mFormatContext, AVMEDIA_TYPE_AUDIO, -1, -1, nullptr, 0);
|
||||
|
||||
|
@ -1366,8 +1368,8 @@ void VideoFFmpegComponent::startVideoStream()
|
|||
const_cast<AVCodec*>(avcodec_find_decoder(mAudioStream->codecpar->codec_id));
|
||||
|
||||
if (!mAudioCodec) {
|
||||
LOG(LogError) << "Couldn't find a suitable audio codec for file \"" << mVideoPath
|
||||
<< "\"";
|
||||
LOG(LogError) << "Couldn't find a suitable audio codec for file \""
|
||||
<< mVideoPath << "\"";
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1394,6 +1396,7 @@ void VideoFFmpegComponent::startVideoStream()
|
|||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
mVideoTimeBase = 1.0l / av_q2d(mVideoStream->avg_frame_rate);
|
||||
|
||||
|
|
Loading…
Reference in a new issue