Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions src/scan.c
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,9 @@ int scan_file(const char *file, unsigned index) {
packet.size = buffer_size;

swr = swr_alloc();
if (swr == NULL){
fail_printf("unable to allocate memory fro SwrContext");
}

*ebur128 = ebur128_init(
ctx -> channels, ctx -> sample_rate,
Expand Down Expand Up @@ -436,8 +439,14 @@ static void scan_frame(ebur128_state *ebur128, AVFrame *frame,
out_size = av_samples_get_buffer_size(
&out_linesize, frame -> channels, frame -> nb_samples, out_fmt, 0
);
if (out_size < 0){
fail_printf("av_samples_get_buffer_size() failed with return code %d", out_size);
}

out_data = av_malloc(out_size);
if (out_data == NULL){
fail_printf("av_malloc failed to allocate memory");
}

if (swr_convert(
swr, (uint8_t**) &out_data, frame -> nb_samples,
Expand Down