}
void
-Content::examine (shared_ptr<Job>)
+Content::examine (shared_ptr<Job> job)
{
boost::mutex::scoped_lock lm (_mutex);
boost::filesystem::path p = _path;
if (boost::filesystem::is_regular_file (p)) {
d = md5_digest (p);
} else {
- d = md5_digest_directory (p);
+ d = md5_digest_directory (p, job);
}
lm.lock ();
class Player;
class Playlist;
class AudioContent;
+class Scaler;
/** @class Film
*
#include "config.h"
#include "compose.hpp"
#include "film.h"
+#include "job.h"
#include "i18n.h"
void
MovingImageContent::examine (shared_ptr<Job> job)
{
+ job->descend (0.5);
Content::examine (job);
+ job->ascend ();
shared_ptr<const Film> film = _film.lock ();
assert (film);
+ job->descend (0.5);
shared_ptr<MovingImageExaminer> examiner (new MovingImageExaminer (film, shared_from_this(), job));
+ job->ascend ();
take_from_video_examiner (examiner);
#include "sound_processor.h"
#include "config.h"
#include "ratio.h"
+#include "job.h"
#ifdef DCPOMATIC_WINDOWS
#include "stack.hpp"
#endif
return s.str ();
}
+/** @param job Optional job for which to report progress */
string
-md5_digest_directory (boost::filesystem::path directory)
+md5_digest_directory (boost::filesystem::path directory, shared_ptr<Job> job)
{
int const buffer_size = 64 * 1024;
char buffer[buffer_size];
MD5_CTX md5_context;
MD5_Init (&md5_context);
-
+
+ int files = 0;
+ if (job) {
+ for (boost::filesystem::directory_iterator i(directory); i != boost::filesystem::directory_iterator(); ++i) {
+ ++files;
+ }
+ }
+
+ int j = 0;
for (boost::filesystem::directory_iterator i(directory); i != boost::filesystem::directory_iterator(); ++i) {
ifstream f (i->path().string().c_str(), std::ios::binary);
if (!f.good ()) {
MD5_Update (&md5_context, buffer, t);
bytes -= t;
}
+
+ if (job) {
+ job->set_progress (float (j) / files);
+ ++j;
+ }
}
unsigned char digest[MD5_DIGEST_LENGTH];
{
string ext = f.extension().string();
transform (ext.begin(), ext.end(), ext.begin(), ::tolower);
- return (ext == ".tif" || ext == ".tiff" || ext == ".jpg" || ext == ".jpeg" || ext == ".png" || ext == ".bmp");
+ return (ext == ".tif" || ext == ".tiff" || ext == ".jpg" || ext == ".jpeg" || ext == ".png" || ext == ".bmp" || ext == ".tga");
}
/** The maximum number of audio channels that we can cope with */
#define MAX_AUDIO_CHANNELS 6
-class Scaler;
-class Film;
+class Job;
extern std::string seconds_to_hms (int);
extern std::string seconds_to_approximate_hms (int);
extern void dcpomatic_setup_gettext_i18n (std::string);
extern std::vector<std::string> split_at_spaces_considering_quotes (std::string);
extern std::string md5_digest (boost::filesystem::path);
-extern std::string md5_digest_directory (boost::filesystem::path);
+extern std::string md5_digest_directory (boost::filesystem::path, boost::shared_ptr<Job>);
extern std::string md5_digest (void const *, int);
extern void ensure_ui_thread ();
extern std::string audio_channel_name (int);