diff --git a/README.md b/README.md index 693a139..2964c1b 100644 --- a/README.md +++ b/README.md @@ -14,9 +14,10 @@ The `wavinfo` package allows you to probe WAVE and [RF64/WAVE files][eburf64] an * Most of the common __RIFF INFO__[4][info-tags] metadata fields. * The __wav format__ is also parsed, so you can access the basic sample rate and channel count information. +* EBU ADM track metadata[5][adm], including track, channel and pack formats, object and content names. In progress: -* ADM metadata consilient with the output of the [__Dolby RMU__][dolby], and [EBU Tech 3285 Supplement 6][ebu3285s6]. +* [Dolby RMU][dolby] metadata and [EBU Tech 3285 Supplement 6][ebu3285s6]. * iXML `STEINBERG` sound library attributes. * __NetMix__ library attributes. * Pro Tools __embedded regions__. diff --git a/tests/test_adm.py b/tests/test_adm.py index c6d475d..d8de279 100644 --- a/tests/test_adm.py +++ b/tests/test_adm.py @@ -17,8 +17,24 @@ class TestADMWave(TestCase): self.assertEqual(len(adm.channel_uids), 14) - # def test_to_dict(self): - # info = wavinfo.WavInfoReader(self.protools_adm_wav) - # adm = info.adm - # dict = adm.to_dict() + def test_to_dict(self): + info = wavinfo.WavInfoReader(self.protools_adm_wav) + adm = info.adm + dict = adm.to_dict() + self.assertIsNotNone(dict) + + def test_track_info(self): + info = wavinfo.WavInfoReader(self.protools_adm_wav) + adm = info.adm + + t1 = adm.track_info(0) + self.assertTrue("channel_format_name" in t1.keys()) + self.assertEqual("RoomCentricLeft", t1["channel_format_name"]) + + self.assertTrue("pack_format_name" in t1.keys()) + self.assertEqual("AtmosCustomPackFormat1", t1["pack_format_name"]) + + t10 = adm.track_info(10) + self.assertTrue("content_name" in t10.keys()) + self.assertEqual("Dialog", t10["content_name"]) diff --git a/wavinfo/wave_adm_reader.py b/wavinfo/wave_adm_reader.py index fb727f7..e6918a9 100644 --- a/wavinfo/wave_adm_reader.py +++ b/wavinfo/wave_adm_reader.py @@ -3,35 +3,19 @@ ADM Reader """ from struct import unpack, unpack_from, calcsize -from dataclasses import dataclass from io import BytesIO +from collections import namedtuple +from typing import Iterable, Tuple from lxml import etree as ET -@dataclass -class ChannelEntry: - """ - A `chna` chunk table entry. - """ - - track_index: int - "Track index (indexed from 1)" - - uid: str - "audioTrackUID" - - track_ref: str - "audioTrackFormatID" - - pack_ref: str - "audioPackFormatID" - - class WavADMReader: """ Reads XML data from an EBU ADM (Audio Definiton Model) WAV File. """ + ChannelEntry = namedtuple('ChannelEntry', "track_index uid track_ref pack_ref") + def __init__(self, axml_data: bytes, chna_data: bytes): header_fmt = "