1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
/*
Copyright (C) 2016 Carl Hetherington <cth@carlh.net>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include "imp.h"
#include "imp_cpl.h"
#include "sequence.h"
#include "segment.h"
#include "test.h"
#include "resource.h"
#include "mono_picture_asset.h"
#include "mono_picture_frame.h"
#include <boost/test/unit_test.hpp>
using boost::shared_ptr;
/** Simple test of reading an IMF package */
BOOST_AUTO_TEST_CASE (imf_test1)
{
dcp::IMP imp (private_test / "data" / "BelleSebastian2_TLR-2-2398_HD-239_DE-XX_CH_51_HD_PATH_20151229_DGL_SMPTE_IMPAPP2_OV");
imp.read ();
BOOST_REQUIRE_EQUAL (imp.cpls().size(), 1);
shared_ptr<dcp::IMPCPL> cpl = imp.cpls().front ();
BOOST_REQUIRE_EQUAL (cpl->segments().size(), 1);
shared_ptr<dcp::Segment> segment = cpl->segments().front ();
BOOST_REQUIRE (segment->main_image ());
shared_ptr<dcp::Sequence> main_image = segment->main_image ();
BOOST_REQUIRE_EQUAL (main_image->resources().size(), 1);
shared_ptr<dcp::Resource> resource = main_image->resources().front ();
BOOST_REQUIRE (resource->asset<dcp::MonoPictureAsset>());
shared_ptr<dcp::MonoPictureAsset> picture = resource->asset<dcp::MonoPictureAsset> ();
shared_ptr<const dcp::MonoPictureFrame> frame = picture->get_frame (100);
FILE* out = fopen ("/home/carl/piss.j2c", "wb");
fwrite (frame->j2k_data(), 1, frame->j2k_size(), out);
fclose (out);
}
|