ardour
editor_videotimeline.cc
Go to the documentation of this file.
1 /*
2  Copyright (C) 2010 Paul Davis
3  Author: Robin Gareus <robin@gareus.org>
4 
5  This program is free software; you can redistribute it and/or modify
6  it under the terms of the GNU General Public License as published by
7  the Free Software Foundation; either version 2 of the License, or
8  (at your option) any later version.
9 
10  This program is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU General Public License for more details.
14 
15  You should have received a copy of the GNU General Public License
16  along with this program; if not, write to the Free Software
17  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18 
19 */
20 
21 #include <glib/gstdio.h>
22 
23 #include "ardour/profile.h"
25 #include "ardour/audio_track.h"
26 #include "ardour/audioregion.h"
27 
28 #include "ardour_ui.h"
29 #include "editor.h"
30 #include "canvas/rectangle.h"
31 #include "editing.h"
32 #include "audio_time_axis.h"
33 #include "video_image_frame.h"
34 #include "export_video_dialog.h"
36 
37 #include "pbd/openuri.h"
38 #include "i18n.h"
39 
40 using namespace std;
41 
42 void
44 {
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();
51 }
52 
53 void
55 {
56  if (flush) {
58  }
59  if (!ruler_video_action->get_active()) return;
61 }
62 
63 bool
65 {
67 }
68 
69 void
71 {
73 }
74 
75 void
77 {
79 }
80 
81 void
82 Editor::embed_audio_from_video (std::string path, framepos_t n, bool lock_position_to_video)
83 {
84  vector<std::string> paths;
85  paths.push_back(path);
86  current_interthread_info = &import_status;
87  import_status.current = 1;
88  import_status.total = paths.size ();
89  import_status.all_done = false;
90 
91  ImportProgressWindow ipw (&import_status, _("Import"), _("Cancel Import"));
92  ipw.show ();
93 
95  bool ok = (import_sndfiles (paths, Editing::ImportDistinctFiles, Editing::ImportAsTrack, ARDOUR::SrcBest, n, 1, 1, track, false) == 0);
96  if (ok && track) {
97  if (lock_position_to_video) {
99  pl->find_next_region(n, ARDOUR::End, 0)->set_video_locked(true);
100  }
101  _session->save_state ("");
102  }
103 
104  import_status.all_done = true;
105  ::g_unlink(path.c_str());
106 }
void set_height(int)
void toggle_video_timeline_locked()
void update_video_timeline(bool flush=false)
static ARDOUR_UI * instance()
Definition: ardour_ui.h:187
Definition: Beats.hpp:239
void embed_audio_from_video(std::string, framepos_t n=0, bool lock_position_to_video=true)
#define _(Text)
Definition: i18n.h:11
boost::shared_ptr< Region > find_next_region(framepos_t frame, RegionPoint point, int dir)
Definition: playlist.cc:1905
VideoTimeLine * video_timeline
Definition: ardour_ui.h:236
boost::shared_ptr< Playlist > playlist()
Definition: track.cc:590
void update_video_timeline()
void flush_local_cache()
bool is_video_timeline_locked()
void toggle_offset_locked()
void set_video_timeline_locked(const bool)
bool is_offset_locked()
void set_offset_locked(bool v)
int64_t framepos_t
void set_video_timeline_height(const int)