fix merge conflict from master
[ardour.git] / libs / ardour / audiofilesource.cc
index 63f7b55016455d7a02a9a862e2b65c81b8c49c16..014baa90317b13c420af7c9863378ef6ddd4f976 100644 (file)
 
 #include <sndfile.h>
 
+#include <glib/gstdio.h>
 #include <glibmm/miscutils.h>
 #include <glibmm/fileutils.h>
-#include <glibmm/thread.h>
+#include <glibmm/threads.h>
 
 #include "ardour/audiofilesource.h"
 #include "ardour/debug.h"
-#include "ardour/sndfile_helpers.h"
 #include "ardour/sndfilesource.h"
 #include "ardour/session.h"
-#include "ardour/session_directory.h"
-#include "ardour/source_factory.h"
 #include "ardour/filename_extensions.h"
 
 // if these headers come before sigc++ is included
@@ -71,7 +69,7 @@ using namespace Glib;
 string AudioFileSource::peak_dir = "";
 
 PBD::Signal0<void> AudioFileSource::HeaderPositionOffsetChanged;
-uint64_t           AudioFileSource::header_position_offset = 0;
+framecnt_t         AudioFileSource::header_position_offset = 0;
 
 /* XXX maybe this too */
 char AudioFileSource::bwf_serial_number[13] = "000000000000";
@@ -89,7 +87,7 @@ struct SizedSampleBuffer {
        }
 };
 
-Glib::StaticPrivate<SizedSampleBuffer> thread_interleave_buffer = GLIBMM_STATIC_PRIVATE_INIT;
+Glib::Threads::Private<SizedSampleBuffer> thread_interleave_buffer;
 
 /** Constructor used for existing external-to-session files. */
 AudioFileSource::AudioFileSource (Session& s, const string& path, Source::Flag flags)
@@ -98,12 +96,9 @@ AudioFileSource::AudioFileSource (Session& s, const string& path, Source::Flag f
           /* note that external files have their own path as "origin" */
        , FileSource (s, DataType::AUDIO, path, path, flags)
 {
-        /* note that origin remains empty */
-
        if (init (_path, true)) {
                throw failed_constructor ();
        }
-        cerr << "audiofile source created with path " << path << endl;
 }
 
 /** Constructor used for new internal-to-session files. */
@@ -129,7 +124,7 @@ AudioFileSource::AudioFileSource (Session& s, const XMLNode& node, bool must_exi
        if (set_state (node, Stateful::loading_state_version)) {
                throw failed_constructor ();
        }
-       
+
        if (init (_path, must_exist)) {
                throw failed_constructor ();
        }
@@ -139,8 +134,8 @@ AudioFileSource::~AudioFileSource ()
 {
        DEBUG_TRACE (DEBUG::Destruction, string_compose ("AudioFileSource destructor %1, removable? %2\n", _path, removable()));
        if (removable()) {
-               unlink (_path.c_str());
-               unlink (peakpath.c_str());
+               ::g_unlink (_path.c_str());
+               ::g_unlink (peakpath.c_str());
        }
 }
 
@@ -246,7 +241,7 @@ AudioFileSource::get_soundfile_info (string path, SoundFileInfo& _info, string&
        if (SndFileSource::get_soundfile_info (path, _info, error_msg) != 0) {
                return true;
        }
-        
+
 #ifdef HAVE_COREAUDIO
        if (CoreAudioSource::get_soundfile_info (path, _info, error_msg) == 0) {
                return true;
@@ -298,7 +293,7 @@ AudioFileSource::mark_streaming_write_completed ()
 int
 AudioFileSource::move_dependents_to_trash()
 {
-       return ::unlink (peakpath.c_str());
+       return ::g_unlink (peakpath.c_str());
 }
 
 void
@@ -326,7 +321,7 @@ int
 AudioFileSource::setup_peakfile ()
 {
        if (!(_flags & NoPeakFile)) {
-               return initialize_peakfile (_file_is_new, _path);
+               return initialize_peakfile (_path);
        } else {
                return 0;
        }