{
_next_video = t;
}
+
+void
+BlackDecoder::seek_back ()
+{
+ boost::shared_ptr<const Film> f = _film.lock ();
+ if (!f) {
+ return;
+ }
+
+ _next_video -= f->video_frames_to_time (2);
+}
+
+void
+BlackDecoder::seek_forward ()
+{
+ boost::shared_ptr<const Film> f = _film.lock ();
+ if (!f) {
+ return;
+ }
+
+ _next_video += f->video_frames_to_time (1);
+}
void pass ();
void seek (Time);
+ void seek_back ();
+ void seek_forward ();
Time next () const;
/* VideoDecoder */
/** Seek this decoder to as close as possible to some time,
* expressed relative to our source's start.
* @param t Time.
+ * @param a true to try hard to be accurate, otherwise false.
*/
- virtual void seek (Time) {}
+ virtual void seek (Time) = 0;
/** Seek back one video frame */
- virtual void seek_back () {}
+ virtual void seek_back () = 0;
/** Seek forward one video frame */
- virtual void seek_forward () {}
+ virtual void seek_forward () = 0;
/** @return Approximate time of the next content that we will emit,
* expressed relative to the start of our source.
_next_video = t;
}
+void
+ImageMagickDecoder::seek_back ()
+{
+ boost::shared_ptr<const Film> f = _film.lock ();
+ if (!f) {
+ return;
+ }
+
+ _next_video -= f->video_frames_to_time (2);
+}
+
+void
+ImageMagickDecoder::seek_forward ()
+{
+ boost::shared_ptr<const Film> f = _film.lock ();
+ if (!f) {
+ return;
+ }
+
+ _next_video += f->video_frames_to_time (1);
+}
+
Time
ImageMagickDecoder::next () const
{
void pass ();
void seek (Time);
+ void seek_back ();
+ void seek_forward ();
Time next () const;
/* VideoDecoder */
shared_ptr<Piece> earliest;
for (list<shared_ptr<Piece> >::iterator i = _pieces.begin(); i != _pieces.end(); ++i) {
-// cout << "check " << (*i)->decoder->next() << " cf " << (*i)->content->end() << "\n";
+ cout << "check " << (*i)->content->file() << " start=" << (*i)->content->start() << ", next=" << (*i)->decoder->next() << ", end=" << (*i)->content->end() << "\n";
if (((*i)->decoder->next() + (*i)->content->start()) >= (*i)->content->end()) {
continue;
}
Time const t = (*i)->content->start() + (*i)->decoder->next();
if (t < earliest_t) {
+ cout << "\t candidate; " << t << " " << (t / TIME_HZ) << ".\n";
earliest_t = t;
earliest = *i;
}
}
cout << "PASS:\n";
- cout << "\tpass ";
+ cout << "\tpass " << earliest->content->file() << " ";
if (dynamic_pointer_cast<FFmpegContent> (earliest->content)) {
cout << " FFmpeg.\n";
} else if (dynamic_pointer_cast<ImageMagickContent> (earliest->content)) {
earliest->decoder->pass ();
_position = earliest->content->start() + earliest->decoder->next ();
+ cout << "\tpassed to " << _position << " " << (_position / TIME_HZ) << "\n";
return false;
}
void
Player::process_video (weak_ptr<Content> weak_content, shared_ptr<const Image> image, bool same, shared_ptr<Subtitle> sub, Time time)
{
+ cout << "[V]\n";
+
shared_ptr<Content> content = weak_content.lock ();
if (!content) {
return;
Time s = t - (*i)->content->start ();
s = max (static_cast<Time> (0), s);
s = min ((*i)->content->length(), s);
+ cout << "seek [" << (*i)->content->file() << "," << (*i)->content->start() << "," << (*i)->content->end() << "] to " << s << "\n";
(*i)->decoder->seek (s);
}
void
Player::seek_back ()
{
- /* XXX */
+
}
void
Player::seek_forward ()
{
- /* XXX */
+
}
struct ContentSorter
void setup_pieces ();
void playlist_changed ();
void content_changed (boost::weak_ptr<Content>, int);
+ void do_seek (Time, bool);
boost::shared_ptr<const Film> _film;
boost::shared_ptr<const Playlist> _playlist;
_next_audio = t;
}
+void
+SilenceDecoder::seek_back ()
+{
+ boost::shared_ptr<const Film> f = _film.lock ();
+ if (!f) {
+ return;
+ }
+
+ _next_audio -= f->video_frames_to_time (2);
+}
+
+void
+SilenceDecoder::seek_forward ()
+{
+ boost::shared_ptr<const Film> f = _film.lock ();
+ if (!f) {
+ return;
+ }
+
+ _next_audio += f->video_frames_to_time (1);
+}
+
Time
SilenceDecoder::next () const
{
void pass ();
void seek (Time);
+ void seek_back ();
+ void seek_forward ();
Time next () const;
};
~SndfileDecoder ();
void pass ();
+ void seek (Time) {}
+ void seek_back () {}
+ void seek_forward () {}
Time next () const;
int audio_channels () const;