- foreach(QString tagline, list) {
- if (!tagline.startsWith("-H264")) continue;
- QString tag = tagline.section(':', 1);
- if (tag.startsWith("ImageWidth") || tag.startsWith("ImageHeight")) continue;
- meta.insert(tag.section('=', 0, 0), tag.section('=', 1));
+ QString url = clip->fileURL().path();
+ //Check for Canon THM file
+ url = url.section('.', 0, -2) + ".THM";
+ if (QFile::exists(url)) {
+ // Read the exif metadata embeded in the THM file
+ QProcess p;
+ QStringList args;
+ args << "-g" << "-args" << url;
+ p.start("exiftool", args);
+ p.waitForFinished();
+ QString res = p.readAllStandardOutput();
+ QStringList list = res.split("\n");
+ foreach(QString tagline, list) {
+ if (tagline.startsWith("-File") || tagline.startsWith("-ExifTool")) continue;
+ QString tag = tagline.section(':', 1).simplified();
+ if (tag.startsWith("ImageWidth") || tag.startsWith("ImageHeight")) continue;
+ if (!tag.section('=', 0, 0).isEmpty() && !tag.section('=', 1).simplified().isEmpty())
+ meta.insert(tag.section('=', 0, 0), tag.section('=', 1).simplified());
+ }
+ } else {
+ QString codecid = props.value("videocodecid").simplified();
+ if (codecid == "h264") {
+ QProcess p;
+ QStringList args;
+ args << "-g" << "-args" << clip->fileURL().encodedPathAndQuery();
+ p.start("exiftool", args);
+ p.waitForFinished();
+ QString res = p.readAllStandardOutput();
+ QStringList list = res.split("\n");
+ foreach(QString tagline, list) {
+ if (!tagline.startsWith("-H264")) continue;
+ QString tag = tagline.section(':', 1);
+ if (tag.startsWith("ImageWidth") || tag.startsWith("ImageHeight")) continue;
+ meta.insert(tag.section('=', 0, 0), tag.section('=', 1));
+ }
+ }