summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2012-08-22 16:58:44 +0100
committerCarl Hetherington <cth@carlh.net>2012-08-22 16:58:44 +0100
commitb4a004619216df74aaac99a67ccc25d5547926ee (patch)
tree7b44b0862245d38690c6e9b78825164f065e0adb /doc
parent28ad2d566af1f59274fd1e16f6ba5da7479fc197 (diff)
Update example.
Diffstat (limited to 'doc')
-rw-r--r--doc/mainpage.txt13
1 files changed, 8 insertions, 5 deletions
diff --git a/doc/mainpage.txt b/doc/mainpage.txt
index 6f202556..b73e9164 100644
--- a/doc/mainpage.txt
+++ b/doc/mainpage.txt
@@ -114,20 +114,23 @@ libdcp will look at the XML files that make up the DCP and find its assets. You
do things like
@code
-boost::shared_ptr<libdcp::PictureAsset> p = dcp.picture_asset ();
-boost::shared_ptr<libdcp::ARGBFrame> f = p->get_frame(42)->rgba_frame ();
+boost::shared_ptr<Reel> reel = dcp.reels.front ();
+boost::shared_ptr<libdcp::PictureAsset> p = reel->main_picture ();
+boost::shared_ptr<libdcp::MonoPictureAsset> mp = boost::dynamic_pointer_cast<libdcp::MonoPictureAsset> (p);
+boost::shared_ptr<libdcp::ARGBFrame> f = mp->get_frame(42)->argb_frame ();
uint8_t* data = f->data ();
int size = f->size ();
@endcode
-This will extract the image of frame 42 from the DCP and make its ARGB data available
-for examination.
+This will extract the image of frame 42 from the first reel of the DCP and make its ARGB data available
+for examination. We have to do a <code>dynamic_pointer_cast</code> from <code>libdcp::PictureAsset</code>
+to <code>libdcp::MonoPictureAsset</code>, as the picture asset may be either 2D (monoscopic) or 3D (stereoscopic).
Audio data is accessed in chunks equal in length to the duration of a video frame. To
get the audio that accompanies frame 66, you can do
@code
-boost::shared_ptr<libdcp::SoundAsset> s = dcp.sound_asset ();
+boost::shared_ptr<libdcp::SoundAsset> s = reel->main_sound ();
cout << "Sound has " << s->channels() << " channels at " << s->sampling_rate() << "Hz\n";
boost::shared_ptr<libdcp::SoundFrame> f = s->get_frame(66);
uint8_t* data = f->data ();