Skip to content

Commit

Permalink
don't return dakara_check_results
Browse files Browse the repository at this point in the history
we use the struct given by the caller
  • Loading branch information
odrling committed Aug 4, 2024
1 parent f8d67d0 commit b99f2bf
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 15 deletions.
9 changes: 4 additions & 5 deletions include/dakara_check.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,11 @@ void dakara_check_results_init(dakara_check_results *res);

const char *dakara_check_version(void);

dakara_check_results *dakara_check(char *filepath, dakara_check_results *res);
void dakara_check(char *filepath, dakara_check_results *res);

dakara_check_results *dakara_check_avio(size_t buffer_size, void *readable,
int (*read_packet)(void *, uint8_t *, int),
int64_t (*seek)(void *, int64_t, int),
dakara_check_results *res);
void dakara_check_avio(size_t buffer_size, void *readable,
int (*read_packet)(void *, uint8_t *, int),
int64_t (*seek)(void *, int64_t, int), dakara_check_results *res);

void dakara_check_print_results(dakara_check_results *res, char *filepath);

Expand Down
15 changes: 5 additions & 10 deletions libdakara_check.c
Original file line number Diff line number Diff line change
Expand Up @@ -95,29 +95,26 @@ static void dakara_check_avf(AVFormatContext *s, dakara_check_results *res) {
ffaacsucks_result_free(ffaac_res);
}

dakara_check_results *dakara_check(char *filepath, dakara_check_results *res) {
void dakara_check(char *filepath, dakara_check_results *res) {
AVFormatContext *s = NULL;
dakara_check_results_init(res);

int ret = avformat_open_input(&s, filepath, NULL, NULL);
if (ret < 0) {
fprintf(stderr, "failed to load file %s: %s\n", filepath, strerror(errno));
res->report.errors.io_error = true;
return res;
return;
}

dakara_check_avf(s, res);

avformat_close_input(&s);
avformat_free_context(s);

return res;
}

dakara_check_results *dakara_check_avio(size_t buffer_size, void *readable,
int (*read_packet)(void *, uint8_t *, int),
int64_t (*seek)(void *, int64_t, int),
dakara_check_results *res) {
void dakara_check_avio(size_t buffer_size, void *readable,
int (*read_packet)(void *, uint8_t *, int),
int64_t (*seek)(void *, int64_t, int), dakara_check_results *res) {
AVFormatContext *fmt_ctx = NULL;
AVIOContext *avio_ctx = NULL;
dakara_check_results_init(res);
Expand Down Expand Up @@ -162,8 +159,6 @@ dakara_check_results *dakara_check_avio(size_t buffer_size, void *readable,
av_freep(&avio_ctx->buffer);
avio_context_free(&avio_ctx);
}

return res;
}

char const *dakara_check_str_report(union dakara_check_results_report *report) {
Expand Down

0 comments on commit b99f2bf

Please sign in to comment.