| 389 | }; |
| 390 | static const size_t ChannelLayout_2018_Aac_Size=sizeof(ChannelLayout_2018_Aac)/sizeof(decltype(*ChannelLayout_2018_Aac)); |
| 391 | Ztring ChannelLayout_2018_Rename(const Ztring& Channels, const Ztring& Format) |
| 392 | { |
| 393 | ZtringList List; |
| 394 | List.Separator_Set(0, __T(" ")); |
| 395 | List.Write(Channels); |
| 396 | size_t LfePos[3]; |
| 397 | memset(LfePos, -1, sizeof(LfePos)); |
| 398 | bool IsAac=(Format==__T("AAC") || Format==__T("USAC") || Format==__T("MPEG-H 3D Audio") || Format==__T("DTS-UHD")); |
| 399 | for (size_t i=0; i<List.size(); i++) |
| 400 | { |
| 401 | Ztring& ChannelName=List[i]; |
| 402 | string ChannelNameS=ChannelName.To_UTF8(); |
| 403 | for (size_t j=0; j<ChannelLayout_2018_Size; j++) |
| 404 | if (!strcmp(ChannelNameS.c_str(), ChannelLayout_2018[j][0])) |
| 405 | ChannelName.From_UTF8(ChannelLayout_2018[j][1]); |
| 406 | if (IsAac) |
| 407 | { |
| 408 | for (size_t j=0; j< ChannelLayout_2018_Aac_Size; j++) |
| 409 | if (!strcmp(ChannelNameS.c_str(), ChannelLayout_2018_Aac[j][0])) |
| 410 | ChannelName.From_UTF8(ChannelLayout_2018_Aac[j][1]); |
| 411 | if (ChannelNameS.size()>=3 && ChannelNameS[0]=='L' && ChannelNameS[1]=='F' && ChannelNameS[2]=='E') |
| 412 | { |
| 413 | if (LfePos[0] && ChannelNameS.size()==3) |
| 414 | LfePos[0]=i; |
| 415 | if (LfePos[1] && ChannelNameS.size()==4 && ChannelNameS[3]==__T('2')) |
| 416 | LfePos[1]=i; |
| 417 | if (LfePos[2] && ChannelNameS.size()==4 && ChannelNameS[3]==__T('3')) |
| 418 | LfePos[2]=i; |
| 419 | } |
| 420 | } |
| 421 | } |
| 422 | if (LfePos[0]==(size_t)-1 && LfePos[1]!=(size_t)-1 && LfePos[2]!=(size_t)-1) |
| 423 | { |
| 424 | List[LfePos[1]].resize(3); // LFE2 --> LFE |
| 425 | List[LfePos[2]][3]--; // LFE3 --> LFE2 |
| 426 | } |
| 427 | Ztring ToReturn=List.Read(); |
| 428 | return ToReturn; |
| 429 | } |
| 430 | Ztring ChannelLayout_2018_Rename(stream_t StreamKind, size_t Parameter, ZtringList& Info, const Ztring& StreamFormat, bool &ShouldReturn) |
| 431 | { |
| 432 | bool ShouldReturn_Save=ShouldReturn; |
no test coverage detected