/*
-Copyright (c) 2004-2007, John Hurst
+Copyright (c) 2004-2009, John Hurst
All rights reserved.
Redistribution and use in source and binary forms, with or without
*/
#include "AS_DCP_internal.h"
+#include <iostream>
+#include <iomanip>
//------------------------------------------------------------------------------------------
VDesc.SampleRate = VDescObj->SampleRate;
VDesc.EditRate = VDescObj->SampleRate;
VDesc.FrameRate = VDescObj->SampleRate.Numerator;
- VDesc.ContainerDuration = VDescObj->ContainerDuration;
+ assert(VDescObj->ContainerDuration <= 0xFFFFFFFFL);
+ VDesc.ContainerDuration = (ui32_t) VDescObj->ContainerDuration;
VDesc.FrameLayout = VDescObj->FrameLayout;
VDesc.StoredWidth = VDescObj->StoredWidth;
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
if ( ! m_File.IsOpen() )
return RESULT_INIT;
- Result_t result = ReadEKLVPacket(FrameNum, FrameBuf, Dict::ul(MDD_MPEG2Essence), Ctx, HMAC);
+ Result_t result = ReadEKLVFrame(FrameNum, FrameBuf, Dict::ul(MDD_MPEG2Essence), Ctx, HMAC);
if ( ASDCP_FAILURE(result) )
return result;
// update the index manager
Entry.TemporalOffset = - FrameBuf.TemporalOffset();
- Entry.KeyFrameOffset = m_GOPOffset;
+ Entry.KeyFrameOffset = 0 - m_GOPOffset;
Entry.Flags = Flags;
+ /*
+ fprintf(stderr, "to: %4hd ko: %4hd c1: %4hd c2: %4hd fl: 0x%02x\n",
+ Entry.TemporalOffset, Entry.KeyFrameOffset,
+ m_GOPOffset + Entry.TemporalOffset,
+ Entry.KeyFrameOffset - Entry.TemporalOffset,
+ Entry.Flags);
+ */
m_FooterPart.PushIndexEntry(Entry);
m_FramesWritten++;
m_GOPOffset++;
const VideoDescriptor& VDesc, ui32_t HeaderSize)
{
m_Writer = new h__Writer;
+ m_Writer->m_Info = Info;
Result_t result = m_Writer->OpenWrite(filename, HeaderSize);
if ( ASDCP_SUCCESS(result) )
- {
- m_Writer->m_Info = Info;
- result = m_Writer->SetSourceStream(VDesc);
- }
+ result = m_Writer->SetSourceStream(VDesc);
if ( ASDCP_FAILURE(result) )
m_Writer.release();