}
float
-DCPTranscoder::current_encoding_rate () const
+DCPTranscoder::current_rate () const
{
return _encoder->current_encoding_rate ();
}
-int
-DCPTranscoder::video_frames_enqueued () const
+Frame
+DCPTranscoder::frames_done () const
{
return _encoder->video_frames_enqueued ();
}
void go ();
- float current_encoding_rate () const;
- int video_frames_enqueued () const;
+ float current_rate () const;
+ Frame frames_done () const;
/** @return true if we are in the process of calling Encoder::process_end */
bool finishing () const {
frame->width = image->size().width;
frame->height = image->size().height;
frame->format = _pixel_format;
- {
- boost::mutex::scoped_lock lm (_mutex);
- _last_frame = time.frames_round(_film->video_frame_rate());
- frame->pts = _last_frame / (_film->video_frame_rate() * av_q2d (_video_stream->time_base));
- }
+ frame->pts = time.seconds() / av_q2d (_video_stream->time_base);
AVPacket packet;
av_init_packet (&packet);
_history.event ();
+ {
+ boost::mutex::scoped_lock lm (_mutex);
+ _last_time = time;
+ }
+
shared_ptr<Job> job = _job.lock ();
if (job) {
job->set_progress (float(time.get()) / _film->length().get());
}
float
-FFmpegTranscoder::current_encoding_rate () const
+FFmpegTranscoder::current_rate () const
{
return _history.rate ();
}
-int
-FFmpegTranscoder::video_frames_enqueued () const
+Frame
+FFmpegTranscoder::frames_done () const
{
boost::mutex::scoped_lock lm (_mutex);
- return _last_frame;
+ return _last_time.frames_round (_film->video_frame_rate ());
}
void go ();
- float current_encoding_rate () const;
- int video_frames_enqueued () const;
+ float current_rate () const;
+ Frame frames_done () const;
bool finishing () const {
return false;
}
AVPixelFormat _pixel_format;
mutable boost::mutex _mutex;
- Frame _last_frame;
+ DCPTime _last_time;
EventHistory _history;
float fps = 0;
if (finish.tv_sec != start.tv_sec) {
- fps = _transcoder->video_frames_enqueued() / (finish.tv_sec - start.tv_sec);
+ fps = _transcoder->frames_done() / (finish.tv_sec - start.tv_sec);
}
LOG_GENERAL (N_("Transcode job completed successfully: %1 fps"), fps);
strncpy (buffer, Job::status().c_str(), 256);
} else {
snprintf (
- buffer, sizeof(buffer), "%s; %d/%" PRId64 " frames",
+ buffer, sizeof(buffer), "%s; %" PRId64 "/%" PRId64 " frames",
Job::status().c_str(),
- _transcoder->video_frames_enqueued(),
+ _transcoder->frames_done(),
_film->length().frames_round (_film->video_frame_rate ())
);
- float const fps = _transcoder->current_encoding_rate ();
+ float const fps = _transcoder->current_rate ();
if (fps) {
char fps_buffer[64];
/// TRANSLATORS: fps here is an abbreviation for frames per second
/* We're encoding so guess based on the current encoding rate */
- float fps = t->current_encoding_rate ();
+ float fps = t->current_rate ();
if (fps == 0) {
return 0;
}
/* Compute approximate proposed length here, as it's only here that we need it */
- return (_film->length().frames_round (_film->video_frame_rate ()) - t->video_frames_enqueued()) / fps;
+ return (_film->length().frames_round (_film->video_frame_rate ()) - t->frames_done()) / fps;
}
virtual void go () = 0;
- virtual float current_encoding_rate () const = 0;
- virtual int video_frames_enqueued () const = 0;
+ /** @return the current frame rate over the last short while */
+ virtual float current_rate () const = 0;
+ /** @return the number of frames that are done */
+ virtual Frame frames_done () const = 0;
virtual bool finishing () const = 0;
protected: