From b4a004619216df74aaac99a67ccc25d5547926ee Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Wed, 22 Aug 2012 16:58:44 +0100 Subject: Update example. --- doc/mainpage.txt | 13 ++++++++----- 1 file 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 p = dcp.picture_asset (); -boost::shared_ptr f = p->get_frame(42)->rgba_frame (); +boost::shared_ptr reel = dcp.reels.front (); +boost::shared_ptr p = reel->main_picture (); +boost::shared_ptr mp = boost::dynamic_pointer_cast (p); +boost::shared_ptr 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 dynamic_pointer_cast from libdcp::PictureAsset +to libdcp::MonoPictureAsset, 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 s = dcp.sound_asset (); +boost::shared_ptr s = reel->main_sound (); cout << "Sound has " << s->channels() << " channels at " << s->sampling_rate() << "Hz\n"; boost::shared_ptr f = s->get_frame(66); uint8_t* data = f->data (); -- cgit v1.2.3