diff options
| author | jhurst <jhurst@cinecert.com> | 2006-01-06 07:19:32 +0000 |
|---|---|---|
| committer | jhurst <> | 2006-01-06 07:19:32 +0000 |
| commit | 6e23666cb6184999efc74577cfb1b524181ba5df (patch) | |
| tree | 0400f487b37da3e263f93af8afcfacb318d24087 /src/AS_DCP_JP2K.cpp | |
| parent | a526fabf937848823b02d5486a6ec38f8442bb1c (diff) | |
bugfix in indexing
Diffstat (limited to 'src/AS_DCP_JP2K.cpp')
| -rwxr-xr-x | src/AS_DCP_JP2K.cpp | 88 |
1 files changed, 27 insertions, 61 deletions
diff --git a/src/AS_DCP_JP2K.cpp b/src/AS_DCP_JP2K.cpp index 4262edf..033e4ef 100755 --- a/src/AS_DCP_JP2K.cpp +++ b/src/AS_DCP_JP2K.cpp @@ -50,10 +50,10 @@ ASDCP::JP2K_PDesc_to_MD(JP2K::PictureDescriptor& PDesc, MDObject& PDescObj) PDescObj.SetValue("Codec", DataChunk(klv_key_size, JP2KEssenceCompressionLabel)); - sprintf(text_buf, "%ld/%ld", PDesc.EditRate.Numerator, PDesc.EditRate.Denominator); + snprintf(text_buf, 32, "%ld/%ld", PDesc.EditRate.Numerator, PDesc.EditRate.Denominator); PDescObj.SetString("SampleRate", text_buf); - sprintf(text_buf, "%ld/%ld", PDesc.AspectRatio.Numerator, PDesc.AspectRatio.Denominator); + snprintf(text_buf, 32, "%ld/%ld", PDesc.AspectRatio.Numerator, PDesc.AspectRatio.Denominator); PDescObj.SetString("AspectRatio", text_buf); PDescObj.SetUint("FrameLayout", 0); @@ -100,31 +100,15 @@ ASDCP::Result_t ASDCP::MD_to_JP2K_PDesc(MXF::RGBAEssenceDescriptor* PDescObj, JP2K::PictureDescriptor& PDesc) { ASDCP_TEST_NULL(PDescObj); - PDesc.CodingStyleLength = PDesc.QuantDefaultLength = 0; + memset(&PDesc, 0, sizeof(PDesc)); -#if 0 - PDesc.StoredWidth = PDescObj.GetUint("StoredWidth"); - PDesc.StoredHeight = PDescObj.GetUint("StoredHeight"); - PDesc.ContainerDuration = PDescObj.GetUint("ContainerDuration"); - - // - MDObject* Ptr = PDescObj["SampleRate"]; // should be EditRate - - if ( Ptr ) - { - PDesc.EditRate.Numerator = Ptr->GetInt("Numerator"); - PDesc.EditRate.Denominator = Ptr->GetInt("Denominator"); - } - - // - Ptr = PDescObj["AspectRatio"]; - - if ( Ptr ) - { - PDesc.AspectRatio.Numerator = Ptr->GetInt("Numerator"); - PDesc.AspectRatio.Denominator = Ptr->GetInt("Denominator"); - } + PDesc.EditRate = PDescObj->SampleRate; + PDesc.ContainerDuration = PDescObj->ContainerDuration; + PDesc.StoredWidth = PDescObj->StoredWidth; + PDesc.StoredHeight = PDescObj->StoredHeight; + PDesc.AspectRatio = PDescObj->AspectRatio; +#if 0 MDObject* PSubDescObj = GetMDObjectByType(PDescObj, "JPEG2000PictureSubDescriptor"); if ( PSubDescObj == 0 ) @@ -133,23 +117,17 @@ ASDCP::MD_to_JP2K_PDesc(MXF::RGBAEssenceDescriptor* PDescObj, JP2K::PictureDescr return RESULT_FALSE; } - PDesc.Rsize = PSubDescObj->GetUint("Rsize"); - PDesc.Xsize = PSubDescObj->GetUint("Xsize"); - PDesc.Ysize = PSubDescObj->GetUint("Ysize"); - PDesc.XOsize = PSubDescObj->GetUint("XOsize"); - PDesc.YOsize = PSubDescObj->GetUint("YOsize"); - PDesc.XTsize = PSubDescObj->GetUint("XTsize"); - PDesc.YTsize = PSubDescObj->GetUint("YTsize"); - PDesc.XTOsize = PSubDescObj->GetUint("XTOsize"); - PDesc.YTOsize = PSubDescObj->GetUint("YTOsize"); - PDesc.Csize = PSubDescObj->GetUint("Csize"); - - // - Ptr = (*PSubDescObj)["PictureComponentSizing"]; - - if ( Ptr ) - { - DataChunk DC3 = Ptr->GetData(); + PDesc.Rsize = PSubDescObj->Rsize; + PDesc.Xsize = PSubDescObj->Xsize; + PDesc.Ysize = PSubDescObj->Ysize; + PDesc.XOsize = PSubDescObj->XOsize; + PDesc.YOsize = PSubDescObj->YOsize; + PDesc.XTsize = PSubDescObj->XTsize; + PDesc.YTsize = PSubDescObj->YTsize; + PDesc.XTOsize = PSubDescObj->XTOsize; + PDesc.YTOsize = PSubDescObj->YTOsize; + PDesc.Csize = PSubDescObj->Csize; + // PictureComponentSizing if ( DC3.Size == 17 ) // ( 2* sizeof(ui32_t) ) + 3 components * 3 byte each { @@ -159,28 +137,16 @@ ASDCP::MD_to_JP2K_PDesc(MXF::RGBAEssenceDescriptor* PDescObj, JP2K::PictureDescr { DefaultLogSink().Error("Unexpected PictureComponentSizing size: %lu, should be 17\n", DC3.Size); } - } +#endif - // - Ptr = (*PSubDescObj)["CodingStyleDefault"]; + // CodingStyleDefault + // PDesc.CodingStyleLength = DC1.Size; + // memcpy(PDesc.CodingStyle, DC1.Data, DC1.Size); - if ( Ptr ) - { - DataChunk DC1 = Ptr->GetData(); - PDesc.CodingStyleLength = DC1.Size; - memcpy(PDesc.CodingStyle, DC1.Data, DC1.Size); - } + // QuantizationDefault + // PDesc.QuantDefaultLength = DC2.Size; + // memcpy(PDesc.QuantDefault, DC2.Data, DC2.Size); - // - Ptr = (*PSubDescObj)["QuantizationDefault"]; - - if ( Ptr ) - { - DataChunk DC2 = Ptr->GetData(); - PDesc.QuantDefaultLength = DC2.Size; - memcpy(PDesc.QuantDefault, DC2.Data, DC2.Size); - } -#endif return RESULT_OK; } |
