{
strm << " AspectRatio: " << PDesc.AspectRatio.Numerator << "/" << PDesc.AspectRatio.Denominator << std::endl;
strm << " EditRate: " << PDesc.EditRate.Numerator << "/" << PDesc.EditRate.Denominator << std::endl;
+ strm << " SampleRate: " << PDesc.SampleRate.Numerator << "/" << PDesc.SampleRate.Denominator << std::endl;
strm << " StoredWidth: " << (unsigned) PDesc.StoredWidth << std::endl;
strm << " StoredHeight: " << (unsigned) PDesc.StoredHeight << std::endl;
strm << " Rsize: " << (unsigned) PDesc.Rsize << std::endl;
fprintf(stream, "\
AspectRatio: %d/%d\n\
EditRate: %d/%d\n\
+ SampleRate: %d/%d\n\
StoredWidth: %u\n\
StoredHeight: %u\n\
Rsize: %u\n\
ContainerDuration: %u\n",
PDesc.AspectRatio.Numerator, PDesc.AspectRatio.Denominator,
PDesc.EditRate.Numerator, PDesc.EditRate.Denominator,
+ PDesc.SampleRate.Numerator, PDesc.SampleRate.Denominator,
PDesc.StoredWidth,
PDesc.StoredHeight,
PDesc.Rsize,
RGBAEssenceDescriptor* m_EssenceDescriptor;
JPEG2000PictureSubDescriptor* m_EssenceSubDescriptor;
ASDCP::Rational m_EditRate;
+ ASDCP::Rational m_SampleRate;
EssenceType_t m_Format;
ASDCP_NO_COPY_CONSTRUCT(lh__Reader);
MXF::RGBAEssenceDescriptor* PDescObj = (MXF::RGBAEssenceDescriptor*)m_EssenceDescriptor;
PDesc.EditRate = m_EditRate;
+ PDesc.SampleRate = m_SampleRate;
assert(PDescObj->ContainerDuration <= 0xFFFFFFFFL);
PDesc.ContainerDuration = (ui32_t) PDescObj->ContainerDuration;
PDesc.StoredWidth = PDescObj->StoredWidth;
}
m_EditRate = ((Track*)ObjectList.front())->EditRate;
+ m_SampleRate = m_EssenceDescriptor->SampleRate;
if ( type == ASDCP::ESS_JPEG_2000 )
{
- if ( m_EditRate != m_EssenceDescriptor->SampleRate )
+ if ( m_EditRate != m_SampleRate )
{
DefaultLogSink().Error("EditRate and SampleRate do not match (%.03f, %.03f).\n",
- m_EditRate.Quotient(), m_EssenceDescriptor->SampleRate.Quotient());
+ m_EditRate.Quotient(), m_SampleRate.Quotient());
- if ( m_EditRate == EditRate_24 && m_EssenceDescriptor->SampleRate == EditRate_48 )
+ if ( m_EditRate == EditRate_24 && m_SampleRate == EditRate_48 )
{
- DefaultLogSink().Error("File may contain JPEG Interop stereoscopic images.\n");
+ DefaultLogSink().Debug("File may contain JPEG Interop stereoscopic images.\n");
return RESULT_SFORMAT;
}
}
else if ( type == ASDCP::ESS_JPEG_2000_S )
{
- if ( ! ( m_EditRate == EditRate_24 && m_EssenceDescriptor->SampleRate == EditRate_48 ) )
+ if ( ! ( m_EditRate == EditRate_24 && m_SampleRate == EditRate_48 ) )
{
DefaultLogSink().Error("EditRate and SampleRate not correct for 24/48 stereoscopic essence.\n");
return RESULT_FORMAT;
while ( p[i] == 0 ) i++;
if ( i > 1 && p[i] == 1 && (p[i+1] == ASDCP::MPEG2::SEQ_START || p[i+1] == ASDCP::MPEG2::PIC_START) )
- type = ESS_MPEG2_VES;
-
+ {
+ type = ESS_MPEG2_VES;
+ }
else if ( ASDCP_SUCCESS(WavHeader.ReadFromBuffer(p, read_count, &data_offset)) )
- type = ESS_PCM_24b_48k;
-
+ {
+ switch ( WavHeader.samplespersec )
+ {
+ case 48000: type = ESS_PCM_24b_48k; break;
+ case 96000: type = ESS_PCM_24b_96k; break;
+ default:
+ return RESULT_FORMAT;
+ }
+ }
else if ( ASDCP_SUCCESS(AIFFHeader.ReadFromBuffer(p, read_count, &data_offset)) )
- type = ESS_PCM_24b_48k;
-
+ {
+ type = ESS_PCM_24b_48k;
+ }
else if ( Kumu::StringIsXML((const char*)p, FB.Size()) )
- type = ESS_TIMED_TEXT;
+ {
+ type = ESS_TIMED_TEXT;
+ }
}
}
else if ( Kumu::PathIsDirectory(filename) )
fprintf(stream, "ContainerDuration: %u\n", TDesc.ContainerDuration);
fprintf(stream, " AssetID: %s\n", TmpID.EncodeHex(buf, 64));
fprintf(stream, " NamespaceName: %s\n", TDesc.NamespaceName.c_str());
- fprintf(stream, " ResourceCount: %lu\n", TDesc.ResourceList.size());
+ fprintf(stream, " ResourceCount: %du\n", TDesc.ResourceList.size());
TimedText::ResourceList_t::const_iterator ri;
for ( ri = TDesc.ResourceList.begin() ; ri != TDesc.ResourceList.end(); ri++ )
TimedTextResourceDescriptor TmpResource;
memcpy(TmpResource.ResourceID, DescObject->AncillaryResourceID.Value(), UUIDlen);
- if ( DescObject->MIMEMediaType.find("font/") != std::string::npos )
+ if ( DescObject->MIMEMediaType.find("application/x-font-opentype") != std::string::npos
+ || DescObject->MIMEMediaType.find("application/x-opentype") != std::string::npos
+ || DescObject->MIMEMediaType.find("font/opentype") != std::string::npos )
TmpResource.Type = MT_OPENTYPE;
else if ( DescObject->MIMEMediaType.find("image/png") != std::string::npos )
// read the essence packet
if( ASDCP_SUCCESS(result) )
- result = ReadEKLVPacket(0, 1, FrameBuf, Dict::ul(MDD_TimedTextDescriptor), Ctx, HMAC);
+ result = ReadEKLVPacket(0, 1, FrameBuf, Dict::ul(MDD_TimedTextEssence), Ctx, HMAC);
}
}
}
}
else
{
- fprintf(stream, " IndexEntryArray: %lu entries\n", IndexEntryArray.size());
+ fprintf(stream, " IndexEntryArray: %du entries\n", IndexEntryArray.size());
}
}
if ( r > pstr )
{
std::string tmp_str;
- assert(r - pstr < 100);
tmp_str.assign(pstr, (r - pstr));
components.push_back(tmp_str);
}
//
#ifndef KM_SMALL_FILES_OK
template <bool sizecheck> void compile_time_size_checker();
- template <> inline void compile_time_size_checker<false>() {}
+ template <> inline void compile_time_size_checker<false>() {}
//
// READ THIS if your compiler is complaining about a previously declared implementation of
// compile_time_size_checker(). For example, GCC 4.0.1 looks like this:
}
else
{
- if ( test_s < 2 || test_s > 3 )
+ if ( test_s < 2 )
{
// OP-Atom states that there will be either two or three partitions:
// one closed header and one closed footer with an optional body
- DefaultLogSink().Warn("RIP count is not 2 or 3: %u\n", test_s);
+ // SMPTE 429-5 files may have many partitions, see SMPTE 410M
+ DefaultLogSink().Warn("RIP count is less than 2: %u\n", test_s);
}
m_HasRIP = true;
if ( InstanceList.empty() )
{
- DefaultLogSink(). Error("XML document contains no Subtitle elements!\n");
+ DefaultLogSink(). Error("XML document contains no Subtitle elements.\n");
return RESULT_FORMAT;
}
// assumes 24/1 or 48/1 as constrained above
- S12MTimecode beginTC(InstanceList.front()->GetAttrWithName("TimeIn"), m_TDesc.EditRate.Numerator);
+
+ S12MTimecode beginTC(m_Root.GetChildWithName("StartTime")->GetBody(), m_TDesc.EditRate.Numerator);
for ( ei = InstanceList.begin(); ei != InstanceList.end(); ei++ )
{
end_count = tmpTC.GetFrames();
}
- assert( end_count > beginTC.GetFrames() );
+ if ( end_count <= beginTC.GetFrames() )
+ {
+ DefaultLogSink(). Error("Timed Text file has zero-length timeline.\n");
+ return RESULT_FORMAT;
+ }
+
m_TDesc.ContainerDuration = end_count - beginTC.GetFrames();
return RESULT_OK;
{
ui16_t format = KM_i16_LE(*(ui16_t*)p); p += 2;
- if ( format != 1 )
+ if ( format != WAVE_FORMAT_PCM && format != WAVE_FORMAT_EXTENSIBLE )
{
- DefaultLogSink().Error("Expecting uncompressed essence, got format type %hu\n", format);
+ DefaultLogSink().Error("Expecting uncompressed PCM data, got format type %hd\n", format);
return RESULT_RAW_FORMAT;
}
avgbps = KM_i32_LE(*(ui32_t*)p); p += 4;
blockalign = KM_i16_LE(*(ui16_t*)p); p += 2;
bitspersample = KM_i16_LE(*(ui16_t*)p); p += 2;
- p += chunk_size - 16;
+ p += chunk_size - 16; // 16 is the number of bytes read in this block
}
else
{
const fourcc FCC_fmt_("fmt ");
const fourcc FCC_data("data");
+ const ui16_t WAVE_FORMAT_PCM = 1;
+ const ui16_t WAVE_FORMAT_EXTENSIBLE = 65534;
+
//
class SimpleWaveHeader
{
/*
-Copyright (c) 2004-2007, John Hurst
+Copyright (c) 2004-2008, John Hurst
All rights reserved.
Redistribution and use in source and binary forms, with or without
assert(PathSetExtension("foo.bar", "") == "foo");
assert(PathSetExtension(Path_3, "xml") == "baz.xml");
+ string Path_7 = "//tmp///////fooo";
+
+ PathCompList_t PathList_7;
+ PathToComponents(Path_7, PathList_7);
+ for ( PathCompList_t::const_iterator i = PathList_7.begin(); i != PathList_7.end(); i++ )
+ fprintf(stderr, "xx: \"%s\"\n", i->c_str());
+ assert(PathsAreEquivalent(PathMakeLocal(PathMakeCanonical(Path_7), "/tmp"), "fooo"));
+
PathList_t InList, OutList;
InList.push_back("tmp");
InList.push_back("Darwin");