Fix crashes on x-thread signal emission.
[dcpomatic.git] / src / lib / ffmpeg_content.cc
index 9e9473935d82810f88ca4a8bf445230504780629..a52b53b04099251b8f84a7d1e9446f869c7ffc31 100644 (file)
@@ -1,5 +1,5 @@
 /*
-    Copyright (C) 2013-2014 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2013-2015 Carl Hetherington <cth@carlh.net>
 
     This program is free software; you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
 
 */
 
-extern "C" {
-#include <libavformat/avformat.h>
-}
-#include <libcxml/cxml.h>
-#include <dcp/raw_convert.h>
 #include "ffmpeg_content.h"
 #include "ffmpeg_examiner.h"
 #include "ffmpeg_subtitle_stream.h"
@@ -35,6 +30,11 @@ extern "C" {
 #include "exceptions.h"
 #include "frame_rate_change.h"
 #include "safe_stringstream.h"
+#include "raw_convert.h"
+#include <libcxml/cxml.h>
+extern "C" {
+#include <libavformat/avformat.h>
+}
 
 #include "i18n.h"
 
@@ -47,7 +47,6 @@ using std::cout;
 using std::pair;
 using boost::shared_ptr;
 using boost::dynamic_pointer_cast;
-using dcp::raw_convert;
 
 int const FFmpegContentProperty::SUBTITLE_STREAMS = 100;
 int const FFmpegContentProperty::SUBTITLE_STREAM = 101;
@@ -366,33 +365,22 @@ FFmpegContent::audio_analysis_path () const
           analyses for each stream.
        */
 
-       boost::filesystem::path p = film->audio_analysis_dir ();
-       string name = digest();
+       boost::filesystem::path p = AudioContent::audio_analysis_path ();
        if (audio_stream ()) {
-               name += "_" + audio_stream()->identifier ();
+               p = p.string() + "_" + audio_stream()->identifier ();
        }
-       p /= name;
        return p;
 }
 
 list<ContentTimePeriod>
 FFmpegContent::subtitles_during (ContentTimePeriod period, bool starting) const
 {
-       list<ContentTimePeriod> d;
-       
        shared_ptr<FFmpegSubtitleStream> stream = subtitle_stream ();
        if (!stream) {
-               return d;
-       }
-
-       /* XXX: inefficient */
-       for (vector<ContentTimePeriod>::const_iterator i = stream->periods.begin(); i != stream->periods.end(); ++i) {
-               if ((starting && period.contains (i->from)) || (!starting && period.overlaps (*i))) {
-                       d.push_back (*i);
-               }
+               return list<ContentTimePeriod> ();
        }
 
-       return d;
+       return stream->subtitles_during (period, starting);
 }
 
 bool