Skip to content
This repository has been archived by the owner on Jan 21, 2021. It is now read-only.

Commit

Permalink
* (Windows)Fix: some channel layouts didn't work (#373)
Browse files Browse the repository at this point in the history
  • Loading branch information
bylee20 committed May 20, 2015
1 parent 734ce8e commit c0485dd
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 11 deletions.
18 changes: 17 additions & 1 deletion src/bomi/audio/channellayoutmap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,25 @@

DECLARE_LOG_CONTEXT(Audio)

auto _ChmapNameFromLayout(ChannelLayout layout) -> QByteArray
{
auto name = ChannelLayoutInfo::data(layout);
switch (layout) {
#ifdef Q_OS_LINUX
case ChannelLayout::_5_0:
case ChannelLayout::_4_1:
case ChannelLayout::_5_1:
case ChannelLayout::_7_1:
return name + "(alsa)";
#endif
default:
return name;
}
}

auto _ChmapFromLayout(mp_chmap *chmap, ChannelLayout layout) -> bool
{
const auto data = ChannelLayoutInfo::data(layout);
const auto data = _ChmapNameFromLayout(layout);
return mp_chmap_from_str(chmap, bstr0(data.constData()));
}

Expand Down
1 change: 1 addition & 0 deletions src/bomi/audio/channellayoutmap.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ class ChannelLayoutMap {
};

auto _ChmapFromLayout(mp_chmap *chmap, ChannelLayout layout) -> bool;
auto _ChmapNameFromLayout(ChannelLayout layout) -> QByteArray;

Q_DECLARE_METATYPE(ChannelLayoutMap)

