#include "transcoder.h"
#include "log.h"
#include "film.h"
+#include "video_decoder.h"
using std::string;
using std::vector;
+using std::pair;
using boost::shared_ptr;
ExamineContentJob::ExamineContentJob (shared_ptr<Film> f, shared_ptr<Job> req)
ExamineContentJob::run ()
{
/* Decode the content to get an accurate length */
+
+ /* We don't want to use any existing length here, as progress
+ will be messed up.
+ */
+ _film->unset_length ();
shared_ptr<Options> o (new Options ("", "", ""));
o->out_size = Size (512, 512);
o->apply_crop = false;
+ o->decode_audio = false;
descend (0.5);
- _decoder = decoder_factory (_film, o, this, true);
- _decoder->go ();
+ pair<shared_ptr<VideoDecoder>, shared_ptr<AudioDecoder> > decoders = decoder_factory (_film, o, this);
+
+ set_progress_unknown ();
+ while (!decoders.first->pass()) {
+ /* keep going */
+ }
- _film->set_length (_decoder->video_frame_index());
+ _film->set_length (decoders.first->video_frame());
- _film->log()->log (String::compose ("Video length is %1 frames", _decoder->video_frame_index()));
+ _film->log()->log (String::compose ("Video length is %1 frames", _film->length()));
ascend ();