refactoring

This commit is contained in:
Devaev Maxim
2021-01-02 06:12:44 +03:00
parent 8222c17aa7
commit 6687548ba9
23 changed files with 177 additions and 247 deletions

View File

@@ -40,11 +40,10 @@ static const char *_mmal_error_to_string(MMAL_STATUS_T error);
h264_encoder_s *h264_encoder_init(void) {
h264_encoder_runtime_s *run;
h264_encoder_s *encoder;
A_CALLOC(run, 1);
run->tmp = frame_init("h264_tmp");
h264_encoder_s *encoder;
A_CALLOC(encoder, 1);
encoder->gop = 60;
encoder->bps = 5000 * 1000; // Kbps * 1000
@@ -280,17 +279,13 @@ static void _h264_encoder_cleanup(h264_encoder_s *encoder) {
}
static int _h264_encoder_compress_raw(h264_encoder_s *encoder, const frame_s *src, frame_s *dest, bool force_key) {
MMAL_STATUS_T error;
MMAL_BUFFER_HEADER_T *out = NULL;
MMAL_BUFFER_HEADER_T *in = NULL;
bool eos = false;
bool sent = false;
assert(src->used > 0);
assert(src->width == encoder->width);
assert(src->height == encoder->height);
assert(src->format == encoder->format);
MMAL_STATUS_T error;
LOG_DEBUG("Compressing new H264 frame; force_key=%d ...", force_key);
frame_copy_meta(src, dest);
@@ -309,6 +304,11 @@ static int _h264_encoder_compress_raw(h264_encoder_s *encoder, const frame_s *sr
}
}
MMAL_BUFFER_HEADER_T *out = NULL;
MMAL_BUFFER_HEADER_T *in = NULL;
bool eos = false;
bool sent = false;
while (!eos) {
out = NULL;
while (mmal_wrapper_buffer_get_empty(RUN(output_port), &out, 0) == MMAL_SUCCESS) {