Mercurial > libavformat.hg
changeset 3671:cdd58525b41c libavformat
matroskadec: use an EbmlBin as parameter to ebml_read_binary()
author | aurel |
---|---|
date | Tue, 05 Aug 2008 00:41:59 +0000 |
parents | 04b4e89c09d6 |
children | e630d4110478 |
files | matroskadec.c |
diffstat | 1 files changed, 7 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- a/matroskadec.c Tue Aug 05 00:41:55 2008 +0000 +++ b/matroskadec.c Tue Aug 05 00:41:59 2008 +0000 @@ -688,14 +688,15 @@ static int ebml_read_binary (ByteIOContext *pb, int length, - uint8_t **binary, - int *size) + EbmlBin *bin) { - if (!(*binary = av_malloc(length))) + av_free(bin->data); + if (!(bin->data = av_malloc(length))) return AVERROR(ENOMEM); - *size = length; - if (get_buffer(pb, *binary, length) != length) + bin->size = length; + bin->pos = url_ftell(pb); + if (get_buffer(pb, bin->data, length) != length) return AVERROR(EIO); return 0; @@ -896,7 +897,6 @@ ByteIOContext *pb = matroska->ctx->pb; uint32_t id = syntax->id; uint64_t length; - EbmlBin *bin; int res; data = (char *)data + syntax->data_offset; @@ -907,7 +907,6 @@ memset(data, 0, syntax->list_elem_size); list->nb_elem++; } - bin = data; if (syntax->type != EBML_PASS && syntax->type != EBML_STOP) if ((res = ebml_read_element_id(matroska, &id)) < 0 || @@ -919,10 +918,7 @@ case EBML_FLOAT: res = ebml_read_float (pb, length, data); break; case EBML_STR: case EBML_UTF8: res = ebml_read_ascii (pb, length, data); break; - case EBML_BIN: av_free(bin->data); - bin->pos = url_ftell(matroska->ctx->pb); - res = ebml_read_binary(pb, length, &bin->data, - &bin->size); break; + case EBML_BIN: res = ebml_read_binary(pb, length, data); break; case EBML_NEST: if ((res=ebml_read_master(matroska, length)) < 0) return res; if (id == MATROSKA_ID_SEGMENT)