Files
dragonpilot/selfdrive/loggerd/raw_logger.h
Dean Lee 7222d0f20d Cleanup selfdrive/ includes (#20822)
* cleanup include path

* continue

* format includes

* fix testraw.cc

* remove include path from SConstruct

* regroup

* rebase master

* almost done

* apply review

* rename FileReader.xx to filereader.xx

* rename Unlogger.x->unlogger.x

* rename FrameReader.xx -> framereader.xx

* apply reviews

* ui.h

* continue

* fix framebuffer.cc build error:mv util.h up

* full path to msm_media_info

* fix qcom2 camerad

Co-authored-by: Comma Device <device@comma.ai>
2021-05-08 22:15:17 -07:00

42 lines
917 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"
class RawLogger : public VideoEncoder {
public:
RawLogger(const char* filename, int width, int height, int fps,
int bitrate, bool h265, bool downscale);
~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;
int fps;
int counter = 0;
bool is_open = false;
std::string vid_path, lock_path;
AVCodec *codec = NULL;
AVCodecContext *codec_ctx = NULL;
AVStream *stream = NULL;
AVFormatContext *format_ctx = NULL;
AVFrame *frame = NULL;
};