fix refactored code.

This commit is contained in:
Jordan
2024-03-13 10:26:37 -07:00
parent cc317d0d24
commit 9f641ffbf7
6 changed files with 78 additions and 55 deletions

View File

@ -1,14 +1,5 @@
#include "frame.h"
const Frame *new_frame_from_handle(FILE *stream, int w, int h, int depth)
{
Frame *f = (Frame *)malloc(sizeof(Frame));
f->stream = stream;
f->w = w;
f->h = h;
f->depth = depth;
return f;
}
FILE *make_buffer(const uint8_t *data, const size_t data_len)
{
@ -29,10 +20,20 @@ FILE *make_buffer(const uint8_t *data, const size_t data_len)
return file;
}
_FFI_PLUGIN
const Frame *
new_frame_from_data(const uint8_t *data, const size_t data_len, int w, int h, int depth)
const Frame *new_frame_from_data(const uint8_t *data, const size_t data_len, int w, int h, int depth)
{
FILE *buf = make_buffer(data, data_len);
return new_frame_from_handle(buf, w, h, depth);
}
const Frame *new_frame_from_handle(FILE *stream, int w, int h, int depth)
{
Frame *f = (Frame *)malloc(sizeof(Frame));
f->stream = stream;
f->w = w;
f->h = h;
f->depth = depth;
return f;
}