diff --git a/ivfdec.c b/ivfdec.c index a37a44c07771c6ec7be5ff7b6e664aba74a3aec5..65415ccd8fb89b28e103dfb90abf5936d1fea4cc 100644 --- a/ivfdec.c +++ b/ivfdec.c @@ -65,16 +65,10 @@ int file_is_ivf(struct VpxInputContext *input_ctx) { return is_ivf; } -int ivf_read_frame(struct VpxInputContext *input_ctx, - uint8_t **buffer, - size_t *bytes_read, - size_t *buffer_size) { +int ivf_read_frame(FILE *infile, uint8_t **buffer, + size_t *bytes_read, size_t *buffer_size) { char raw_header[IVF_FRAME_HDR_SZ] = {0}; size_t frame_size = 0; - FILE *infile = input_ctx->file; - - if (input_ctx->file_type != FILE_TYPE_IVF) - return 0; if (fread(raw_header, IVF_FRAME_HDR_SZ, 1, infile) != 1) { if (!feof(infile)) diff --git a/ivfdec.h b/ivfdec.h index 5da9accd86a19521a97fb7a29c9b9f928873f469..dd29cc6174b73d579ee3c4e15e372e29d73cc9a6 100644 --- a/ivfdec.h +++ b/ivfdec.h @@ -18,10 +18,8 @@ extern "C" { int file_is_ivf(struct VpxInputContext *input); -int ivf_read_frame(struct VpxInputContext *input, - uint8_t **buffer, - size_t *bytes_read, - size_t *buffer_size); +int ivf_read_frame(FILE *infile, uint8_t **buffer, + size_t *bytes_read, size_t *buffer_size); #ifdef __cplusplus } /* extern "C" */ diff --git a/vpxdec.c b/vpxdec.c index 97ac4bb47d6f1670d3e0c283351e4944c698a9a9..e6384fe0f0cd76b56c76037e3ec9537ae26c8b77 100644 --- a/vpxdec.c +++ b/vpxdec.c @@ -167,11 +167,10 @@ void usage_exit() { exit(EXIT_FAILURE); } -static int raw_read_frame(struct VpxInputContext *input_ctx, uint8_t **buffer, +static int raw_read_frame(FILE *infile, uint8_t **buffer, size_t *bytes_read, size_t *buffer_size) { char raw_hdr[RAW_FRAME_HDR_SZ]; size_t frame_size = 0; - FILE *infile = input_ctx->file; if (fread(raw_hdr, RAW_FRAME_HDR_SZ, 1, infile) != 1) { if (!feof(infile)) @@ -221,10 +220,10 @@ static int read_frame(struct VpxDecInputContext *input, uint8_t **buf, return webm_read_frame(input->webm_ctx, buf, bytes_in_buffer, buffer_size); case FILE_TYPE_RAW: - return raw_read_frame(input->vpx_input_ctx, + return raw_read_frame(input->vpx_input_ctx->file, buf, bytes_in_buffer, buffer_size); case FILE_TYPE_IVF: - return ivf_read_frame(input->vpx_input_ctx, + return ivf_read_frame(input->vpx_input_ctx->file, buf, bytes_in_buffer, buffer_size); default: return 1;