From 7f373b689817ee70fbe5d6a14cb0512b5260f77c Mon Sep 17 00:00:00 2001 From: jhurst Date: Sun, 15 Dec 2013 23:34:13 +0000 Subject: o Added preliminary support for timed-text wrapping for AS-02. This work will require changes in SMPTE ST 429-5 and perhaps other standards work, so files created with this implementation are "speculative". Publication of the revised ST 429-5 may not occur until early 2015. o Moved LocalFilenameResolver into the AS_DCP public API so that it can be used by other modules including AS-02. o Fixed wave wrapping UL in clip-wrapped AS-02 files. Renamed some UL constants to reflect "clip" or "frame" wrapping. o Re-factored JP2K_PDesc_to_MD() and MD_to_JP2K_PDesc() to work with GenericPictureEssenceDescriptor objects. o Fixed a bug that was suppressing PictureComponentSizing, CodingStyleDefault and QuantizationDefault when writing the essence descriptor in a JP2K file (AS-DCP and AS-02). o Fixed the version byte on the following UL values: StereoscopicPictureSubDescriptor GenericPictureEssenceDescriptor_ColorPrimaries GenericPictureEssenceDescriptor_ActiveHeight GenericPictureEssenceDescriptor_ActiveWidth GenericPictureEssenceDescriptor_ActiveXOffset GenericPictureEssenceDescriptor_ActiveYOffset o Added some essence descriptor options to as-02-wrap. o Added TTML timed-text wrapping option to as-02-wrap. o Changed bit rate display in asdcp-info from mebi-bits/s to mega-bits/s. o Added "SMPTE" / "Interop" format type display to asdcp-info. o Modified asdcp-wrap to assume -L when wrapping timed-text (since there is no MXF text wrapping for Interop.) o Fixed missing-index-partion bugs for AS-02 files. --- src/TimedText_Parser.cpp | 96 ++++++++++++++++++++++++++---------------------- 1 file changed, 53 insertions(+), 43 deletions(-) (limited to 'src/TimedText_Parser.cpp') diff --git a/src/TimedText_Parser.cpp b/src/TimedText_Parser.cpp index a1f3de4..b7b58c5 100644 --- a/src/TimedText_Parser.cpp +++ b/src/TimedText_Parser.cpp @@ -1,5 +1,5 @@ /* -Copyright (c) 2007-2009, John Hurst +Copyright (c) 2007-2013, John Hurst All rights reserved. Redistribution and use in source and binary forms, with or without @@ -44,54 +44,61 @@ const char* c_dcst_namespace_name = "http://www.smpte-ra.org/schemas/428-7/2007/ //------------------------------------------------------------------------------------------ +ASDCP::TimedText::LocalFilenameResolver::LocalFilenameResolver() {} -class LocalFilenameResolver : public ASDCP::TimedText::IResourceResolver +// +Result_t +ASDCP::TimedText::LocalFilenameResolver::OpenRead(const std::string& dirname) { - std::string m_Dirname; - - LocalFilenameResolver(); - bool operator==(const LocalFilenameResolver&); - -public: - LocalFilenameResolver(const std::string& dirname) - { - if ( PathIsDirectory(dirname) ) - { - m_Dirname = dirname; - return; - } - - DefaultLogSink().Error("Path '%s' is not a directory, defaulting to '.'\n", dirname.c_str()); - m_Dirname = "."; - } + if ( PathIsDirectory(dirname) ) + { + m_Dirname = dirname; + return RESULT_OK; + } - // - Result_t ResolveRID(const byte_t* uuid, TimedText::FrameBuffer& FrameBuf) const - { - FileReader Reader; - char buf[64]; - UUID RID(uuid); - std::string filename = m_Dirname + "/" + RID.EncodeHex(buf, 64); - DefaultLogSink().Debug("retrieving resource %s from file %s\n", buf, filename.c_str()); + DefaultLogSink().Error("Path '%s' is not a directory, defaulting to '.'\n", dirname.c_str()); + m_Dirname = "."; + return RESULT_FALSE; +} - Result_t result = Reader.OpenRead(filename.c_str()); +// +Result_t +ASDCP::TimedText::LocalFilenameResolver::ResolveRID(const byte_t* uuid, TimedText::FrameBuffer& FrameBuf) const +{ + Result_t result = RESULT_NOT_FOUND; + char buf[64]; + UUID RID(uuid); + PathList_t found_list; - if ( KM_SUCCESS(result) ) - { - ui32_t read_count, read_size = Reader.Size(); + FindInPath(PathMatchRegex(RID.EncodeHex(buf, 64)), m_Dirname, found_list); - result = FrameBuf.Capacity(read_size); + if ( found_list.size() == 1 ) + { + FileReader Reader; + DefaultLogSink().Debug("retrieving resource %s from file %s\n", buf, found_list.front().c_str()); - if ( KM_SUCCESS(result) ) - result = Reader.Read(FrameBuf.Data(), read_size, &read_count); + result = Reader.OpenRead(found_list.front().c_str()); - if ( KM_SUCCESS(result) ) - FrameBuf.Size(read_count); - } + if ( KM_SUCCESS(result) ) + { + ui32_t read_count, read_size = Reader.Size(); + result = FrameBuf.Capacity(read_size); + + if ( KM_SUCCESS(result) ) + result = Reader.Read(FrameBuf.Data(), read_size, &read_count); + + if ( KM_SUCCESS(result) ) + FrameBuf.Size(read_count); + } + } + else if ( ! found_list.empty() ) + { + DefaultLogSink().Error("More than one file in %s matches %s.\n", m_Dirname.c_str(), buf); + result = RESULT_RAW_FORMAT; + } - return result; - } -}; + return result; +} //------------------------------------------------------------------------------------------ @@ -121,8 +128,11 @@ public: TimedText::IResourceResolver* GetDefaultResolver() { if ( m_DefaultResolver.empty() ) - m_DefaultResolver = new LocalFilenameResolver(PathDirname(m_Filename)); - + { + m_DefaultResolver = new LocalFilenameResolver(); + m_DefaultResolver->OpenRead(PathDirname(m_Filename)); + } + return m_DefaultResolver; } @@ -448,5 +458,5 @@ ASDCP::TimedText::DCSubtitleParser::ReadAncillaryResource(const byte_t* uuid, Fr // -// end AS_DCP_timedText.cpp +// end AS_DCP_TimedTextParser.cpp // -- cgit v1.2.3