Expand Down
8 changes: 4 additions & 4 deletions src/bomi/enum/channellayout.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ const std::array<ChannelLayoutInfo::Item, 26> ChannelLayoutInfo::info{{
{ChannelLayout::_4_0, u"_4_0"_q, u"4.0"_q, "quad"},
{ChannelLayout::_4_0_Side, u"_4_0_Side"_q, u"4.0(side)"_q, "quad(side)"},
{ChannelLayout::_4_0_Diamond, u"_4_0_Diamond"_q, u"4.0(diamond)"_q, "4.0"},
{ChannelLayout::_4_1, u"_4_1"_q, u"4.1"_q, "4.1(alsa)"},
{ChannelLayout::_4_1, u"_4_1"_q, u"4.1"_q, "4.1"},
{ChannelLayout::_4_1_Diamond, u"_4_1_Diamond"_q, u"4.1(diamond)"_q, "4.1"},
{ChannelLayout::_5_0, u"_5_0"_q, u"5.0"_q, "5.0(alsa)"},
{ChannelLayout::_5_0, u"_5_0"_q, u"5.0"_q, "5.0"},
{ChannelLayout::_5_0_Side, u"_5_0_Side"_q, u"5.0(side)"_q, "5.0(side)"},
{ChannelLayout::_5_1, u"_5_1"_q, u"5.1"_q, "5.1(alsa)"},
{ChannelLayout::_5_1, u"_5_1"_q, u"5.1"_q, "5.1"},
{ChannelLayout::_5_1_Side, u"_5_1_Side"_q, u"5.1(side)"_q, "5.1(side)"},
{ChannelLayout::_6_0, u"_6_0"_q, u"6.0"_q, "6.0"},
{ChannelLayout::_6_0_Front, u"_6_0_Front"_q, u"6.0(front)"_q, "6.0(front)"},
Expand All @@ -24,7 +24,7 @@ const std::array<ChannelLayoutInfo::Item, 26> ChannelLayoutInfo::info{{
{ChannelLayout::_6_1_Front, u"_6_1_Front"_q, u"6.1(front)"_q, "6.1(front)"},
{ChannelLayout::_7_0, u"_7_0"_q, u"7.0"_q, "7.0"},
{ChannelLayout::_7_0_Front, u"_7_0_Front"_q, u"7.0(front)"_q, "7.0(front)"},
{ChannelLayout::_7_1, u"_7_1"_q, u"7.1"_q, "7.1(alsa)"},
{ChannelLayout::_7_1, u"_7_1"_q, u"7.1"_q, "7.1"},
{ChannelLayout::_7_1_Wide, u"_7_1_Wide"_q, u"7.1(wide)"_q, "7.1(wide)"},
{ChannelLayout::_7_1_Side, u"_7_1_Side"_q, u"7.1(side)"_q, "7.1(wide-side)"}
}};
2 changes: 1 addition & 1 deletion src/bomi/player/playengine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -552,7 +552,7 @@ auto PlayEngine::unlock() -> void
auto PlayEngine::setChannelLayout(ChannelLayout layout) -> void
{
if (d->params.set_audio_channel_layout(layout)) {
d->mpv.setAsync("options/audio-channels", ChannelLayoutInfo::data(layout));
d->mpv.setAsync("options/audio-channels", _ChmapNameFromLayout(layout));
if (d->time > 0)
d->mpv.tellAsync("ao_reload");
}
Expand Down
2 changes: 1 addition & 1 deletion src/bomi/player/playengine_p.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ auto PlayEngine::Data::onLoad() -> void
mpv.setAsync("options/volume", volume(local));
mpv.setAsync("options/mute", local->audio_muted() ? "yes"_b : "no"_b);
mpv.setAsync("options/audio-delay", local->audio_sync() * 1e-3);
mpv.setAsync("options/audio-channels", ChannelLayoutInfo::data(local->audio_channel_layout()));
mpv.setAsync("options/audio-channels", _ChmapNameFromLayout(local->audio_channel_layout()));

// missing options: sub_alignment, sub_display, sub_position
mpv.setAsync("options/sub-visibility", !local->sub_hidden());
Expand Down
2 changes: 2 additions & 0 deletions src/bomi/player/playengine_p.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@

DECLARE_LOG_CONTEXT(Engine)

auto _ChmapNameFromLayout(ChannelLayout layout) -> QByteArray;

enum EventType {
UserType = QEvent::User, StateChange, WaitingChange,
PreparePlayback,EndPlayback, StartPlayback, NotifySeek,
Expand Down
8 changes: 4 additions & 4 deletions src/bomi/prebuild/enum-list
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,11 @@
-_4_0[=((int)SpeakerId::FrontLeft|(int)SpeakerId::FrontRight|(int)SpeakerId::BackLeft|(int)SpeakerId::BackRight)=][[4.0]][:"quad":][-4.0ch-]
-_4_0_Side[=((int)SpeakerId::FrontLeft|(int)SpeakerId::FrontRight|(int)SpeakerId::SideLeft|(int)SpeakerId::SideRight)=][[4.0(side)]][:"quad(side)":][-4.0ch(Side)-]
-_4_0_Diamond[=((int)SpeakerId::FrontLeft|(int)SpeakerId::FrontRight|(int)SpeakerId::FrontCenter|(int)SpeakerId::BackCenter)=][[4.0(diamond)]][:"4.0":][-4.0ch(Diamond)-]
-_4_1[=((int)SpeakerId::FrontLeft|(int)SpeakerId::FrontRight|(int)SpeakerId::BackLeft|(int)SpeakerId::BackRight|(int)SpeakerId::LowFrequency)=][[4.1]][:"4.1(alsa)":][-4.1ch-]
-_4_1[=((int)SpeakerId::FrontLeft|(int)SpeakerId::FrontRight|(int)SpeakerId::BackLeft|(int)SpeakerId::BackRight|(int)SpeakerId::LowFrequency)=][[4.1]][:"4.1":][-4.1ch-]
-_4_1_Diamond[=((int)SpeakerId::FrontLeft|(int)SpeakerId::FrontRight|(int)SpeakerId::FrontCenter|(int)SpeakerId::BackCenter|(int)SpeakerId::LowFrequency)=][[4.1(diamond)]][:"4.1":][-4.1ch(Diamond)-]
-_5_0[=((int)SpeakerId::FrontLeft|(int)SpeakerId::FrontRight|(int)SpeakerId::FrontCenter|(int)SpeakerId::BackLeft|(int)SpeakerId::BackRight)=][[5.0]][:"5.0(alsa)":][-5.0ch-]
-_5_0[=((int)SpeakerId::FrontLeft|(int)SpeakerId::FrontRight|(int)SpeakerId::FrontCenter|(int)SpeakerId::BackLeft|(int)SpeakerId::BackRight)=][[5.0]][:"5.0":][-5.0ch-]
-_5_0_Side[=((int)SpeakerId::FrontLeft|(int)SpeakerId::FrontRight|(int)SpeakerId::FrontCenter|(int)SpeakerId::SideLeft|(int)SpeakerId::SideRight)=][[5.0(side)]][:"5.0(side)":][-5.0ch(Side)-]
-_5_1[=((int)SpeakerId::FrontLeft|(int)SpeakerId::FrontRight|(int)SpeakerId::FrontCenter|(int)SpeakerId::BackLeft|(int)SpeakerId::BackRight|(int)SpeakerId::LowFrequency)=][[5.1]][:"5.1(alsa)":][-5.1ch-]
-_5_1[=((int)SpeakerId::FrontLeft|(int)SpeakerId::FrontRight|(int)SpeakerId::FrontCenter|(int)SpeakerId::BackLeft|(int)SpeakerId::BackRight|(int)SpeakerId::LowFrequency)=][[5.1]][:"5.1":][-5.1ch-]
-_5_1_Side[=((int)SpeakerId::FrontLeft|(int)SpeakerId::FrontRight|(int)SpeakerId::FrontCenter|(int)SpeakerId::SideLeft|(int)SpeakerId::SideRight|(int)SpeakerId::LowFrequency)=][[5.1(side)]][:"5.1(side)":][-5.1ch(Side)-]
-_6_0[=((int)SpeakerId::FrontLeft|(int)SpeakerId::FrontRight|(int)SpeakerId::FrontCenter|(int)SpeakerId::BackCenter|(int)SpeakerId::SideLeft|(int)SpeakerId::SideRight)=][[6.0]][:"6.0":][-6.0ch-]
-_6_0_Front[=((int)SpeakerId::FrontLeft|(int)SpeakerId::FrontRight|(int)SpeakerId::FrontLeftCenter|(int)SpeakerId::FrontRightCenter|(int)SpeakerId::SideLeft|(int)SpeakerId::SideRight)=][[6.0(front)]][:"6.0(front)":][-6.0ch(Front)-]
Expand All @@ -52,7 +52,7 @@
-_6_1_Front[=((int)SpeakerId::FrontLeft|(int)SpeakerId::FrontRight|(int)SpeakerId::FrontLeftCenter|(int)SpeakerId::FrontRightCenter|(int)SpeakerId::SideLeft|(int)SpeakerId::SideRight|(int)SpeakerId::LowFrequency)=][[6.1(front)]][:"6.1(front)":][-6.1ch(Front)-]
-_7_0[=((int)SpeakerId::FrontLeft|(int)SpeakerId::FrontRight|(int)SpeakerId::FrontCenter|(int)SpeakerId::BackLeft|(int)SpeakerId::BackRight|(int)SpeakerId::SideLeft|(int)SpeakerId::SideRight)=][[7.0]][:"7.0":][-7.0ch-]
-_7_0_Front[=((int)SpeakerId::FrontLeft|(int)SpeakerId::FrontRight|(int)SpeakerId::FrontCenter|(int)SpeakerId::FrontLeftCenter|(int)SpeakerId::FrontRightCenter|(int)SpeakerId::SideLeft|(int)SpeakerId::SideRight)=][[7.0(front)]][:"7.0(front)":][-7.0ch(Front)-]
-_7_1[=((int)SpeakerId::FrontLeft|(int)SpeakerId::FrontRight|(int)SpeakerId::FrontCenter|(int)SpeakerId::BackLeft|(int)SpeakerId::BackRight|(int)SpeakerId::SideLeft|(int)SpeakerId::SideRight|(int)SpeakerId::LowFrequency)=][[7.1]][:"7.1(alsa)":][-7.1ch-]
-_7_1[=((int)SpeakerId::FrontLeft|(int)SpeakerId::FrontRight|(int)SpeakerId::FrontCenter|(int)SpeakerId::BackLeft|(int)SpeakerId::BackRight|(int)SpeakerId::SideLeft|(int)SpeakerId::SideRight|(int)SpeakerId::LowFrequency)=][[7.1]][:"7.1":][-7.1ch-]
-_7_1_Wide[=((int)SpeakerId::FrontLeft|(int)SpeakerId::FrontRight|(int)SpeakerId::FrontCenter|(int)SpeakerId::FrontLeftCenter|(int)SpeakerId::FrontRightCenter|(int)SpeakerId::BackLeft|(int)SpeakerId::BackRight|(int)SpeakerId::LowFrequency)=][[7.1(wide)]][:"7.1(wide)":][-7.1ch(Wide)-]
-_7_1_Side[=((int)SpeakerId::FrontLeft|(int)SpeakerId::FrontRight|(int)SpeakerId::FrontCenter|(int)SpeakerId::FrontLeftCenter|(int)SpeakerId::FrontRightCenter|(int)SpeakerId::SideLeft|(int)SpeakerId::SideRight|(int)SpeakerId::LowFrequency)=][[7.1(side)]][:"7.1(wide-side)":][-7.1ch(Side)-]
$#include "enumflags.hpp"
Expand Down

0 comments on commit c0485dd

Please sign in to comment.