+ if (_sound_reader && reason != PASS_REASON_SUBTITLE && (_decode_referenced || !_dcp_content->reference_audio())) {
+ int64_t const entry_point = (*_reel)->main_sound()->entry_point ();
+ shared_ptr<const dcp::SoundFrame> sf = _sound_reader->get_frame (entry_point + frame);
+ uint8_t const * from = sf->data ();
+
+ int const channels = _dcp_content->audio->stream()->channels ();
+ int const frames = sf->size() / (3 * channels);
+ shared_ptr<AudioBuffers> data (new AudioBuffers (channels, frames));
+ float** data_data = data->data();
+ for (int i = 0; i < frames; ++i) {
+ for (int j = 0; j < channels; ++j) {
+ data_data[j][i] = static_cast<int> ((from[0] << 8) | (from[1] << 16) | (from[2] << 24)) / static_cast<float> (INT_MAX - 256);
+ from += 3;
+ }
+ }
+
+ audio->give (_dcp_content->audio->stream(), data, ContentTime::from_frames (_offset, vfr) + _next);
+ }
+
+ if ((*_reel)->main_subtitle() && (_decode_referenced || !_dcp_content->reference_subtitle())) {
+ int64_t const entry_point = (*_reel)->main_subtitle()->entry_point ();
+ list<dcp::SubtitleString> subs = (*_reel)->main_subtitle()->asset()->subtitles_during (
+ dcp::Time (entry_point + frame, vfr, vfr),
+ dcp::Time (entry_point + frame + 1, vfr, vfr),
+ true
+ );
+
+ if (!subs.empty ()) {
+ /* XXX: assuming that all `subs' are at the same time; maybe this is ok */
+ subtitle->give_text (
+ ContentTimePeriod (
+ ContentTime::from_frames (_offset - entry_point, vfr) + ContentTime::from_seconds (subs.front().in().as_seconds ()),
+ ContentTime::from_frames (_offset - entry_point, vfr) + ContentTime::from_seconds (subs.front().out().as_seconds ())
+ ),
+ subs
+ );
+ }
+ }