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 <KM_platform.h>
40 using namespace ASDCP;
43 const ui32_t buf_size = 1024;
50 FB.Capacity(buf_size);
51 assert(FB.Capacity() == buf_size);
52 RNG.FillRandom(FB.Data(), FB.Capacity());
60 byte_t* buf = (byte_t*)malloc(buf_size);
62 RNG.FillRandom(buf, buf_size);
66 FB.SetData(buf, buf_size);
67 assert(FB.Data() == buf);
68 assert(FB.Capacity() == buf_size);
79 byte_t* buf = (byte_t*)malloc(buf_size);
81 RNG.FillRandom(buf, buf_size);
85 FB.SetData(buf, buf_size);
86 assert(FB.Data() == buf);
87 assert(FB.Capacity() == buf_size);
90 assert(FB.Data() == 0);
91 assert(FB.Capacity() == 0);
93 FB.Capacity(buf_size);
94 assert(FB.Capacity() == buf_size);
95 RNG.FillRandom(FB.Data(), FB.Capacity());
106 // MPEG2::Parser mPFile;
107 MPEG2::MXFReader mRFile;
108 Result_t result = mRFile.OpenRead("../test/write_test_mpeg.mxf");
109 assert(ASDCP_SUCCESS(result));
111 // MPEG2::MXFWriter mWFile;
112 JP2K::CodestreamParser jPCFile;
113 JP2K::SequenceParser jPSFile;
114 JP2K::MXFReader jRFile;
115 JP2K::MXFWriter jWFile;
117 PCM::WAVParser pPFile;
118 PCM::MXFReader pRFile;
119 PCM::MXFWriter pWFile;
125 main( int argc, char **argv )
127 ui32_t i = 0x00010000;
128 fputs("Watch your process monitor, memory usage should not change after startup.\n", stderr);
137 if ( i && ( i % 1000 ) == 0 )
147 // end asdcp-mem-test.cpp