2 * Copyright (C) 2013-2017 Paul Davis <paul@linuxaudiosystems.com>
3 * Copyright (C) 2013-2017 Robin Gareus <robin@gareus.org>
4 * Copyright (C) 2013 John Emmas <john@creativepost.co.uk>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License along
17 * with this program; if not, write to the Free Software Foundation, Inc.,
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21 #include "pbd/gstdio_compat.h"
23 #include "ardour/profile.h"
24 #include "ardour/rc_configuration.h"
25 #include "ardour/audio_track.h"
26 #include "ardour/audioregion.h"
28 #include "ardour_ui.h"
30 #include "canvas/rectangle.h"
32 #include "audio_time_axis.h"
33 #include "video_image_frame.h"
34 #include "export_video_dialog.h"
35 #include "interthread_progress_window.h"
37 #include "pbd/openuri.h"
43 Editor::set_video_timeline_height (const int h)
45 if (videotl_bar_height == h) { return; }
46 if (h < 2 || h > 8) { return; }
47 videotl_bar_height = h;
48 videotl_label.set_size_request (-1, (int)timebar_height * videotl_bar_height);
49 ARDOUR_UI::instance()->video_timeline->set_height(videotl_bar_height * timebar_height);
50 update_ruler_visibility();
54 Editor::update_video_timeline (bool flush)
56 // catch GUIIdle -> Editor::idle_visual_changer during quit/close
57 assert (ARDOUR_UI::instance()->video_timeline);
60 ARDOUR_UI::instance()->video_timeline->flush_local_cache();
62 if (!ruler_video_action->get_active()) return;
63 ARDOUR_UI::instance()->video_timeline->update_video_timeline();
67 Editor::is_video_timeline_locked ()
69 return ARDOUR_UI::instance()->video_timeline->is_offset_locked();
73 Editor::set_video_timeline_locked (const bool l)
75 ARDOUR_UI::instance()->video_timeline->set_offset_locked(l);
79 Editor::toggle_video_timeline_locked ()
81 ARDOUR_UI::instance()->video_timeline->toggle_offset_locked();
85 Editor::embed_audio_from_video (std::string path, samplepos_t n, bool lock_position_to_video)
87 vector<std::string> paths;
88 paths.push_back(path);
89 current_interthread_info = &import_status;
90 import_status.current = 1;
91 import_status.total = paths.size ();
92 import_status.all_done = false;
94 ImportProgressWindow ipw (&import_status, _("Import"), _("Cancel Import"));
97 boost::shared_ptr<ARDOUR::Track> track;
98 bool ok = (import_sndfiles (paths, Editing::ImportDistinctFiles, Editing::ImportAsTrack, ARDOUR::SrcBest, n, 1, 1, track, false) == 0);
100 if (lock_position_to_video) {
101 boost::shared_ptr<ARDOUR::Playlist> pl = track->playlist();
102 pl->find_next_region(n, ARDOUR::End, 0)->set_video_locked(true);
104 _session->save_state ("");
107 import_status.all_done = true;
108 ::g_unlink(path.c_str());