[RFC,2/2] alsa: add support for Dolby TrueHD and DTS-HD HBR passthrough

Submitted by Pierre-Louis Bossart on Aug. 28, 2017, 10:49 p.m.

Details

Message ID 20170828224917.4187-3-pierre-louis.bossart@linux.intel.com
State New
Headers show
Series "HDMI IEC61937 + HBR passthrough support" ( rev: 2 1 ) in PulseAudio

Not browsing as part of any series.

Commit Message

Pierre-Louis Bossart Aug. 28, 2017, 10:49 p.m.
Add definitions and fixups for channel count

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
---
 src/pulse/format.c          | 2 ++
 src/pulse/format.h          | 8 ++++++++
 src/pulsecore/core-format.c | 6 +++++-
 3 files changed, 15 insertions(+), 1 deletion(-)

Patch hide | download patch | download mbox

diff --git a/src/pulse/format.c b/src/pulse/format.c
index 8474978..07b4420 100644
--- a/src/pulse/format.c
+++ b/src/pulse/format.c
@@ -47,6 +47,8 @@  static const char* const _encoding_str_table[]= {
     [PA_ENCODING_MPEG_IEC61937] = "mpeg-iec61937",
     [PA_ENCODING_DTS_IEC61937] = "dts-iec61937",
     [PA_ENCODING_MPEG2_AAC_IEC61937] = "mpeg2-aac-iec61937",
+    [PA_ENCODING_TRUEHD_IEC61937] = "truehd-iec61937",
+    [PA_ENCODING_DTSHD_IEC61937] = "dtshd-iec61937",
     [PA_ENCODING_ANY] = "any",
 };
 
