2 Copyright (c) 2004, John Hurst
5 Redistribution and use in source and binary forms, with or without
6 modification, are permitted provided that the following conditions
8 1. Redistributions of source code must retain the above copyright
9 notice, this list of conditions and the following disclaimer.
10 2. Redistributions in binary form must reproduce the above copyright
11 notice, this list of conditions and the following disclaimer in the
12 documentation and/or other materials provided with the distribution.
13 3. The name of the author may not be used to endorse or promote products
14 derived from this software without specific prior written permission.
16 THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17 IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18 OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19 IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20 INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21 NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25 THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 /*! \file asdcp-mem-test.cpp
29 \brief AS-DCP frame buffer allocation test
33 #include <AS_DCP_internal.h>
34 #include <FortunaRNG.h>
39 using namespace ASDCP;
41 const ui32_t buf_size = 1024;
48 FB.Capacity(buf_size);
49 assert(FB.Capacity() == buf_size);
50 RNG.FillRandom(FB.Data(), FB.Capacity());
58 byte_t* buf = (byte_t*)malloc(buf_size);
60 RNG.FillRandom(buf, buf_size);
64 FB.SetData(buf, buf_size);
65 assert(FB.Data() == buf);
66 assert(FB.Capacity() == buf_size);
77 byte_t* buf = (byte_t*)malloc(buf_size);
79 RNG.FillRandom(buf, buf_size);
83 FB.SetData(buf, buf_size);
84 assert(FB.Data() == buf);
85 assert(FB.Capacity() == buf_size);
88 assert(FB.Data() == 0);
89 assert(FB.Capacity() == 0);
91 FB.Capacity(buf_size);
92 assert(FB.Capacity() == buf_size);
93 RNG.FillRandom(FB.Data(), FB.Capacity());
104 mem_ptr<DataChunk> Chunk(new DataChunk(1024));
109 // MPEG2::Parser mPFile;
110 MPEG2::MXFReader mRFile;
111 Result_t result = mRFile.OpenRead("../test/write_test_mpeg.mxf");
112 assert(ASDCP_SUCCESS(result));
114 // MPEG2::MXFWriter mWFile;
115 JP2K::CodestreamParser jPCFile;
116 JP2K::SequenceParser jPSFile;
117 JP2K::MXFReader jRFile;
118 JP2K::MXFWriter jWFile;
120 PCM::WAVParser pPFile;
121 PCM::MXFReader pRFile;
122 PCM::MXFWriter pWFile;
129 main( int argc, char **argv )
131 ui32_t i = 0x00010000;
132 fputs("Watch your process monitor, memory usage should not change after startup.\n", stderr);
141 if ( i && ( i % 1000 ) == 0 )
151 // end asdcp-mem-test.cpp