Files
sunnypilot/selfdrive/loggerd/raw_logger.h
George Hotz b872fe92ab loggerd: Separate writer from encoder (#24257)
* seperate writer from encoder

* video writer in release

* confirm loggerd on PC works, add YUV option to compressed_vipc

* make raw_logger use video_writer

* put this back to master

* close codec

* put this back

* use unique_ptr

Co-authored-by: Comma Device <device@comma.ai>
old-commit-hash: 8d24655787
2022-04-20 14:51:24 -07:00

41 lines
969 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/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, uint64_t ts);
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;
};