Skip to content

Commit

Permalink
AE: add raw stream info to AEAudioFormat
Browse files Browse the repository at this point in the history
  • Loading branch information
FernetMenta committed Nov 17, 2015
1 parent b881d98 commit cc90bb1
Show file tree
Hide file tree
Showing 6 changed files with 52 additions and 23 deletions.
27 changes: 17 additions & 10 deletions xbmc/cores/AudioEngine/Utils/AEAudioFormat.h
Expand Up @@ -20,9 +20,9 @@
*/

#include "AEChannelInfo.h"
#include "AEStreamInfo.h"

#define AE_IS_RAW(x) ((x) >= AE_FMT_AAC && (x) < AE_FMT_U8P)
#define AE_IS_RAW_HD(x) ((x) >= AE_FMT_EAC3 && (x) < AE_FMT_U8P)
#define AE_IS_RAW(x) ((x) >= AE_FMT_RAW && (x) < AE_FMT_U8P)
#define AE_IS_PLANAR(x) ((x) >= AE_FMT_U8P && (x) <= AE_FMT_FLOATP)

/**
Expand Down Expand Up @@ -63,6 +63,11 @@ typedef struct AEAudioFormat{
* The size of one frame in bytes
*/
unsigned int m_frameSize;

/**
* Stream info of raw passthrough
*/
CAEStreamInfo m_streamInfo;

AEAudioFormat()
{
Expand All @@ -82,18 +87,20 @@ typedef struct AEAudioFormat{
m_channelLayout == fmt.m_channelLayout &&
m_frames == fmt.m_frames &&
m_frameSamples == fmt.m_frameSamples &&
m_frameSize == fmt.m_frameSize;
m_frameSize == fmt.m_frameSize &&
m_streamInfo == fmt.m_streamInfo;
}

AEAudioFormat& operator=(const AEAudioFormat& fmt)
{
m_dataFormat = fmt.m_dataFormat;
m_sampleRate = fmt.m_sampleRate;
m_encodedRate = fmt.m_encodedRate;
m_channelLayout = fmt.m_channelLayout;
m_frames = fmt.m_frames;
m_frameSamples = fmt.m_frameSamples;
m_frameSize = fmt.m_frameSize;
m_dataFormat = fmt.m_dataFormat;
m_sampleRate = fmt.m_sampleRate;
m_encodedRate = fmt.m_encodedRate;
m_channelLayout = fmt.m_channelLayout;
m_frames = fmt.m_frames;
m_frameSamples = fmt.m_frameSamples;
m_frameSize = fmt.m_frameSize;
m_streamInfo = fmt.m_streamInfo;

return *this;
}
Expand Down
4 changes: 3 additions & 1 deletion xbmc/cores/AudioEngine/Utils/AEChannelData.h
Expand Up @@ -105,7 +105,9 @@ enum AEDataFormat
AE_FMT_DOUBLE,
AE_FMT_FLOAT,

/* Bitstream formats */
// Bitstream formats
AE_FMT_RAW,

This comment has been minimized.

Copy link
@koying

koying Nov 17, 2015

I don't see what you have in mind with AE_FMT_RAW...

The idea to have one AE format per PT type and somehow leave to the sinks how to downstream them, right?
To avoid rework in the non-droid sinks, maybe a "WantsIEC61937" flag in AEAudioFormat defaulted to true is the easiest solution?

This comment has been minimized.

Copy link
@FernetMenta

FernetMenta Nov 17, 2015

Author Owner

good question. I am still thinking about this. Currently a client calls MakeStream on AE and requests a data format and sample rate but this is not enough for raw passthrough. The information in CAEStreamInfo is required to define the raw packets that go through AE. ALSA or CoreAudio for example do not even know formats like AE_FMT_AC3 and friends. It is pretty much a Windows thing and maybe Pulse. I think it is best to drop those.

This comment has been minimized.

Copy link
@koying

koying Nov 17, 2015

Indeed, if we have the CAEStreamInfo, the AE format is redundant.

// IEC packed
AE_FMT_AAC,
AE_FMT_AC3,
AE_FMT_DTS,
Expand Down
2 changes: 1 addition & 1 deletion xbmc/cores/AudioEngine/Utils/AEChannelInfo.cpp
Expand Up @@ -205,7 +205,7 @@ bool CAEChannelInfo::operator==(const CAEChannelInfo& rhs) const
return true;
}

bool CAEChannelInfo::operator!=(const CAEChannelInfo& rhs)
bool CAEChannelInfo::operator!=(const CAEChannelInfo& rhs) const
{
return !(*this == rhs);
}
Expand Down
2 changes: 1 addition & 1 deletion xbmc/cores/AudioEngine/Utils/AEChannelInfo.h
Expand Up @@ -39,7 +39,7 @@ class CAEChannelInfo {
CAEChannelInfo& operator=(const enum AEChannel* rhs);
CAEChannelInfo& operator=(const enum AEStdChLayout rhs);
bool operator==(const CAEChannelInfo& rhs) const;
bool operator!=(const CAEChannelInfo& rhs);
bool operator!=(const CAEChannelInfo& rhs) const;
CAEChannelInfo& operator+=(const enum AEChannel& rhs);
CAEChannelInfo& operator-=(const enum AEChannel& rhs);
const enum AEChannel operator[](unsigned int i) const;
Expand Down
28 changes: 28 additions & 0 deletions xbmc/cores/AudioEngine/Utils/AEStreamInfo.cpp
Expand Up @@ -83,6 +83,34 @@ CAEStreamParser::CAEStreamParser() :
av_crc_init(m_crcTrueHD, 0, 16, 0x2D, sizeof(m_crcTrueHD));
}

CAEStreamInfo::CAEStreamInfo() :
m_type(STREAM_TYPE_NULL),
m_sampleRate(0),
m_channels(0),
m_dataIsLE(true),
m_dtsPeriod(0),
m_repeat(0),
m_packFunc(NULL)
{
}

bool CAEStreamInfo::operator==(const CAEStreamInfo& info) const
{
if (m_type != info.m_type)
return false;
if (m_sampleRate != info.m_sampleRate)
return false;
if (m_channels != info.m_channels)
return false;
if (m_channelMap != info.m_channelMap)
return false;
if (m_dataIsLE != info.m_dataIsLE)
return false;
if (m_repeat != info.m_repeat)
return false;
return true;
}

CAEStreamParser::~CAEStreamParser()
{
}
Expand Down
12 changes: 2 additions & 10 deletions xbmc/cores/AudioEngine/Utils/AEStreamInfo.h
Expand Up @@ -33,16 +33,8 @@ extern "C" {
class CAEStreamInfo
{
public:
CAEStreamInfo() :
m_type(STREAM_TYPE_NULL),
m_sampleRate(0),
m_channels(0),
m_dataIsLE(true),
m_dtsPeriod(0),
m_repeat(0),
m_packFunc(NULL)
{
}
CAEStreamInfo();
bool operator==(const CAEStreamInfo& info) const;

enum DataType
{
Expand Down

0 comments on commit cc90bb1

Please sign in to comment.