Reported by Fedora team for gcc-13 and Andrew created patch here
[goodguy/cinelerra.git] / cinelerra-5.1 / cinelerra / vtracking.C
1
2 /*
3  * CINELERRA
4  * Copyright (C) 2008 Adam Williams <broadcast at earthling dot net>
5  *
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.
10  *
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.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19  *
20  */
21
22 #include "asset.h"
23 #include "assets.h"
24 #include "edl.h"
25 #include "edlsession.h"
26 #include "localsession.h"
27 #include "mainclock.h"
28 #include "meterpanel.h"
29 #include "mwindow.h"
30 #include "renderengine.h"
31 #include "mainclock.h"
32 #include "vplayback.h"
33 #include "vrender.h"
34 #include "vtimebar.h"
35 #include "vtracking.h"
36 #include "vwindow.h"
37 #include "vwindowgui.h"
38
39
40 VTracking::VTracking(MWindow *mwindow, VWindow *vwindow)
41  : Tracking(mwindow)
42 {
43         this->vwindow = vwindow;
44 }
45
46 VTracking::~VTracking()
47 {
48 }
49
50 PlaybackEngine* VTracking::get_playback_engine()
51 {
52         return vwindow->playback_engine;
53 }
54
55 void VTracking::update_tracker(double position)
56 {
57         if( !vwindow->get_edl() ) return;
58         vwindow->gui->lock_window("VTracking::update_tracker");
59         vwindow->get_edl()->local_session->set_selectionstart(position);
60         vwindow->get_edl()->local_session->set_selectionend(position);
61         vwindow->gui->clock->update(position);
62 // This is going to boost the latency but we need to update the timebar
63         vwindow->gui->timebar->update(1);
64         vwindow->gui->unlock_window();
65         update_meters((int64_t)(position * mwindow->edl->session->sample_rate));
66 }
67
68 int VTracking::start_playback(double new_position)
69 {
70
71         return Tracking::start_playback(new_position);
72 }
73
74 void VTracking::update_meters(int64_t position)
75 {
76         double output_levels[MAXCHANNELS];
77
78         int do_audio = get_playback_engine()->get_output_levels(output_levels,
79                 position);
80         if(do_audio)
81         {
82                 vwindow->gui->lock_window("VTracking::update_meters");
83                 vwindow->gui->meters->update(output_levels);
84                 vwindow->gui->unlock_window();
85         }
86 }
87
88 void VTracking::stop_meters()
89 {
90         vwindow->gui->lock_window("VTracking::stop_meters");
91         vwindow->gui->meters->stop_meters();
92         vwindow->gui->unlock_window();
93 }
94
95 void VTracking::draw()
96 {
97 }