Decoder (boost::shared_ptr<const Film>);
virtual ~Decoder () {}
- /** Seek so that the next get_*() will yield the next thing
+ /** Seek so that the next peek() will yield the next thing
* (video/sound frame, subtitle etc.) at or after the requested
* time. Pass accurate = true to try harder to get close to
* the request.
virtual void seek (ContentTime time, bool accurate);
boost::shared_ptr<Decoded> peek ();
+
+ /* Consume the last peek()ed thing so that it won't be returned
+ * from the next peek().
+ */
void consume ();
protected:
/** Perform one decode pass of the content, which may or may not
* result in a complete quantum (Decoded object) of decoded stuff
- * being made ready.
+ * being added to _pending.
* @return true if the decoder is done (i.e. no more data will be
* produced by any future calls to pass() without a seek() first).
*/
);
}
+ cout << "S&F " << t << "\n";
+
/* Ridiculous empirical hack */
s--;
if (s < 0) {
s = 0;
}
- av_seek_frame (_format_context, _video_stream, s, AVSEEK_FLAG_BACKWARD);
+ av_seek_frame (_format_context, _video_stream, s, 0);
avcodec_flush_buffers (video_codec_context());
if (audio_codec_context ()) {
break;
}
+
dec->set_dcp_times (_film->video_frame_rate(), _film->audio_frame_rate(), (*i)->frc, offset);
DCPTime const t = dec->dcp_time - offset;
+ cout << "Peeked " << (*i)->content->paths()[0] << " for " << t << " cf " << ((*i)->content->full_length() - (*i)->content->trim_end ()) << "\n";
if (t >= ((*i)->content->full_length() - (*i)->content->trim_end ())) {
/* In the end-trimmed part; decoder has nothing else to give us */
dec.reset ();
shared_ptr<DecodedImageSubtitle> dis = dynamic_pointer_cast<DecodedImageSubtitle> (earliest_decoded);
shared_ptr<DecodedTextSubtitle> dts = dynamic_pointer_cast<DecodedTextSubtitle> (earliest_decoded);
-#if 0
if (dv) {
cout << "Video @ " << dv->dcp_time << " " << (double(dv->dcp_time) / TIME_HZ) << ".\n";
} else if (da) {
} else if (dts) {
cout << "Text sub.\n";
}
-#endif
/* Will be set to false if we shouldn't consume the peeked DecodedThing */
bool consume = true;
ContentTime ct = (s + (*i)->content->trim_start()) * (*i)->frc.speed_up;
/* And seek the decoder */
+ cout << "seek " << (*i)->content->paths()[0] << " to " << ct << "\n";
(*i)->decoder->seek (ct, accurate);
}