-#!/bin/sh
+#!/bin/bash
#
# Runs our test suite, which builds a DCP.
# if anything is different.
#
-LD_LIBRARY_PATH=build/src:build/asdcplib/src build/test/tests
+if [ "$1" == "--debug" ]; then
+ shift
+ LD_LIBRARY_PATH=build/src:build/asdcplib/src gdb --args build/test/tests
+else
+ LD_LIBRARY_PATH=build/src:build/asdcplib/src build/test/tests
+fi
diff -ur test/ref/DCP build/test/foo
if [ "$?" != "0" ]; then
echo "FAIL: files differ"
} catch (XMLError& e) {
/* Maybe it's not a fraction */
}
- float f = float_node ("ScreenAspectRatio");
- screen_aspect_ratio = Fraction (f * 1000, 1000);
+ try {
+ float f = float_node ("ScreenAspectRatio");
+ screen_aspect_ratio = Fraction (f * 1000, 1000);
+ } catch (bad_cast& e) {
+
+ }
ignore_node ("Hash");
return shared_ptr<const PictureAsset> ();
}
+
+shared_ptr<const SoundAsset>
+DCP::sound_asset () const
+{
+ for (list<shared_ptr<Asset> >::const_iterator i = _assets.begin(); i != _assets.end(); ++i) {
+ shared_ptr<SoundAsset> s = dynamic_pointer_cast<SoundAsset> (*i);
+ if (s) {
+ return s;
+ }
+ }
+
+ return shared_ptr<const SoundAsset> ();
+}
class Asset;
class PictureAsset;
+class SoundAsset;
/** @class DCP dcp.h libdcp/dcp.h
* @brief A class to create or read a DCP.
}
boost::shared_ptr<const PictureAsset> picture_asset () const;
+ boost::shared_ptr<const SoundAsset> sound_asset () const;
std::list<std::string> equals (DCP const & other, EqualityOptions options) 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;
+}
+
void write_to_cpl (std::ostream& s) const;
std::list<std::string> equals (boost::shared_ptr<const Asset> other, EqualityOptions opt) const;
+
+ int channels () const {
+ return _channels;
+ }
+
+ int sampling_rate () const;
private:
void construct (sigc::slot<std::string, Channel> get_path);
test_mode.h
version.h
picture_asset.h
+ sound_asset.h
asset.h
picture_frame.h
"""