X-Git-Url: http://git.tuebingen.mpg.de/?a=blobdiff_plain;f=mp4.c;h=f8515ca290681a271155e9749d903ea9214b9b13;hb=be5daec66f163725489f42d512659a8af5c3fd59;hp=4b8607b185a9a87c845940d86412843654a13c7d;hpb=b142089267ef501e438c3dc77ecf19bead3d4e58;p=paraslash.git diff --git a/mp4.c b/mp4.c index 4b8607b1..f8515ca2 100644 --- a/mp4.c +++ b/mp4.c @@ -240,7 +240,7 @@ static int read_stsz(struct mp4 *f) return ret; if (t->stsz_sample_size != 0) return 1; - t->stsz_table = para_malloc(t->stsz_sample_count * sizeof(int32_t)); + t->stsz_table = arr_alloc(t->stsz_sample_count, sizeof(int32_t)); for (uint32_t n = 0; n < t->stsz_sample_count; n++) { ret = read_int32(f, &t->stsz_table[n]); if (ret <= 0) @@ -260,8 +260,7 @@ static int read_stts(struct mp4 *f) ret = read_int32(f, &t->stts_entry_count); if (ret <= 0) return ret; - t->stts_sample_count = para_malloc(t->stts_entry_count - * sizeof(int32_t)); + t->stts_sample_count = arr_alloc(t->stts_entry_count, sizeof(int32_t)); for (uint32_t n = 0; n < t->stts_entry_count; n++) { ret = read_int32(f, &t->stts_sample_count[n]); if (ret <= 0) @@ -284,9 +283,9 @@ static int read_stsc(struct mp4 *f) ret = read_int32(f, &t->stsc_entry_count); if (ret <= 0) return ret; - t->stsc_first_chunk = para_malloc(t->stsc_entry_count * sizeof(int32_t)); - t->stsc_samples_per_chunk = para_malloc(t->stsc_entry_count - * sizeof (int32_t)); + t->stsc_first_chunk = arr_alloc(t->stsc_entry_count, sizeof(int32_t)); + t->stsc_samples_per_chunk = arr_alloc(t->stsc_entry_count, + sizeof (int32_t)); for (uint32_t n = 0; n < t->stsc_entry_count; n++) { ret = read_int32(f, &t->stsc_first_chunk[n]); if (ret <= 0) @@ -310,8 +309,7 @@ static int read_stco(struct mp4 *f) ret = read_int32(f, &t->stco_entry_count); if (ret <= 0) return ret; - t->stco_chunk_offset = para_malloc(t->stco_entry_count - * sizeof(int32_t)); + t->stco_chunk_offset = arr_alloc(t->stco_entry_count, sizeof(int32_t)); for (uint32_t n = 0; n < t->stco_entry_count; n++) { ret = read_int32(f, &t->stco_chunk_offset[n]); if (ret <= 0) @@ -396,7 +394,7 @@ static int parse_tag(struct mp4 *f, uint8_t parent, int32_t size) goto fail; len = subsize - (header_size + 8); free(value); - value = para_malloc(len + 1); + value = alloc(len + 1); ret = read_data(f, value, len); if (ret <= 0) goto fail; @@ -609,7 +607,7 @@ static int open_file(const struct mp4_callback *cb, bool meta_only, struct mp4 * int ret; uint64_t size; uint8_t atom_type, header_size; - struct mp4 *f = para_calloc(sizeof(*f)); + struct mp4 *f = zalloc(sizeof(*f)); f->cb = cb; while ((ret = atom_read_header(f, &atom_type, &header_size, &size)) > 0) { @@ -918,7 +916,7 @@ static void *modify_moov(struct mp4 *f, uint32_t *out_size) new_ilst_size += TAG_LEN(strlen(f->meta.tags[n].value)); size_delta = new_ilst_size - (f->ilst_size - 8); *out_size = total_size + size_delta; - out_buffer = para_malloc(*out_size); + out_buffer = alloc(*out_size); p_out = out_buffer; set_position(f, total_base); ret = read_data(f, p_out, f->udta_offset - total_base);