Update example.
authorCarl Hetherington <cth@carlh.net>
Wed, 22 Aug 2012 15:58:44 +0000 (16:58 +0100)
committerCarl Hetherington <cth@carlh.net>
Wed, 22 Aug 2012 15:58:44 +0000 (16:58 +0100)
doc/mainpage.txt

index 6f202556fb5d126321ce5d7c6088d370483a47ce..b73e9164808f7f2e07a4b593f90bf33e33f72a7c 100644 (file)
@@ -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 ();