Files
StarPilot/selfdrive/ui/replay/FileReader.hpp
T
iejMac ff2138d905 qt replay (#20602)
* initial commit, works

* remove nui

* working again

* visionipc

* cleanup

* cleanup

* moving VisionIpcServer to Unlogger class

* works

* tab cleanup

* headless mode

* headless mode works

* working headless mode

* gitignore update

* small unlogger refactor

* refactor param in UIState

* works, very slow, hacks

* cleanup

* works

* cleanup

* cleanup

* unused

* works for whole route

* nicer

* a little nicer

* different threshold

* maintains 1 segment window

* works with public api

* comments

* networkTimer works

* cleanup

* unified HttpRequest

* tabs

* tabs

* comments'

* gitignore

* gitignore

* only on PC

* same line else

* no changes in home.cc

* scons

* update scons

* works

* revert mainc.c

* revert home

* else

* just api + problem with api send

* works

* include cleanup

* general json fail

* whitespace

* remove active

* adding request repeater

* removing comments

* tabs

* update comment

* cereal

* fix

* trailing new lines

* grammar

* if whitespace

* indentation

* Update selfdrive/ui/SConscript

Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com>

* Update selfdrive/ui/qt/request_repeater.cc

Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com>

* works

* sort by dir

* no blockSignal

* replay is now QOBject

* cant take const char

* rename inner it

* get width and height from frame readeR

* resolve TODO

* seek in next pr

* spaces

* ui stuff

* fix CI

* remove comments

* no repalce

* trim segment fix

* remove seek from stream

* no cache key

* final changes'

* fix

Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com>
old-commit-hash: 19d962cdf37b80523deba6518057f2e860f65fee
2021-04-24 00:59:09 -07:00

72 lines
1.3 KiB
C++

#pragma once
#include <QString>
#include <QNetworkAccessManager>
#include <QWidget>
#include <QVector>
#include <QMultiMap>
#include <QElapsedTimer>
#include <QReadWriteLock>
#include <bzlib.h>
#include <kj/io.h>
#include <capnp/serialize.h>
#include "cereal/gen/cpp/log.capnp.h"
#include <thread>
#include "channel.hpp"
class FileReader : public QObject {
Q_OBJECT
public:
FileReader(const QString& file_);
void startRequest(const QUrl &url);
~FileReader();
virtual void readyRead();
void httpFinished();
virtual void done() {};
public slots:
void process();
protected:
QNetworkReply *reply;
private:
QNetworkAccessManager *qnam;
QElapsedTimer timer;
QString file;
};
typedef QMultiMap<uint64_t, cereal::Event::Reader> Events;
class LogReader : public FileReader {
Q_OBJECT
public:
LogReader(const QString& file, Events *, QReadWriteLock* events_lock_, QMap<int, QPair<int, int> > *eidx_);
~LogReader();
void readyRead();
void done() { is_done = true; };
bool is_done = false;
private:
bz_stream bStream;
// backing store
QByteArray raw;
std::thread *parser;
int event_offset;
channel<int> cdled;
// global
void mergeEvents(int dled);
Events *events;
QReadWriteLock* events_lock;
QMap<int, QPair<int, int> > *eidx;
};