整理代码
This commit is contained in:
commit
c7b4e178ec
364 changed files with 59691 additions and 0 deletions
79
video/core/ChannelLayout.cpp
Normal file
79
video/core/ChannelLayout.cpp
Normal file
|
|
@ -0,0 +1,79 @@
|
|||
/*
|
||||
*******************************************************************************
|
||||
* INCLUDE
|
||||
*******************************************************************************
|
||||
*/
|
||||
#include "ChannelLayout.h"
|
||||
#include <Poco/Format.h>
|
||||
|
||||
namespace Video
|
||||
{
|
||||
namespace Core
|
||||
{
|
||||
/*
|
||||
*******************************************************************************
|
||||
* TYPEDEFS
|
||||
*******************************************************************************
|
||||
*/
|
||||
struct ChannelLayoutInfo
|
||||
{
|
||||
std::string name;
|
||||
int channels;
|
||||
};
|
||||
|
||||
/*
|
||||
*******************************************************************************
|
||||
* LOCAL VARIABLES
|
||||
*******************************************************************************
|
||||
*/
|
||||
static const ChannelLayoutInfo channelLayoutInfo[(int)ChannelLayout::NB] = {
|
||||
{
|
||||
"L",
|
||||
1,
|
||||
},
|
||||
{
|
||||
"R",
|
||||
1,
|
||||
},
|
||||
{
|
||||
"MONO",
|
||||
1,
|
||||
},
|
||||
{
|
||||
"STEREO",
|
||||
2,
|
||||
},
|
||||
};
|
||||
|
||||
/*
|
||||
*******************************************************************************
|
||||
* LOCAL FUNCTIONS
|
||||
*******************************************************************************
|
||||
*/
|
||||
static inline bool isChannelLayoutValid(ChannelLayout layout)
|
||||
{
|
||||
return ((int)layout >= 0) && (layout < ChannelLayout::NB);
|
||||
}
|
||||
|
||||
/*
|
||||
*******************************************************************************
|
||||
* FUNCTIONS
|
||||
*******************************************************************************
|
||||
*/
|
||||
int channelLayoutChannels(ChannelLayout layout)
|
||||
{
|
||||
if (isChannelLayoutValid(layout))
|
||||
return channelLayoutInfo[(int)layout].channels;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
const std::string channelLayoutToString(const ChannelLayout layout)
|
||||
{
|
||||
if (isChannelLayoutValid(layout))
|
||||
return channelLayoutInfo[(int)layout].name;
|
||||
|
||||
return Poco::format("UNKNOWN(%u)", (uint32_t)layout);
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue