summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormsheby <msheby@cinecert.com>2008-07-11 01:04:24 +0000
committermsheby <>2008-07-11 01:04:24 +0000
commit8fad4cc485b8791abb93ec97fe6bff7b7aa3834b (patch)
treebe23e6b1bce0e9ef0d9bab1c11da86807c9ce993 /src
parentc10e0c7be537d3bb949d2c200f508a1b6bab1e0d (diff)
Use iostreams instead of file descriptors for dumping.
Diffstat (limited to 'src')
-rwxr-xr-xsrc/AS_DCP.h12
-rwxr-xr-xsrc/AS_DCP_JP2K.cpp67
-rwxr-xr-xsrc/AS_DCP_MPEG2.cpp23
-rwxr-xr-xsrc/AS_DCP_PCM.cpp20
-rw-r--r--src/AS_DCP_TimedText.cpp25
5 files changed, 146 insertions, 1 deletions
diff --git a/src/AS_DCP.h b/src/AS_DCP.h
index bda4c13..b49746b 100755
--- a/src/AS_DCP.h
+++ b/src/AS_DCP.h
@@ -90,7 +90,7 @@ This project depends upon the following libraries:
#include <stdio.h>
#include <stdarg.h>
#include <math.h>
-#include <iostream>
+#include <iosfwd>
#include <string>
#include <list>
@@ -338,6 +338,8 @@ namespace ASDCP {
}
};
+ // Print WriterInfo to std::ostream
+ std::ostream& operator << (std::ostream& strm, const WriterInfo& winfo);
// Print WriterInfo to stream, stderr by default.
void WriterInfoDump(const WriterInfo&, FILE* = 0);
@@ -568,6 +570,8 @@ namespace ASDCP {
ui32_t ContainerDuration; //
};
+ // Print VideoDescriptor to std::ostream
+ std::ostream& operator << (std::ostream& strm, const VideoDescriptor& vdesc);
// Print VideoDescriptor to stream, stderr by default.
void VideoDescriptorDump(const VideoDescriptor&, FILE* = 0);
@@ -760,6 +764,8 @@ namespace ASDCP {
ui32_t ContainerDuration; // number of frames
};
+ // Print AudioDescriptor to std::ostream
+ std::ostream& operator << (std::ostream& strm, const AudioDescriptor& adesc);
// Print debugging information to stream (stderr default)
void AudioDescriptorDump(const AudioDescriptor&, FILE* = 0);
@@ -962,6 +968,8 @@ namespace ASDCP {
QuantizationDefault_t QuantizationDefault;
};
+ // Print debugging information to std::ostream
+ std::ostream& operator << (std::ostream& strm, const PictureDescriptor& pdesc);
// Print debugging information to stream (stderr default)
void PictureDescriptorDump(const PictureDescriptor&, FILE* = 0);
@@ -1247,6 +1255,8 @@ namespace ASDCP {
TimedTextDescriptor() : ContainerDuration(0), EncodingName("UTF-8") {} // D-Cinema format is always UTF-8
};
+ // Print debugging information to std::ostream
+ std::ostream& operator << (std::ostream& strm, const TimedTextDescriptor& tinfo);
// Print debugging information to stream (stderr default)
void DescriptorDump(const TimedTextDescriptor&, FILE* = 0);
diff --git a/src/AS_DCP_JP2K.cpp b/src/AS_DCP_JP2K.cpp
index 39dceed..d6754f5 100755
--- a/src/AS_DCP_JP2K.cpp
+++ b/src/AS_DCP_JP2K.cpp
@@ -30,6 +30,8 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "AS_DCP_internal.h"
+#include <iostream>
+#include <iomanip>
using namespace ASDCP::JP2K;
using Kumu::GenRandomValue;
@@ -43,6 +45,70 @@ static std::string PICT_DEF_LABEL = "Picture Track";
int s_exp_lookup[16] = { 0, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024,2048, 4096, 8192, 16384, 32768 };
//
+std::ostream&
+ASDCP::JP2K::operator << (std::ostream& strm, const PictureDescriptor& PDesc)
+{
+ strm << " AspectRatio: " << PDesc.AspectRatio.Numerator << "/" << PDesc.AspectRatio.Denominator << std::endl;
+ strm << " EditRate: " << PDesc.EditRate.Numerator << "/" << PDesc.EditRate.Denominator << std::endl;
+ strm << " StoredWidth: " << (unsigned) PDesc.StoredWidth << std::endl;
+ strm << " StoredHeight: " << (unsigned) PDesc.StoredHeight << std::endl;
+ strm << " Rsize: " << (unsigned) PDesc.Rsize << std::endl;
+ strm << " Xsize: " << (unsigned) PDesc.Xsize << std::endl;
+ strm << " Ysize: " << (unsigned) PDesc.Ysize << std::endl;
+ strm << " XOsize: " << (unsigned) PDesc.XOsize << std::endl;
+ strm << " YOsize: " << (unsigned) PDesc.YOsize << std::endl;
+ strm << " XTsize: " << (unsigned) PDesc.XTsize << std::endl;
+ strm << " YTsize: " << (unsigned) PDesc.YTsize << std::endl;
+ strm << " XTOsize: " << (unsigned) PDesc.XTOsize << std::endl;
+ strm << " YTOsize: " << (unsigned) PDesc.YTOsize << std::endl;
+ strm << " ContainerDuration: " << (unsigned) PDesc.ContainerDuration << std::endl;
+
+ strm << "-- JPEG 2000 Metadata --" << std::endl;
+ strm << " ImageComponents:" << std::endl;
+ strm << " bits h-sep v-sep" << std::endl;
+
+ ui32_t i;
+ for ( i = 0; i < PDesc.Csize; i++ )
+ {
+ strm << " " << std::setw(4) << PDesc.ImageComponents[i].Ssize + 1 /* See ISO 15444-1, Table A11, for the origin of '+1' */
+ << " " << std::setw(5) << PDesc.ImageComponents[i].XRsize
+ << " " << std::setw(5) << PDesc.ImageComponents[i].YRsize
+ << std::endl;
+ }
+
+ strm << " Scod: " << (short) PDesc.CodingStyleDefault.Scod << std::endl;
+ strm << " ProgressionOrder: " << (short) PDesc.CodingStyleDefault.SGcod.ProgressionOrder << std::endl;
+ strm << " NumberOfLayers: " << (short) KM_i16_BE(Kumu::cp2i<ui16_t>(PDesc.CodingStyleDefault.SGcod.NumberOfLayers)) << std::endl;
+ strm << " MultiCompTransform: " << (short) PDesc.CodingStyleDefault.SGcod.MultiCompTransform << std::endl;
+ strm << "DecompositionLevels: " << (short) PDesc.CodingStyleDefault.SPcod.DecompositionLevels << std::endl;
+ strm << " CodeblockWidth: " << (short) PDesc.CodingStyleDefault.SPcod.CodeblockWidth << std::endl;
+ strm << " CodeblockHeight: " << (short) PDesc.CodingStyleDefault.SPcod.CodeblockHeight << std::endl;
+ strm << " CodeblockStyle: " << (short) PDesc.CodingStyleDefault.SPcod.CodeblockStyle << std::endl;
+ strm << " Transformation: " << (short) PDesc.CodingStyleDefault.SPcod.Transformation << std::endl;
+
+
+ ui32_t precinct_set_size = 0;
+
+ for ( i = 0; PDesc.CodingStyleDefault.SPcod.PrecinctSize[i] != 0 && i < MaxPrecincts; i++ )
+ precinct_set_size++;
+
+ strm << " Precincts: " << (short) precinct_set_size << std::endl;
+ strm << "precinct dimensions:" << std::endl;
+
+ for ( i = 0; i < precinct_set_size; i++ )
+ strm << " " << i + 1 << ": " << s_exp_lookup[PDesc.CodingStyleDefault.SPcod.PrecinctSize[i]&0x0f] << " x "
+ << s_exp_lookup[(PDesc.CodingStyleDefault.SPcod.PrecinctSize[i]>>4)&0x0f] << std::endl;
+
+ strm << " Sqcd: " << (short) PDesc.QuantizationDefault.Sqcd << std::endl;
+
+ char tmp_buf[MaxDefaults*2];
+ strm << " SPqcd: " << Kumu::bin2hex(PDesc.QuantizationDefault.SPqcd, PDesc.QuantizationDefault.SPqcdLength, tmp_buf, MaxDefaults*2)
+ << std::endl;
+
+ return strm;
+}
+
+//
void
ASDCP::JP2K::PictureDescriptorDump(const PictureDescriptor& PDesc, FILE* stream)
{
@@ -130,6 +196,7 @@ ASDCP::JP2K::PictureDescriptorDump(const PictureDescriptor& PDesc, FILE* stream)
);
}
+
//------------------------------------------------------------------------------------------
//
// hidden, internal implementation of JPEG 2000 reader
diff --git a/src/AS_DCP_MPEG2.cpp b/src/AS_DCP_MPEG2.cpp
index bd2709e..9a81b9f 100755
--- a/src/AS_DCP_MPEG2.cpp
+++ b/src/AS_DCP_MPEG2.cpp
@@ -30,6 +30,8 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "AS_DCP_internal.h"
+#include <iostream>
+#include <iomanip>
//------------------------------------------------------------------------------------------
@@ -93,6 +95,27 @@ MPEG2_VDesc_to_MD(MPEG2::VideoDescriptor& VDesc, MXF::MPEG2VideoDescriptor* VDes
return RESULT_OK;
}
+//
+std::ostream&
+ASDCP::MPEG2::operator << (std::ostream& strm, const VideoDescriptor& VDesc)
+{
+ strm << " SampleRate: " << VDesc.SampleRate.Numerator << "/" << VDesc.SampleRate.Denominator << std::endl;
+ strm << " FrameLayout: " << (unsigned) VDesc.FrameLayout << std::endl;
+ strm << " StoredWidth: " << (unsigned) VDesc.StoredWidth << std::endl;
+ strm << " StoredHeight: " << (unsigned) VDesc.StoredHeight << std::endl;
+ strm << " AspectRatio: " << VDesc.AspectRatio.Numerator << "/" << VDesc.AspectRatio.Denominator << std::endl;
+ strm << " ComponentDepth: " << (unsigned) VDesc.ComponentDepth << std::endl;
+ strm << " HorizontalSubsmpl: " << (unsigned) VDesc.HorizontalSubsampling << std::endl;
+ strm << " VerticalSubsmpl: " << (unsigned) VDesc.VerticalSubsampling << std::endl;
+ strm << " ColorSiting: " << (unsigned) VDesc.ColorSiting << std::endl;
+ strm << " CodedContentType: " << (unsigned) VDesc.CodedContentType << std::endl;
+ strm << " LowDelay: " << (unsigned) VDesc.LowDelay << std::endl;
+ strm << " BitRate: " << (unsigned) VDesc.BitRate << std::endl;
+ strm << " ProfileAndLevel: " << (unsigned) VDesc.ProfileAndLevel << std::endl;
+ strm << " ContainerDuration: " << (unsigned) VDesc.ContainerDuration << std::endl;
+
+ return strm;
+}
//
void
diff --git a/src/AS_DCP_PCM.cpp b/src/AS_DCP_PCM.cpp
index 5e03d1d..a50f24b 100755
--- a/src/AS_DCP_PCM.cpp
+++ b/src/AS_DCP_PCM.cpp
@@ -31,6 +31,8 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "AS_DCP_internal.h"
#include <map>
+#include <iostream>
+#include <iomanip>
//------------------------------------------------------------------------------------------
@@ -72,6 +74,24 @@ MD_to_PCM_ADesc(MXF::WaveAudioDescriptor* ADescObj, PCM::AudioDescriptor& ADesc)
return RESULT_OK;
}
+//
+std::ostream&
+ASDCP::PCM::operator << (std::ostream& strm, const AudioDescriptor& ADesc)
+{
+ strm << " SampleRate: " << ADesc.SampleRate.Numerator << "/" << ADesc.SampleRate.Denominator << std::endl;
+ strm << " AudioSamplingRate: " << ADesc.AudioSamplingRate.Numerator << "/" << ADesc.AudioSamplingRate.Denominator << std::endl;
+ strm << " Locked: " << (unsigned) ADesc.Locked << std::endl;
+ strm << " ChannelCount: " << (unsigned) ADesc.ChannelCount << std::endl;
+ strm << " QuantizationBits: " << (unsigned) ADesc.QuantizationBits << std::endl;
+ strm << " BlockAlign: " << (unsigned) ADesc.BlockAlign << std::endl;
+ strm << " AvgBps: " << (unsigned) ADesc.AvgBps << std::endl;
+ strm << " LinkedTrackID: " << (unsigned) ADesc.LinkedTrackID << std::endl;
+ strm << " ContainerDuration: " << (unsigned) ADesc.ContainerDuration << std::endl;
+
+ return strm;
+}
+
+//
void
ASDCP::PCM::AudioDescriptorDump(const AudioDescriptor& ADesc, FILE* stream)
{
diff --git a/src/AS_DCP_TimedText.cpp b/src/AS_DCP_TimedText.cpp
index 73341a5..81ebf8f 100644
--- a/src/AS_DCP_TimedText.cpp
+++ b/src/AS_DCP_TimedText.cpp
@@ -32,6 +32,8 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "AS_DCP_internal.h"
#include "KM_xml.h"
+#include <iostream>
+#include <iomanip>
using Kumu::GenRandomValue;
@@ -54,6 +56,29 @@ MIME2str(TimedText::MIMEType_t m)
}
//
+std::ostream&
+ASDCP::TimedText::operator << (std::ostream& strm, const TimedTextDescriptor& TDesc)
+{
+ UUID TmpID(TDesc.AssetID);
+ char buf[64];
+
+ strm << " EditRate: " << (unsigned) TDesc.EditRate.Numerator << "/" << (unsigned) TDesc.EditRate.Denominator << std::endl;
+ strm << "ContainerDuration: " << (unsigned) TDesc.ContainerDuration << std::endl;
+ strm << " AssetID: " << TmpID.EncodeHex(buf, 64) << std::endl;
+ strm << " NamespaceName: " << TDesc.NamespaceName << std::endl;
+ strm << " ResourceCount: " << (unsigned long) TDesc.ResourceList.size() << std::endl;
+
+ TimedText::ResourceList_t::const_iterator ri;
+ for ( ri = TDesc.ResourceList.begin() ; ri != TDesc.ResourceList.end(); ri++ )
+ {
+ TmpID.Set((*ri).ResourceID);
+ strm << " " << TmpID.EncodeHex(buf, 64) << ": " << MIME2str((*ri).Type) << std::endl;
+ }
+
+ return strm;
+}
+
+//
void
ASDCP::TimedText::DescriptorDump(ASDCP::TimedText::TimedTextDescriptor const& TDesc, FILE* stream)
{