diff --git a/src/pulse/format.h b/src/pulse/format.h
index f606b3b..6122abe 100644
--- a/src/pulse/format.h
+++ b/src/pulse/format.h
@@ -56,6 +56,12 @@  typedef enum pa_encoding {
     PA_ENCODING_MPEG2_AAC_IEC61937,
     /**< MPEG-2 AAC data encapsulated in IEC 61937 header/padding. \since 4.0 */
 
+    PA_ENCODING_TRUEHD_IEC61937,
+    /**< Dolby TrueHd data encapsulated in IEC 61937 header/padding. \since 11.0 */
+
+    PA_ENCODING_DTSHD_IEC61937,
+    /**< DTS HD-MasterAudio encapsulated in IEC 61937 header/padding. \since 11.0 */
+
     PA_ENCODING_MAX,
     /**< Valid encoding types must be less than this value */
 
@@ -71,6 +77,8 @@  typedef enum pa_encoding {
 #define PA_ENCODING_MPEG_IEC61937 PA_ENCODING_MPEG_IEC61937
 #define PA_ENCODING_DTS_IEC61937 PA_ENCODING_DTS_IEC61937
 #define PA_ENCODING_MPEG2_AAC_IEC61937 PA_ENCODING_MPEG2_AAC_IEC61937
+#define PA_ENCODING_DOLBY_TRUEHD_IEC61937 PA_ENCODING_DOLBY_TRUEHD_IEC61937
+#define PA_ENCODING_DTS_MA_IEC61937 PA_ENCODING_DTS_MA_IEC61937
 #define PA_ENCODING_MAX PA_ENCODING_MAX
 #define PA_ENCODING_INVALID PA_ENCODING_INVALID
 /** \endcond */
diff --git a/src/pulsecore/core-format.c b/src/pulsecore/core-format.c
index 9d3c8d6..c3db267 100644
--- a/src/pulsecore/core-format.c
+++ b/src/pulsecore/core-format.c
@@ -226,7 +226,11 @@  int pa_format_info_to_sample_spec_fake(const pa_format_info *f, pa_sample_spec *
      * formats, this function should return a non-zero values for these. */
 
     ss->format = PA_SAMPLE_S16LE;
-    ss->channels = 2;
+    if ((f->encoding == PA_ENCODING_TRUEHD_IEC61937) ||
+	(f->encoding == PA_ENCODING_DTSHD_IEC61937))
+	ss->channels = 8;
+    else
+	ss->channels = 2;
 
     if (map)
         pa_channel_map_init_stereo(map);

Comments

On Tue, 29 Aug 2017, at 04:19 AM, Pierre-Louis Bossart wrote:
> Add definitions and fixups for channel count
> 
> Signed-off-by: Pierre-Louis Bossart
> <pierre-louis.bossart@linux.intel.com>
> ---
>  src/pulse/format.c          | 2 ++
>  src/pulse/format.h          | 8 ++++++++
>  src/pulsecore/core-format.c | 6 +++++-
>  3 files changed, 15 insertions(+), 1 deletion(-)
> 
> diff --git a/src/pulse/format.c b/src/pulse/format.c
> index 8474978..07b4420 100644
> --- a/src/pulse/format.c
> +++ b/src/pulse/format.c
> @@ -47,6 +47,8 @@ static const char* const _encoding_str_table[]= {
>      [PA_ENCODING_MPEG_IEC61937] = "mpeg-iec61937",
>      [PA_ENCODING_DTS_IEC61937] = "dts-iec61937",
>      [PA_ENCODING_MPEG2_AAC_IEC61937] = "mpeg2-aac-iec61937",
> +    [PA_ENCODING_TRUEHD_IEC61937] = "truehd-iec61937",
> +    [PA_ENCODING_DTSHD_IEC61937] = "dtshd-iec61937",
>      [PA_ENCODING_ANY] = "any",
>  };
>  
> diff --git a/src/pulse/format.h b/src/pulse/format.h
> index f606b3b..6122abe 100644
> --- a/src/pulse/format.h
> +++ b/src/pulse/format.h
> @@ -56,6 +56,12 @@ typedef enum pa_encoding {
>      PA_ENCODING_MPEG2_AAC_IEC61937,
>      /**< MPEG-2 AAC data encapsulated in IEC 61937 header/padding.
>      \since 4.0 */
>  
> +    PA_ENCODING_TRUEHD_IEC61937,
> +    /**< Dolby TrueHd data encapsulated in IEC 61937 header/padding.
> \since 11.0 */
> +
> +    PA_ENCODING_DTSHD_IEC61937,
> +    /**< DTS HD-MasterAudio encapsulated in IEC 61937 header/padding.
> \since 11.0 */
> +
>      PA_ENCODING_MAX,
>      /**< Valid encoding types must be less than this value */
>  
> @@ -71,6 +77,8 @@ typedef enum pa_encoding {
>  #define PA_ENCODING_MPEG_IEC61937 PA_ENCODING_MPEG_IEC61937
>  #define PA_ENCODING_DTS_IEC61937 PA_ENCODING_DTS_IEC61937
>  #define PA_ENCODING_MPEG2_AAC_IEC61937 PA_ENCODING_MPEG2_AAC_IEC61937
> +#define PA_ENCODING_DOLBY_TRUEHD_IEC61937
> PA_ENCODING_DOLBY_TRUEHD_IEC61937
> +#define PA_ENCODING_DTS_MA_IEC61937 PA_ENCODING_DTS_MA_IEC61937
>  #define PA_ENCODING_MAX PA_ENCODING_MAX
>  #define PA_ENCODING_INVALID PA_ENCODING_INVALID
>  /** \endcond */
> diff --git a/src/pulsecore/core-format.c b/src/pulsecore/core-format.c
> index 9d3c8d6..c3db267 100644
> --- a/src/pulsecore/core-format.c
> +++ b/src/pulsecore/core-format.c
> @@ -226,7 +226,11 @@ int pa_format_info_to_sample_spec_fake(const
> pa_format_info *f, pa_sample_spec *
>       * formats, this function should return a non-zero values for these.
>       */
>  
>      ss->format = PA_SAMPLE_S16LE;
> -    ss->channels = 2;
> +    if ((f->encoding == PA_ENCODING_TRUEHD_IEC61937) ||
> +       (f->encoding == PA_ENCODING_DTSHD_IEC61937))
> +       ss->channels = 8;
> +    else
> +       ss->channels = 2;
>  
>      if (map)
>          pa_channel_map_init_stereo(map);
> -- 

I don't have access to any hardware that does this (my laptop no longer
has an S/PDIF out :)), but for EAC3, instead of quadrupling the channel
count, I we quadruple the sample rate. I'm guessing this won't work for
HBR because those already might have high sample rates?

Regards,
Arun
On 9/3/17 12:59 AM, Arun Raghavan wrote:
> On Tue, 29 Aug 2017, at 04:19 AM, Pierre-Louis Bossart wrote:
>> Add definitions and fixups for channel count
>>
>> Signed-off-by: Pierre-Louis Bossart
>> <pierre-louis.bossart@linux.intel.com>
>> ---
>>   src/pulse/format.c          | 2 ++
>>   src/pulse/format.h          | 8 ++++++++
>>   src/pulsecore/core-format.c | 6 +++++-
>>   3 files changed, 15 insertions(+), 1 deletion(-)
>>
>> diff --git a/src/pulse/format.c b/src/pulse/format.c
>> index 8474978..07b4420 100644
>> --- a/src/pulse/format.c
>> +++ b/src/pulse/format.c
>> @@ -47,6 +47,8 @@ static const char* const _encoding_str_table[]= {
>>       [PA_ENCODING_MPEG_IEC61937] = "mpeg-iec61937",
>>       [PA_ENCODING_DTS_IEC61937] = "dts-iec61937",
>>       [PA_ENCODING_MPEG2_AAC_IEC61937] = "mpeg2-aac-iec61937",
>> +    [PA_ENCODING_TRUEHD_IEC61937] = "truehd-iec61937",
>> +    [PA_ENCODING_DTSHD_IEC61937] = "dtshd-iec61937",
>>       [PA_ENCODING_ANY] = "any",
>>   };
>>   
>> diff --git a/src/pulse/format.h b/src/pulse/format.h
>> index f606b3b..6122abe 100644
>> --- a/src/pulse/format.h
>> +++ b/src/pulse/format.h
>> @@ -56,6 +56,12 @@ typedef enum pa_encoding {
>>       PA_ENCODING_MPEG2_AAC_IEC61937,
>>       /**< MPEG-2 AAC data encapsulated in IEC 61937 header/padding.
>>       \since 4.0 */
>>   
>> +    PA_ENCODING_TRUEHD_IEC61937,
>> +    /**< Dolby TrueHd data encapsulated in IEC 61937 header/padding.
>> \since 11.0 */
>> +
>> +    PA_ENCODING_DTSHD_IEC61937,
>> +    /**< DTS HD-MasterAudio encapsulated in IEC 61937 header/padding.
>> \since 11.0 */
>> +
>>       PA_ENCODING_MAX,
>>       /**< Valid encoding types must be less than this value */
>>   
>> @@ -71,6 +77,8 @@ typedef enum pa_encoding {
>>   #define PA_ENCODING_MPEG_IEC61937 PA_ENCODING_MPEG_IEC61937
>>   #define PA_ENCODING_DTS_IEC61937 PA_ENCODING_DTS_IEC61937
>>   #define PA_ENCODING_MPEG2_AAC_IEC61937 PA_ENCODING_MPEG2_AAC_IEC61937
>> +#define PA_ENCODING_DOLBY_TRUEHD_IEC61937
>> PA_ENCODING_DOLBY_TRUEHD_IEC61937
>> +#define PA_ENCODING_DTS_MA_IEC61937 PA_ENCODING_DTS_MA_IEC61937
>>   #define PA_ENCODING_MAX PA_ENCODING_MAX
>>   #define PA_ENCODING_INVALID PA_ENCODING_INVALID
>>   /** \endcond */
>> diff --git a/src/pulsecore/core-format.c b/src/pulsecore/core-format.c
>> index 9d3c8d6..c3db267 100644
>> --- a/src/pulsecore/core-format.c
>> +++ b/src/pulsecore/core-format.c
>> @@ -226,7 +226,11 @@ int pa_format_info_to_sample_spec_fake(const
>> pa_format_info *f, pa_sample_spec *
>>        * formats, this function should return a non-zero values for these.
>>        */
>>   
>>       ss->format = PA_SAMPLE_S16LE;
>> -    ss->channels = 2;
>> +    if ((f->encoding == PA_ENCODING_TRUEHD_IEC61937) ||
>> +       (f->encoding == PA_ENCODING_DTSHD_IEC61937))
>> +       ss->channels = 8;
>> +    else
>> +       ss->channels = 2;
>>   
>>       if (map)
>>           pa_channel_map_init_stereo(map);
>> -- 
> 
> I don't have access to any hardware that does this (my laptop no longer
> has an S/PDIF out :)), but for EAC3, instead of quadrupling the channel
> count, I we quadruple the sample rate. I'm guessing this won't work for
> HBR because those already might have high sample rates?

yep. ALSA needs 8ch at 192kHz + AES0=0x6 so enable HBR playback.