mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-07-19 00:02:08 +08:00
7119a98414
* start v4l encoder * v4l encoder starts * start and stop * fill in proper controls * it dequeued a buffer * getting bytes * it made a video * it does make files * getting close * ahh, so that's how dequeue works * qcam works (no remuxing) * remuxing works * we just need to make shutdown and rollover graceful * graceful destruction * switch to polling * should work now * fix pc build * refactors, stop properly * touchups, remove a copy * add v4l encoder to release * inlcude file * move writing to it's own thread * fix minor memory leak * block instead of dropping frames * add counter, fix tests maybe * better debugging and test print * print file path in assert * format string in test * no more oversized qlogs * match qcam * touchups, remove omx encoder * remove omx include files * checked ioctl, better debugging, open by name * unused import * move linux includes to third_party/linux/include * simple encoderd * full packet * encoderd should be complete * lagging print * updates * name dq thread * subset idx * video file writing works * debug * potential bugfix * rotation works * iframe * keep writing support * ci should pass * loggerd, not encoderd * remote encoder code * support remote encoder * cereal to master, add encoderd * header no longer required * put that back there * realtime * lower decoder latency * don't use queue for VisionIpcBufExtra, disable realtime again * assert all written * hmm simpler * only push to to_write if we are writing * assert timestamp is right * use at and remove assert * revert to queue Co-authored-by: Comma Device <device@comma.ai> old-commit-hash: 0baa4c3e2ad9ee6f8daba8267db44c2cd44caa62
42 lines
1021 B
C++
42 lines
1021 B
C++
#pragma once
|
|
|
|
#include <cstdio>
|
|
#include <cstdlib>
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
extern "C" {
|
|
#include <libavcodec/avcodec.h>
|
|
#include <libavformat/avformat.h>
|
|
#include <libavutil/imgutils.h>
|
|
}
|
|
|
|
#include "selfdrive/loggerd/encoder.h"
|
|
#include "selfdrive/loggerd/loggerd.h"
|
|
#include "selfdrive/loggerd/video_writer.h"
|
|
|
|
class RawLogger : public VideoEncoder {
|
|
public:
|
|
RawLogger(const char* filename, CameraType type, int in_width, int in_height, int fps,
|
|
int bitrate, bool h265, int out_width, int out_height, bool write = true);
|
|
~RawLogger();
|
|
int encode_frame(const uint8_t *y_ptr, const uint8_t *u_ptr, const uint8_t *v_ptr,
|
|
int in_width, int in_height, VisionIpcBufExtra *extra);
|
|
void encoder_open(const char* path);
|
|
void encoder_close();
|
|
|
|
private:
|
|
const char* filename;
|
|
//bool write;
|
|
int fps;
|
|
int counter = 0;
|
|
bool is_open = false;
|
|
|
|
int in_width_, in_height_;
|
|
|
|
AVFrame *frame = NULL;
|
|
std::vector<uint8_t> downscale_buf;
|
|
|
|
VideoWriter *writer = NULL;
|
|
};
|