/*
-Copyright (c) 2003-2007, John Hurst
+Copyright (c) 2003-2008, John Hurst
All rights reserved.
Redistribution and use in source and binary forms, with or without
o Read one or more ciphertext PCM audio streams from a ciphertext ASDCP file
o Read header metadata from an ASDCP file
-This project depends upon the following library:
+This project depends upon the following libraries:
- OpenSSL http://www.openssl.org/
+ - Expat http://expat.sourceforge.net/ (optional)
*/
#include <stdio.h>
#include <stdarg.h>
#include <math.h>
-#include <iostream>
+#include <iosfwd>
#include <string>
#include <list>
// All library components are defined in the namespace ASDCP
//
namespace ASDCP {
- // The version number consists of three segments: major, API minor, and
- // implementation minor. Whenever a change is made to AS_DCP.h, the API minor
- // version will increment. Changes made to the internal implementation will
- // result in the incrementing of the implementation minor version.
-
- // For example, if asdcplib version 1.0.0 were modified to accomodate changes
- // in file format, and if no changes were made to AS_DCP.h, the new version would be
- // 1.0.1. If changes were also required in AS_DCP.h, the new version would be 1.1.1.
- const ui32_t VERSION_MAJOR = 1;
- const ui32_t VERSION_APIMINOR = 2;
- const ui32_t VERSION_IMPMINOR = 17;
+ //
+ // The version number declaration and explanation have moved to ../configure.ac
const char* Version();
// UUIDs are passed around as strings of UUIDlen bytes
}
};
+ // 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);
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);
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);
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);
Result_t FillPictureDescriptor(PictureDescriptor&) const;
};
+ // Parses the data in the frame buffer to fill in the picture descriptor. Copies
+ // the offset of the image data into start_of_data. Returns error if the parser fails.
+ Result_t ParseMetadataIntoDesc(const FrameBuffer&, PictureDescriptor&, byte_t* start_of_data = 0);
+
// An object which reads a sequence of files containing JPEG 2000 pictures.
class SequenceParser
{
SP_LEFT,
SP_RIGHT
};
+
+ struct SFrameBuffer
+ {
+ JP2K::FrameBuffer Left;
+ JP2K::FrameBuffer Right;
+ SFrameBuffer(ui32_t size) {
+ Left.Capacity(size);
+ Right.Capacity(size);
+ }
+ };
class MXFSWriter
- {
+ {
class h__SWriter;
mem_ptr<h__SWriter> m_Writer;
ASDCP_NO_COPY_CONSTRUCT(MXFSWriter);
Result_t OpenWrite(const char* filename, const WriterInfo&,
const PictureDescriptor&, ui32_t HeaderSize = 16384);
+ // Writes a pair of frames of essence to the MXF file. If the optional AESEncContext
+ // argument is present, the essence is encrypted prior to writing.
+ // Fails if the file is not open, is finalized, or an operating system
+ // error occurs.
+ Result_t WriteFrame(const SFrameBuffer&, AESEncContext* = 0, HMACContext* = 0);
+
// Writes a frame of essence to the MXF file. If the optional AESEncContext
// argument is present, the essence is encrypted prior to writing.
// Fails if the file is not open, is finalized, or an operating system
// Returns RESULT_INIT if the file is not open.
Result_t FillWriterInfo(WriterInfo&) const;
+ // Reads a pair of frames of essence from the MXF file. If the optional AESEncContext
+ // argument is present, the essence is decrypted after reading. If the MXF
+ // file is encrypted and the AESDecContext argument is NULL, the frame buffer
+ // will contain the ciphertext frame data. If the HMACContext argument is
+ // not NULL, the HMAC will be calculated (if the file supports it).
+ // Returns RESULT_INIT if the file is not open, failure if the frame number is
+ // out of range, or if optional decrypt or HAMC operations fail.
+ Result_t ReadFrame(ui32_t frame_number, SFrameBuffer&, AESDecContext* = 0, HMACContext* = 0) const;
+
// Reads a frame of essence from the MXF file. If the optional AESEncContext
// argument is present, the essence is decrypted after reading. If the MXF
// file is encrypted and the AESDecContext argument is NULL, the frame buffer
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);