From d88596e13cb37fee5234522fc41e8702196f0558 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Wed, 11 Jan 2012 00:43:24 -0800 Subject: There's no need to pass a buffer to avio_alloc_context --- examples/alffmpeg.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) (limited to 'examples') diff --git a/examples/alffmpeg.c b/examples/alffmpeg.c index d4d70527..2c10efb1 100644 --- a/examples/alffmpeg.c +++ b/examples/alffmpeg.c @@ -194,14 +194,13 @@ FilePtr openAVData(const char *name, char *buffer, size_t buffer_len) file = (FilePtr)calloc(1, sizeof(*file)); if(file && (file->FmtCtx=avformat_alloc_context()) != NULL) { - static const int buflen = 4096; - file->membuf.buffer = buffer; file->membuf.length = buffer_len; file->membuf.pos = 0; - file->FmtCtx->pb = avio_alloc_context(av_malloc(buflen), buflen, 1, &file->membuf, - MemData_read, MemData_write, MemData_seek); + file->FmtCtx->pb = avio_alloc_context(NULL, 0, 0, &file->membuf, + MemData_read, MemData_write, + MemData_seek); if(file->FmtCtx->pb && avformat_open_input(&file->FmtCtx, name, NULL, NULL) == 0) { if(av_find_stream_info(file->FmtCtx) >= 0) @@ -231,9 +230,7 @@ FilePtr openAVCustom(const char *name, void *user_data, file = (FilePtr)calloc(1, sizeof(*file)); if(file && (file->FmtCtx=avformat_alloc_context()) != NULL) { - static const int buflen = 4096; - - file->FmtCtx->pb = avio_alloc_context(av_malloc(buflen), buflen, 1, user_data, + file->FmtCtx->pb = avio_alloc_context(NULL, 0, 0, user_data, read_packet, write_packet, seek); if(file->FmtCtx->pb && avformat_open_input(&file->FmtCtx, name, NULL, NULL) == 0) { -- cgit v1.2.3