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.
		
		
		
		
		
			
		
			
				
					
					
						
							44 lines
						
					
					
						
							1.0 KiB
						
					
					
				
			
		
		
	
	
							44 lines
						
					
					
						
							1.0 KiB
						
					
					
				| #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, 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_;
 | |
|   std::string vid_path, lock_path;
 | |
| 
 | |
|   const AVCodec *codec = NULL;
 | |
|   AVCodecContext *codec_ctx = NULL;
 | |
| 
 | |
|   AVStream *stream = NULL;
 | |
|   AVFormatContext *format_ctx = NULL;
 | |
| 
 | |
|   AVFrame *frame = NULL;
 | |
|   std::vector<uint8_t> downscale_buf;
 | |
| };
 | |
| 
 |