diff options
| author | Carl Hetherington <cth@carlh.net> | 2020-04-14 20:16:44 +0200 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2020-04-14 20:16:44 +0200 |
| commit | 4d6c8aaf0167cde3bb63e9014604243bdc47b1a1 (patch) | |
| tree | 13aae09fb07326febeb401930718692b45df2cff /src | |
| parent | 314060f975dc9806f49ec8bbb1c11041a2ac111f (diff) | |
s/DCPReadError/ReadError/g
Diffstat (limited to 'src')
| -rw-r--r-- | src/asset_factory.cc | 6 | ||||
| -rw-r--r-- | src/atmos_asset.cc | 2 | ||||
| -rw-r--r-- | src/dcp.cc | 6 | ||||
| -rw-r--r-- | src/dcp.h | 2 | ||||
| -rw-r--r-- | src/dcp_time.cc | 20 | ||||
| -rw-r--r-- | src/exceptions.cc | 4 | ||||
| -rw-r--r-- | src/exceptions.h | 16 | ||||
| -rw-r--r-- | src/frame.h | 2 | ||||
| -rw-r--r-- | src/j2k.cc | 8 | ||||
| -rw-r--r-- | src/mono_picture_asset.cc | 8 | ||||
| -rw-r--r-- | src/mono_picture_frame.cc | 2 | ||||
| -rw-r--r-- | src/mxf.cc | 2 | ||||
| -rw-r--r-- | src/smpte_subtitle_asset.cc | 4 | ||||
| -rw-r--r-- | src/sound_asset.cc | 8 | ||||
| -rw-r--r-- | src/stereo_picture_asset.cc | 10 | ||||
| -rw-r--r-- | src/stereo_picture_frame.cc | 2 | ||||
| -rw-r--r-- | src/types.cc | 8 | ||||
| -rw-r--r-- | src/verify.cc | 2 |
18 files changed, 57 insertions, 55 deletions
diff --git a/src/asset_factory.cc b/src/asset_factory.cc index 22c2518e..09c315d5 100644 --- a/src/asset_factory.cc +++ b/src/asset_factory.cc @@ -53,12 +53,12 @@ dcp::asset_factory (boost::filesystem::path path, bool ignore_incorrect_picture_ ASDCP::EssenceType_t type; if (ASDCP::EssenceType (path.string().c_str(), type) != ASDCP::RESULT_OK) { - throw DCPReadError ("Could not find essence type"); + throw ReadError ("Could not find essence type"); } switch (type) { case ASDCP::ESS_UNKNOWN: case ASDCP::ESS_MPEG2_VES: - throw DCPReadError ("MPEG2 video essences are not supported"); + throw ReadError ("MPEG2 video essences are not supported"); case ASDCP::ESS_JPEG_2000: try { return shared_ptr<MonoPictureAsset> (new MonoPictureAsset (path)); @@ -80,7 +80,7 @@ dcp::asset_factory (boost::filesystem::path path, bool ignore_incorrect_picture_ case ASDCP::ESS_DCDATA_DOLBY_ATMOS: return shared_ptr<AtmosAsset> (new AtmosAsset (path)); default: - throw DCPReadError (String::compose ("Unknown MXF essence type %1 in %2", int(type), path.string())); + throw ReadError (String::compose ("Unknown MXF essence type %1 in %2", int(type), path.string())); } return shared_ptr<Asset>(); diff --git a/src/atmos_asset.cc b/src/atmos_asset.cc index 171c8e8b..3924e43a 100644 --- a/src/atmos_asset.cc +++ b/src/atmos_asset.cc @@ -66,7 +66,7 @@ AtmosAsset::AtmosAsset (boost::filesystem::path file) ASDCP::ATMOS::AtmosDescriptor desc; if (ASDCP_FAILURE (reader.FillAtmosDescriptor (desc))) { - boost::throw_exception (DCPReadError ("could not read Atmos MXF information")); + boost::throw_exception (ReadError ("could not read Atmos MXF information")); } _edit_rate = Fraction (desc.EditRate.Numerator, desc.EditRate.Denominator); @@ -117,7 +117,7 @@ DCP::read (list<dcp::VerificationNote>* notes, bool ignore_incorrect_picture_mxf } else if (boost::filesystem::exists (_directory / "ASSETMAP.xml")) { _asset_map = _directory / "ASSETMAP.xml"; } else { - boost::throw_exception (DCPReadError (String::compose ("could not find ASSETMAP nor ASSETMAP.xml in `%1'", _directory.string()))); + boost::throw_exception (ReadError (String::compose ("could not find ASSETMAP nor ASSETMAP.xml in `%1'", _directory.string()))); } cxml::Document asset_map ("AssetMap"); @@ -221,7 +221,7 @@ DCP::read (list<dcp::VerificationNote>* notes, bool ignore_incorrect_picture_mxf p->parse_file (path.string()); } catch (std::exception& e) { delete p; - throw DCPReadError(String::compose("XML error in %1", path.string()), e.what()); + throw ReadError(String::compose("XML error in %1", path.string()), e.what()); } string const root = p->get_document()->get_root_node()->get_name (); @@ -252,7 +252,7 @@ DCP::read (list<dcp::VerificationNote>* notes, bool ignore_incorrect_picture_mxf } else if (*pkl_type == "image/png") { /* It's an Interop PNG subtitle; let it go */ } else { - throw DCPReadError (String::compose("Unknown asset type %1 in PKL", *pkl_type)); + throw ReadError (String::compose("Unknown asset type %1 in PKL", *pkl_type)); } } @@ -66,7 +66,7 @@ class XMLMetadata; class CertificateChain; class DecryptedKDM; class Asset; -class DCPReadError; +class ReadError; /** @class DCP * @brief A class to create or read a DCP. diff --git a/src/dcp_time.cc b/src/dcp_time.cc index acc9723f..025a4859 100644 --- a/src/dcp_time.cc +++ b/src/dcp_time.cc @@ -108,7 +108,7 @@ Time::Time (string time, optional<int> tcr_) split (b, time, is_any_of (":")); if (b.size() < 3 || b[0].empty() || b[1].empty() || b[0].length() > 2 || b[1].length() > 2) { - boost::throw_exception (DCPReadError (String::compose ("unrecognised time specification %1", time))); + boost::throw_exception (ReadError (String::compose ("unrecognised time specification %1", time))); } if (!tcr_) { @@ -118,17 +118,17 @@ Time::Time (string time, optional<int> tcr_) vector<string> bs; split (bs, b[2], is_any_of (".")); if (bs.size() != 2) { - boost::throw_exception (DCPReadError (String::compose ("unrecognised time specification %1", time))); + boost::throw_exception (ReadError (String::compose ("unrecognised time specification %1", time))); } h = raw_convert<int> (b[0]); m = raw_convert<int> (b[1]); if (bs[0].empty() || bs[0].length() > 2) { - boost::throw_exception (DCPReadError (String::compose ("unrecognised time specification %1; %2 has bad length", time, bs[0]))); + boost::throw_exception (ReadError (String::compose ("unrecognised time specification %1; %2 has bad length", time, bs[0]))); } s = raw_convert<int> (bs[0]); if (bs[1].empty() || bs[1].length() > 3) { - boost::throw_exception (DCPReadError (String::compose ("unrecognised time specification %1; %2 has bad length", time, bs[1]))); + boost::throw_exception (ReadError (String::compose ("unrecognised time specification %1; %2 has bad length", time, bs[1]))); } e = raw_convert<int> (bs[1]); tcr = 1000; @@ -137,33 +137,33 @@ Time::Time (string time, optional<int> tcr_) h = raw_convert<int> (b[0]); m = raw_convert<int> (b[1]); if (b[2].empty() || b[2].length() > 2) { - boost::throw_exception (DCPReadError (String::compose ("unrecognised time specification %1; %2 has bad length", time, b[2]))); + boost::throw_exception (ReadError (String::compose ("unrecognised time specification %1; %2 has bad length", time, b[2]))); } s = raw_convert<int> (b[2]); if (b[3].empty() || b[3].length() > 3) { - boost::throw_exception (DCPReadError (String::compose ("unrecognised time specification %1; %2 has bad length", time, b[3]))); + boost::throw_exception (ReadError (String::compose ("unrecognised time specification %1; %2 has bad length", time, b[3]))); } e = raw_convert<int> (b[3]); tcr = 250; } else { - boost::throw_exception (DCPReadError (String::compose ("unrecognised time specification %1", time))); + boost::throw_exception (ReadError (String::compose ("unrecognised time specification %1", time))); } } else { /* SMPTE: HH:MM:SS:EE */ split (b, time, is_any_of (":")); if (b.size() != 4) { - boost::throw_exception (DCPReadError (String::compose ("unrecognised time specification %1; does not have 4 parts", time))); + boost::throw_exception (ReadError (String::compose ("unrecognised time specification %1; does not have 4 parts", time))); } h = raw_convert<int> (b[0]); m = raw_convert<int> (b[1]); if (b[2].empty() || b[2].length() > 2) { - boost::throw_exception (DCPReadError (String::compose ("unrecognised time specification %1; %2 has bad length", time, b[2]))); + boost::throw_exception (ReadError (String::compose ("unrecognised time specification %1; %2 has bad length", time, b[2]))); } s = raw_convert<int> (b[2]); if (b[3].empty() || b[3].length() > 2) { - boost::throw_exception (DCPReadError (String::compose ("unrecognised time specification %1; %2 has bad length", time, b[3]))); + boost::throw_exception (ReadError (String::compose ("unrecognised time specification %1; %2 has bad length", time, b[3]))); } e = raw_convert<int> (b[3]); tcr = tcr_.get(); diff --git a/src/exceptions.cc b/src/exceptions.cc index 7f389f31..3357ebe9 100644 --- a/src/exceptions.cc +++ b/src/exceptions.cc @@ -64,7 +64,7 @@ TimeFormatError::TimeFormatError (string bad_time) } BadContentKindError::BadContentKindError (string content_kind) - : DCPReadError (String::compose("Bad content kind '%1'", content_kind)) + : ReadError (String::compose("Bad content kind '%1'", content_kind)) { } @@ -100,7 +100,7 @@ CertificateChainError::CertificateChainError (string message) } -DCPReadError::DCPReadError (string message, string detail) +ReadError::ReadError (string message, string detail) : runtime_error(String::compose("%1 (%2)", message, detail)) , _message(message) , _detail(detail) diff --git a/src/exceptions.h b/src/exceptions.h index 770bd916..cd4f5fbb 100644 --- a/src/exceptions.h +++ b/src/exceptions.h @@ -91,20 +91,21 @@ public: {} }; -/** @class DCPReadError - * @brief A DCP read exception + +/** @class ReadError + * @brief Any error that occurs when reading data from a DCP. */ -class DCPReadError : public std::runtime_error +class ReadError : public std::runtime_error { public: - explicit DCPReadError (std::string message) + explicit ReadError (std::string message) : std::runtime_error(message) , _message(message) {} - DCPReadError (std::string message, std::string detail); + ReadError (std::string message, std::string detail); - ~DCPReadError() throw () {} + ~ReadError() throw () {} std::string message () const { return _message; @@ -119,7 +120,8 @@ private: boost::optional<std::string> _detail; }; -class BadContentKindError : public DCPReadError + +class BadContentKindError : public ReadError { public: BadContentKindError (std::string content_kind); diff --git a/src/frame.h b/src/frame.h index 7b5e6366..6bd32104 100644 --- a/src/frame.h +++ b/src/frame.h @@ -52,7 +52,7 @@ public: _buffer = new B (Kumu::Megabyte); if (ASDCP_FAILURE (reader->ReadFrame (n, *_buffer, c->context(), c->hmac()))) { - boost::throw_exception (DCPReadError ("could not read frame")); + boost::throw_exception (ReadError ("could not read frame")); } } @@ -128,7 +128,7 @@ dcp::decompress_j2k (uint8_t* data, int64_t size, int reduce) opj_codec_t* decoder = opj_create_decompress (format); if (!decoder) { - boost::throw_exception (DCPReadError ("could not create JPEG2000 decompresser")); + boost::throw_exception (ReadError ("could not create JPEG2000 decompresser")); } opj_dparameters_t parameters; opj_set_default_decoder_parameters (¶meters); @@ -153,9 +153,9 @@ dcp::decompress_j2k (uint8_t* data, int64_t size, int reduce) opj_destroy_codec (decoder); opj_stream_destroy (stream); if (format == OPJ_CODEC_J2K) { - boost::throw_exception (DCPReadError (String::compose ("could not decode JPEG2000 codestream of %1 bytes.", size))); + boost::throw_exception (ReadError (String::compose ("could not decode JPEG2000 codestream of %1 bytes.", size))); } else { - boost::throw_exception (DCPReadError (String::compose ("could not decode JP2 file of %1 bytes.", size))); + boost::throw_exception (ReadError (String::compose ("could not decode JP2 file of %1 bytes.", size))); } } @@ -191,7 +191,7 @@ dcp::decompress_j2k (uint8_t* data, int64_t size, int reduce) if (!image) { opj_destroy_decompress (decoder); opj_cio_close (cio); - boost::throw_exception (DCPReadError (String::compose ("could not decode JPEG2000 codestream of %1 bytes.", size))); + boost::throw_exception (ReadError (String::compose ("could not decode JPEG2000 codestream of %1 bytes.", size))); } opj_destroy_decompress (decoder); diff --git a/src/mono_picture_asset.cc b/src/mono_picture_asset.cc index de49b1b9..47fc8f55 100644 --- a/src/mono_picture_asset.cc +++ b/src/mono_picture_asset.cc @@ -60,14 +60,14 @@ MonoPictureAsset::MonoPictureAsset (boost::filesystem::path file) ASDCP::JP2K::PictureDescriptor desc; if (ASDCP_FAILURE (reader.FillPictureDescriptor (desc))) { - boost::throw_exception (DCPReadError ("could not read video MXF information")); + boost::throw_exception (ReadError ("could not read video MXF information")); } read_picture_descriptor (desc); ASDCP::WriterInfo info; if (ASDCP_FAILURE (reader.FillWriterInfo (info))) { - boost::throw_exception (DCPReadError ("could not read video MXF information")); + boost::throw_exception (ReadError ("could not read video MXF information")); } _id = read_writer_info (info); @@ -108,11 +108,11 @@ MonoPictureAsset::equals (shared_ptr<const Asset> other, EqualityOptions opt, No ASDCP::JP2K::PictureDescriptor desc_A; if (ASDCP_FAILURE (reader_A.FillPictureDescriptor (desc_A))) { - boost::throw_exception (DCPReadError ("could not read video MXF information")); + boost::throw_exception (ReadError ("could not read video MXF information")); } ASDCP::JP2K::PictureDescriptor desc_B; if (ASDCP_FAILURE (reader_B.FillPictureDescriptor (desc_B))) { - boost::throw_exception (DCPReadError ("could not read video MXF information")); + boost::throw_exception (ReadError ("could not read video MXF information")); } if (!descriptor_equals (desc_A, desc_B, note)) { diff --git a/src/mono_picture_frame.cc b/src/mono_picture_frame.cc index 9af34c48..d9a89fe1 100644 --- a/src/mono_picture_frame.cc +++ b/src/mono_picture_frame.cc @@ -86,7 +86,7 @@ MonoPictureFrame::MonoPictureFrame (ASDCP::JP2K::MXFReader* reader, int n, share ASDCP::Result_t const r = reader->ReadFrame (n, *_buffer, c->context(), c->hmac()); if (ASDCP_FAILURE (r)) { - boost::throw_exception (DCPReadError (String::compose ("could not read video frame %1 (%2)", n, static_cast<int>(r)))); + boost::throw_exception (ReadError (String::compose ("could not read video frame %1 (%2)", n, static_cast<int>(r)))); } } @@ -135,7 +135,7 @@ MXF::read_writer_info (ASDCP::WriterInfo const & info) _standard = SMPTE; break; default: - throw DCPReadError ("Unrecognised label set type in MXF"); + throw ReadError ("Unrecognised label set type in MXF"); } _metadata.read (info); diff --git a/src/smpte_subtitle_asset.cc b/src/smpte_subtitle_asset.cc index 7e715755..33a0c943 100644 --- a/src/smpte_subtitle_asset.cc +++ b/src/smpte_subtitle_asset.cc @@ -109,7 +109,7 @@ SMPTESubtitleAsset::SMPTESubtitleAsset (boost::filesystem::path file) _id = _xml_id = remove_urn_uuid (xml->string_child ("Id")); } catch (cxml::Error& e) { boost::throw_exception ( - DCPReadError ( + ReadError ( String::compose ( "Failed to read subtitle file %1; MXF failed with %2, XML failed with %3", file, static_cast<int> (r), e.what () @@ -272,7 +272,7 @@ SMPTESubtitleAsset::set_key (Key key) Kumu::Result_t r = reader->OpenRead (_file->string().c_str ()); if (ASDCP_FAILURE (r)) { boost::throw_exception ( - DCPReadError ( + ReadError ( String::compose ("Could not read encrypted subtitle MXF (%1)", static_cast<int> (r)) ) ); diff --git a/src/sound_asset.cc b/src/sound_asset.cc index 1f1c2f43..c28a33fe 100644 --- a/src/sound_asset.cc +++ b/src/sound_asset.cc @@ -67,7 +67,7 @@ SoundAsset::SoundAsset (boost::filesystem::path file) ASDCP::PCM::AudioDescriptor desc; if (ASDCP_FAILURE (reader.FillAudioDescriptor (desc))) { - boost::throw_exception (DCPReadError ("could not read audio MXF information")); + boost::throw_exception (ReadError ("could not read audio MXF information")); } _sampling_rate = desc.AudioSamplingRate.Numerator / desc.AudioSamplingRate.Denominator; @@ -78,7 +78,7 @@ SoundAsset::SoundAsset (boost::filesystem::path file) ASDCP::WriterInfo info; if (ASDCP_FAILURE (reader.FillWriterInfo (info))) { - boost::throw_exception (DCPReadError ("could not read audio MXF information")); + boost::throw_exception (ReadError ("could not read audio MXF information")); } _id = read_writer_info (info); @@ -112,11 +112,11 @@ SoundAsset::equals (shared_ptr<const Asset> other, EqualityOptions opt, NoteHand ASDCP::PCM::AudioDescriptor desc_A; if (ASDCP_FAILURE (reader_A.FillAudioDescriptor (desc_A))) { - boost::throw_exception (DCPReadError ("could not read audio MXF information")); + boost::throw_exception (ReadError ("could not read audio MXF information")); } ASDCP::PCM::AudioDescriptor desc_B; if (ASDCP_FAILURE (reader_B.FillAudioDescriptor (desc_B))) { - boost::throw_exception (DCPReadError ("could not read audio MXF information")); + boost::throw_exception (ReadError ("could not read audio MXF information")); } if (desc_A.EditRate != desc_B.EditRate) { diff --git a/src/stereo_picture_asset.cc b/src/stereo_picture_asset.cc index d78b4c2c..32fdc65f 100644 --- a/src/stereo_picture_asset.cc +++ b/src/stereo_picture_asset.cc @@ -57,14 +57,14 @@ StereoPictureAsset::StereoPictureAsset (boost::filesystem::path file) ASDCP::JP2K::PictureDescriptor desc; if (ASDCP_FAILURE (reader.FillPictureDescriptor (desc))) { - boost::throw_exception (DCPReadError ("could not read video MXF information")); + boost::throw_exception (ReadError ("could not read video MXF information")); } read_picture_descriptor (desc); ASDCP::WriterInfo info; if (ASDCP_FAILURE (reader.FillWriterInfo (info))) { - boost::throw_exception (DCPReadError ("could not read video MXF information")); + boost::throw_exception (ReadError ("could not read video MXF information")); } _id = read_writer_info (info); @@ -107,11 +107,11 @@ StereoPictureAsset::equals (shared_ptr<const Asset> other, EqualityOptions opt, ASDCP::JP2K::PictureDescriptor desc_A; if (ASDCP_FAILURE (reader_A.FillPictureDescriptor (desc_A))) { - boost::throw_exception (DCPReadError ("could not read video MXF information")); + boost::throw_exception (ReadError ("could not read video MXF information")); } ASDCP::JP2K::PictureDescriptor desc_B; if (ASDCP_FAILURE (reader_B.FillPictureDescriptor (desc_B))) { - boost::throw_exception (DCPReadError ("could not read video MXF information")); + boost::throw_exception (ReadError ("could not read video MXF information")); } if (!descriptor_equals (desc_A, desc_B, note)) { @@ -132,7 +132,7 @@ StereoPictureAsset::equals (shared_ptr<const Asset> other, EqualityOptions opt, try { frame_A = reader->get_frame (i); frame_B = other_reader->get_frame (i); - } catch (DCPReadError& e) { + } catch (ReadError& e) { /* If there was a problem reading the frame data we'll just assume the two frames are not equal. */ diff --git a/src/stereo_picture_frame.cc b/src/stereo_picture_frame.cc index 72f59b36..80165430 100644 --- a/src/stereo_picture_frame.cc +++ b/src/stereo_picture_frame.cc @@ -56,7 +56,7 @@ StereoPictureFrame::StereoPictureFrame (ASDCP::JP2K::MXFSReader* reader, int n, _buffer = new ASDCP::JP2K::SFrameBuffer (4 * Kumu::Megabyte); if (ASDCP_FAILURE (reader->ReadFrame (n, *_buffer, c->context(), c->hmac()))) { - boost::throw_exception (DCPReadError (String::compose ("could not read video frame %1 of %2", n))); + boost::throw_exception (ReadError (String::compose ("could not read video frame %1 of %2", n))); } } diff --git a/src/types.cc b/src/types.cc index 29e2c387..b329396d 100644 --- a/src/types.cc +++ b/src/types.cc @@ -208,7 +208,7 @@ dcp::string_to_effect (string s) return SHADOW; } - boost::throw_exception (DCPReadError ("unknown subtitle effect type")); + boost::throw_exception (ReadError ("unknown subtitle effect type")); } string @@ -237,7 +237,7 @@ dcp::string_to_halign (string s) return HALIGN_RIGHT; } - boost::throw_exception (DCPReadError ("unknown subtitle halign type")); + boost::throw_exception (ReadError ("unknown subtitle halign type")); } string @@ -266,7 +266,7 @@ dcp::string_to_valign (string s) return VALIGN_BOTTOM; } - boost::throw_exception (DCPReadError ("unknown subtitle valign type")); + boost::throw_exception (ReadError ("unknown subtitle valign type")); } string @@ -299,7 +299,7 @@ dcp::string_to_direction (string s) return DIRECTION_BTT; } - boost::throw_exception (DCPReadError ("unknown subtitle direction type")); + boost::throw_exception (ReadError ("unknown subtitle direction type")); } /** Convert a content kind to a string which can be used in a diff --git a/src/verify.cc b/src/verify.cc index 66cd25e4..79663450 100644 --- a/src/verify.cc +++ b/src/verify.cc @@ -351,7 +351,7 @@ dcp::verify ( stage ("Checking DCP", dcp->directory()); try { dcp->read (¬es); - } catch (DCPReadError& e) { + } catch (ReadError& e) { notes.push_back (VerificationNote(VerificationNote::VERIFY_ERROR, VerificationNote::GENERAL_READ, string(e.what()))); } catch (XMLError& e) { notes.push_back (VerificationNote(VerificationNote::VERIFY_ERROR, VerificationNote::GENERAL_READ, string(e.what()))); |
