mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-07-01 03:22:07 +08:00
loggerd: remove vipc arg from encode frame
old-commit-hash: 1ed77847fe3f53b14595bab8f1f47134fee03c9b
This commit is contained in:
@@ -2,14 +2,12 @@
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
#include "visionipc.h"
|
||||
|
||||
class VideoEncoder {
|
||||
public:
|
||||
virtual ~VideoEncoder() {}
|
||||
virtual int encode_frame(const uint8_t *y_ptr, const uint8_t *u_ptr, const uint8_t *v_ptr,
|
||||
int in_width, int in_height,
|
||||
int *frame_segment, VisionIpcBufExtra *extra) = 0;
|
||||
int in_width, int in_height,
|
||||
int *frame_segment, uint64_t ts) = 0;
|
||||
virtual void encoder_open(const char* path, int segment) = 0;
|
||||
virtual void encoder_close() = 0;
|
||||
};
|
||||
|
||||
@@ -270,12 +270,12 @@ void encoder_thread(int cam_idx) {
|
||||
int out_segment = -1;
|
||||
int out_id = encoders[0]->encode_frame(buf->y, buf->u, buf->v,
|
||||
buf->width, buf->height,
|
||||
&out_segment, &extra);
|
||||
&out_segment, extra.timestamp_eof);
|
||||
if (encoders.size() > 1) {
|
||||
int out_segment_alt = -1;
|
||||
encoders[1]->encode_frame(buf->y, buf->u, buf->v,
|
||||
buf->width, buf->height,
|
||||
&out_segment_alt, &extra);
|
||||
&out_segment_alt, extra.timestamp_eof);
|
||||
}
|
||||
|
||||
// publish encode index
|
||||
|
||||
@@ -406,7 +406,7 @@ void OmxEncoder::handle_out_buf(OmxEncoder *e, OMX_BUFFERHEADERTYPE *out_buf) {
|
||||
|
||||
int OmxEncoder::encode_frame(const uint8_t *y_ptr, const uint8_t *u_ptr, const uint8_t *v_ptr,
|
||||
int in_width, int in_height,
|
||||
int *frame_segment, VisionIpcBufExtra *extra) {
|
||||
int *frame_segment, uint64_t ts) {
|
||||
int err;
|
||||
pthread_mutex_lock(&this->lock);
|
||||
|
||||
@@ -458,7 +458,7 @@ int OmxEncoder::encode_frame(const uint8_t *y_ptr, const uint8_t *u_ptr, const u
|
||||
in_buf->nFilledLen = VENUS_BUFFER_SIZE(COLOR_FMT_NV12, this->width, this->height);
|
||||
in_buf->nFlags = OMX_BUFFERFLAG_ENDOFFRAME;
|
||||
in_buf->nOffset = 0;
|
||||
in_buf->nTimeStamp = extra->timestamp_eof/1000LL; // OMX_TICKS, in microseconds
|
||||
in_buf->nTimeStamp = ts/1000LL; // OMX_TICKS, in microseconds
|
||||
this->last_t = in_buf->nTimeStamp;
|
||||
|
||||
OMX_CHECK(OMX_EmptyThisBuffer(this->handle, in_buf));
|
||||
|
||||
@@ -14,7 +14,6 @@ extern "C" {
|
||||
|
||||
#include "encoder.h"
|
||||
#include "common/cqueue.h"
|
||||
#include "visionipc.h"
|
||||
|
||||
// OmxEncoder, lossey codec using hardware hevc
|
||||
class OmxEncoder : public VideoEncoder {
|
||||
@@ -23,7 +22,7 @@ public:
|
||||
~OmxEncoder();
|
||||
int encode_frame(const uint8_t *y_ptr, const uint8_t *u_ptr, const uint8_t *v_ptr,
|
||||
int in_width, int in_height,
|
||||
int *frame_segment, VisionIpcBufExtra *extra);
|
||||
int *frame_segment, uint64_t ts);
|
||||
void encoder_open(const char* path, int segment);
|
||||
void encoder_close();
|
||||
|
||||
|
||||
@@ -129,7 +129,7 @@ void RawLogger::encoder_close() {
|
||||
|
||||
int RawLogger::encode_frame(const uint8_t *y_ptr, const uint8_t *u_ptr, const uint8_t *v_ptr,
|
||||
int in_width, int in_height,
|
||||
int *frame_segment, VisionIpcBufExtra *extra) {
|
||||
int *frame_segment, uint64_t ts) {
|
||||
int err = 0;
|
||||
|
||||
AVPacket pkt;
|
||||
@@ -140,7 +140,7 @@ int RawLogger::encode_frame(const uint8_t *y_ptr, const uint8_t *u_ptr, const ui
|
||||
frame->data[0] = (uint8_t*)y_ptr;
|
||||
frame->data[1] = (uint8_t*)u_ptr;
|
||||
frame->data[2] = (uint8_t*)v_ptr;
|
||||
frame->pts = extra->timestamp_eof;
|
||||
frame->pts = ts;
|
||||
|
||||
int ret = counter;
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
#ifndef FFV1LOGGER_H
|
||||
#define FFV1LOGGER_H
|
||||
#pragma once
|
||||
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
@@ -24,7 +23,7 @@ public:
|
||||
~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,
|
||||
int *frame_segment, VisionIpcBufExtra *extra);
|
||||
int *frame_segment, uint64_t ts);
|
||||
void encoder_open(const char* path, int segment);
|
||||
void encoder_close();
|
||||
|
||||
@@ -47,5 +46,3 @@ private:
|
||||
|
||||
AVFrame *frame = NULL;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user