@@ -1451,6 +1451,91 @@ func (obu ObuInfo) ReadDescriptors(r *ObuReader) (*IamfContext, error) {
14511451 return nil , nil
14521452}
14531453
1454+ func (o * ObuInfo ) Info (writer func (format string , p ... interface {})) error {
1455+ writer ("obu: Type=%s Size=%d Start=%d" , o .Type , o .Size , o .Start )
1456+ return nil
1457+ }
1458+
1459+ func (i * IamfContext ) Info (f func (level int , format string , p ... interface {})) error {
1460+ f (0 , "IAMF Context:" )
1461+ f (1 , "Codec Configs (%d):" , i .NumCodecConfigs )
1462+ for _ , cc := range i .CodecConfigs [:i .NumCodecConfigs ] {
1463+ f (2 , "CodecConfigID=%d Codec=%s SampleRate=%d NumSamples=%d RollDistance=%d" ,
1464+ cc .CodecConfigID , cc .CodecID , cc .SampleRate , cc .NumSamples , cc .AudioRollDistance )
1465+ }
1466+
1467+ f (1 , "Audio Elements (%d):" , i .NumAudioElements )
1468+ for _ , ae := range i .AudioElements [:i .NumAudioElements ] {
1469+ f (2 , "AudioElementID=%d Type=%s CodecConfigID=%d NumSubstreams=%d NumLayers=%d" ,
1470+ ae .AudioElementID , ae .Element .AudioElementType , ae .CodecConfigID , ae .NumSubstreams , ae .NumLayers )
1471+ for j , layer := range ae .Element .Layers {
1472+ f (3 , "Layer[%d]: %s" , j , layer .ChannelLayout )
1473+ if layer .AmbisonicsMode != 0 {
1474+ f (4 , "AmbisonicsMode: %s" , layer .AmbisonicsMode )
1475+ }
1476+ if layer .OutputGain .Num != 0 || layer .OutputGain .Den != 1 {
1477+ f (4 , "OutputGain: %d/%d" , layer .OutputGain .Num , layer .OutputGain .Den )
1478+ }
1479+ }
1480+ for j , ss := range ae .Substreams {
1481+ f (3 , "Substream[%d]: ID=%d" , j , ss .AudioSubstreamID )
1482+ }
1483+ if ae .Element .DemixingInfo != nil {
1484+ f (3 , "Demixing: ID=%d Rate=%d Duration=%d" ,
1485+ ae .Element .DemixingInfo .ParameterID ,
1486+ ae .Element .DemixingInfo .ParameterRate ,
1487+ ae .Element .DemixingInfo .Duration )
1488+ }
1489+ if ae .Element .ReconGainInfo != nil {
1490+ f (3 , "ReconGain: ID=%d Rate=%d Duration=%d" ,
1491+ ae .Element .ReconGainInfo .ParameterID ,
1492+ ae .Element .ReconGainInfo .ParameterRate ,
1493+ ae .Element .ReconGainInfo .Duration )
1494+ }
1495+ }
1496+
1497+ f (1 , "Mix Presentations (%d):" , i .NumMixPresentations )
1498+ for _ , mp := range i .MixPresentations [:i .NumMixPresentations ] {
1499+ f (2 , "MixPresentationID=%d Labels=%v" , mp .MixPresentationID , mp .LanguageLabel )
1500+ for lang , ann := range mp .Mix .Annotations {
1501+ f (3 , "%s: %s" , lang , ann )
1502+ }
1503+ for j , submix := range mp .Mix .Submixes {
1504+ f (3 , "Submix[%d]: NumElements=%d NumLayouts=%d" , j , submix .NumElements , submix .NumLayouts )
1505+ for k , elem := range submix .Elements {
1506+ f (4 , "Element[%d]: AudioElementID=%d HeadphonesMode=%s" ,
1507+ k , elem .AudioElementID , elem .HeadphonesRenderingMode )
1508+ f (5 , "DefaultMixGain: %d/%d" , elem .DefaultMixGain .Num , elem .DefaultMixGain .Den )
1509+ for lang , ann := range elem .Annotations {
1510+ f (6 , "%s: %s" , lang , ann )
1511+ }
1512+ }
1513+ for k , layout := range submix .Layouts {
1514+ f (4 , "Layout[%d]: Type=%s" , k , layout .LayoutType )
1515+ if layout .SoundSystem .NumChannels > 0 {
1516+ f (5 , "SoundSystem: %s" , layout .SoundSystem )
1517+ f (5 , "Channels: %d" , layout .SoundSystem .NumChannels )
1518+ }
1519+ f (5 , "IntegratedLoudness: %d/%d" , layout .IntegratedLoudness .Num , layout .IntegratedLoudness .Den )
1520+ f (5 , "DigitalPeak: %d/%d" , layout .DigitalPeak .Num , layout .DigitalPeak .Den )
1521+ if layout .TruePeak .Num != 0 {
1522+ f (5 , "TruePeak: %d/%d" , layout .TruePeak .Num , layout .TruePeak .Den )
1523+ }
1524+ }
1525+ }
1526+ }
1527+
1528+ f (1 , "Param Definitions (%d):" , i .NumParamDefinitions )
1529+ for _ , pd := range i .ParamDefinitions [:i .NumParamDefinitions ] {
1530+ f (2 , "Type=%s ParameterID=%d ParameterRate=%d Duration=%d" ,
1531+ pd .Param .Type , pd .Param .ParameterID , pd .Param .ParameterRate , pd .Param .Duration )
1532+ f (3 , "Mode=%d NumSubblocks=%d" , pd .Mode , pd .Param .NumSubblocks )
1533+ if pd .AudioElement != nil {
1534+ f (3 , "AudioElementID=%d" , pd .AudioElement .AudioElementID )
1535+ }
1536+ }
1537+
1538+ return nil
14541539}
14551540
14561541func (c channelLayout ) toChannelLayout () ChannelLayout {
0 commit comments