swaroop: add some debugging.
[dcpomatic.git] / src / wx / swaroop_controls.cc
index 12c843417d695f52ba1c877e953695b6054cbdb9..8cd3b1d5bab913429e687f6d567ec10d5a920ba1 100644 (file)
@@ -125,8 +125,10 @@ SwaroopControls::SwaroopControls (wxWindow* parent, shared_ptr<FilmViewer> viewe
 void
 SwaroopControls::check_restart ()
 {
+       cout << "check_restart called\n";
        FILE* f = fopen_boost (Config::path("position"), "r");
        if (!f) {
+               cout << "could not open position file (" << errno << ")\n";
                return;
        }
 
@@ -135,8 +137,11 @@ SwaroopControls::check_restart ()
        int64_t time;
        fscanf (f, "%63s %d %ld", id, &index, &time);
 
+       cout << "Looking for playlist " << id << " to restart.\n";
+
        for (size_t i = 0; i < _playlists.size(); ++i) {
                if (_playlists[i].id() == id) {
+                       cout << "Found playlist " << id << "\n";
                        select_playlist (i, index);
                        update_current_content ();
                        _viewer->seek (DCPTime(time), false);
@@ -144,9 +149,6 @@ SwaroopControls::check_restart ()
                }
        }
 
-#ifdef DCPOMATIC_LINUX
-       fsync (fileno(f));
-#endif DCPOMATIC_LINUX
        fclose (f);
 }
 
@@ -164,6 +166,9 @@ SwaroopControls::viewer_position_changed ()
                        + " " + dcp::raw_convert<string>(_viewer->position().get());
 
                checked_fwrite (p.c_str(), p.length(), f, Config::path("position"));
+#ifdef DCPOMATIC_LINUX
+               fsync (fileno(f));
+#endif
                fclose (f);
        }
 }