From 1ae4158e789f1baa998126c4780666046933bf23 Mon Sep 17 00:00:00 2001 From: =?utf8?q?R=C3=A9mi=20Achard?= Date: Thu, 23 Jan 2020 00:12:49 +0000 Subject: [PATCH] Improve error diagnostic in timed text parser --- src/TimedText_Parser.cpp | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/src/TimedText_Parser.cpp b/src/TimedText_Parser.cpp index 6b6d006..ff53e67 100644 --- a/src/TimedText_Parser.cpp +++ b/src/TimedText_Parser.cpp @@ -380,17 +380,23 @@ ASDCP::TimedText::DCSubtitleParser::h__SubtitleParser::ReadAncillaryResource(con Result_t result = Resolver.ResolveRID(uuid, FrameBuf); + std::string resourceType; + if ( (*rmi).second == MT_PNG ) + resourceType = "image/png"; + else if ( (*rmi).second == MT_OPENTYPE ) + resourceType = "application/x-font-opentype"; + else + resourceType = "application/octet-stream"; + if ( KM_SUCCESS(result) ) { - if ( (*rmi).second == MT_PNG ) - FrameBuf.MIMEType("image/png"); - - else if ( (*rmi).second == MT_OPENTYPE ) - FrameBuf.MIMEType("application/x-font-opentype"); - - else - FrameBuf.MIMEType("application/octet-stream"); + FrameBuf.MIMEType(resourceType); + } + else + { + DefaultLogSink().Error("Resource not found: %s (%s)\n", TmpID.EncodeHex(buf, 64), resourceType.c_str()); } + return result; } -- 2.30.2