You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
					
					
						
							52 lines
						
					
					
						
							1.8 KiB
						
					
					
				
			
		
		
	
	
							52 lines
						
					
					
						
							1.8 KiB
						
					
					
				| #pragma once
 | |
| 
 | |
| #include <QCheckBox>
 | |
| #include <algorithm>
 | |
| #include <memory>
 | |
| #include <set>
 | |
| #include <vector>
 | |
| 
 | |
| #include "common/prefix.h"
 | |
| #include "tools/cabana/streams/abstractstream.h"
 | |
| #include "tools/replay/replay.h"
 | |
| 
 | |
| class ReplayStream : public AbstractStream {
 | |
|   Q_OBJECT
 | |
| 
 | |
| public:
 | |
|   ReplayStream(QObject *parent);
 | |
|   void start() override { replay->start(); }
 | |
|   bool loadRoute(const QString &route, const QString &data_dir, uint32_t replay_flags = REPLAY_FLAG_NONE);
 | |
|   bool eventFilter(const Event *event);
 | |
|   void seekTo(double ts) override { replay->seekTo(std::max(double(0), ts), false); }
 | |
|   bool liveStreaming() const override { return false; }
 | |
|   inline QString routeName() const override { return replay->route()->name(); }
 | |
|   inline QString carFingerprint() const override { return replay->carFingerprint().c_str(); }
 | |
|   double minSeconds() const override { return replay->minSeconds(); }
 | |
|   double maxSeconds() const { return replay->maxSeconds(); }
 | |
|   inline QDateTime beginDateTime() const { return replay->routeDateTime(); }
 | |
|   inline uint64_t beginMonoTime() const override { return replay->routeStartNanos(); }
 | |
|   inline void setSpeed(float speed) override { replay->setSpeed(speed); }
 | |
|   inline float getSpeed() const { return replay->getSpeed(); }
 | |
|   inline Replay *getReplay() const { return replay.get(); }
 | |
|   inline bool isPaused() const override { return replay->isPaused(); }
 | |
|   void pause(bool pause) override;
 | |
| 
 | |
| private:
 | |
|   void mergeSegments();
 | |
|   std::unique_ptr<Replay> replay = nullptr;
 | |
|   std::set<int> processed_segments;
 | |
|   std::unique_ptr<OpenpilotPrefix> op_prefix;
 | |
| };
 | |
| 
 | |
| class OpenReplayWidget : public AbstractOpenStreamWidget {
 | |
|   Q_OBJECT
 | |
| 
 | |
| public:
 | |
|   OpenReplayWidget(QWidget *parent = nullptr);
 | |
|   AbstractStream *open() override;
 | |
| 
 | |
| private:
 | |
|   QLineEdit *route_edit;
 | |
|   std::vector<QCheckBox *> cameras;
 | |
| };
 | |
| 
 |