summaryrefslogtreecommitdiff
path: root/src/sound_asset.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/sound_asset.cc')
-rw-r--r--src/sound_asset.cc19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/sound_asset.cc b/src/sound_asset.cc
index d8ea94d1..a8b63727 100644
--- a/src/sound_asset.cc
+++ b/src/sound_asset.cc
@@ -245,3 +245,22 @@ SoundAsset::equals (shared_ptr<const Asset> other, EqualityOptions opt) const
return notes;
}
+
+
+int
+SoundAsset::sampling_rate () const
+{
+ ASDCP::PCM::MXFReader reader;
+ if (ASDCP_FAILURE (reader.OpenRead (mxf_path().string().c_str()))) {
+ throw FileError ("could not open MXF file for reading", mxf_path().string());
+ }
+
+
+ ASDCP::PCM::AudioDescriptor desc;
+ if (ASDCP_FAILURE (reader.FillAudioDescriptor (desc))) {
+ throw DCPReadError ("could not read audio MXF information");
+ }
+
+ return desc.AudioSamplingRate.Numerator / desc.AudioSamplingRate.Denominator;
+}
+