[NUT-devel] [nut]: r191 - trunk/libnut/demuxer.c
ods15
subversion at mplayerhq.hu
Mon Nov 6 21:17:50 CET 2006
Author: ods15
Date: Mon Nov 6 21:17:50 2006
New Revision: 191
Modified:
trunk/libnut/demuxer.c
Log:
make get_vb() work by mallocing only once and also work if buffer is static.
change header init to just memset all fields to zero as now *_len will have to be zero
Modified: trunk/libnut/demuxer.c
==============================================================================
--- trunk/libnut/demuxer.c (original)
+++ trunk/libnut/demuxer.c Mon Nov 6 21:17:50 2006
@@ -205,9 +205,11 @@
uint64_t tmp;
int err;
if ((err = get_v(in, &tmp))) return err;
+ if (!*len) {
+ *buf = alloc->malloc(tmp);
+ if (!*buf) return -ERR_OUT_OF_MEM;
+ } else if (*len < tmp) return -ERR_OUT_OF_MEM;
*len = tmp;
- *buf = alloc->realloc(*buf, *len);
- if (!*buf) return -ERR_OUT_OF_MEM;
if (get_data(in, *len, *buf) != *len) return buf_eof(in);
return 0;
}
@@ -746,16 +748,7 @@
ERROR(SIZE_MAX/sizeof(stream_context_t) < nut->stream_count+1, -ERR_OUT_OF_MEM);
nut->sc = nut->alloc->malloc(sizeof(stream_context_t) * nut->stream_count);
ERROR(!nut->sc, -ERR_OUT_OF_MEM);
- for (i = 0; i < nut->stream_count; i++) {
- nut->sc[i].last_pts = 0;
- nut->sc[i].last_dts = 0;
- nut->sc[i].last_key = 0;
- nut->sc[i].eor = 0;
- nut->sc[i].sh.max_pts = 0;
- nut->sc[i].sh.fourcc = NULL;
- nut->sc[i].sh.codec_specific = NULL;
- nut->sc[i].pts_cache = NULL;
- }
+ memset(nut->sc, 0, sizeof(stream_context_t) * nut->stream_count);
}
for (i = 0; i < nut->stream_count; i++) {
More information about the NUT-devel
mailing list