From 7e75e564f8bc5090428814ca44f7885c6ed8c79d Mon Sep 17 00:00:00 2001 From: Stefano Ceccherini Date: Thu, 3 Jan 2013 21:49:30 +0100 Subject: [PATCH] Use av_alloc_put_byte() instead of ffio_init_context() since the latter expects an already allocated AVIOContext. BeScreenCapture works again, and should fix also #8299. --- src/add-ons/media/plugins/ffmpeg/AVFormatWriter.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/add-ons/media/plugins/ffmpeg/AVFormatWriter.cpp b/src/add-ons/media/plugins/ffmpeg/AVFormatWriter.cpp index 1e2bcfed7d..e12a958176 100644 --- a/src/add-ons/media/plugins/ffmpeg/AVFormatWriter.cpp +++ b/src/add-ons/media/plugins/ffmpeg/AVFormatWriter.cpp @@ -363,11 +363,12 @@ AVFormatWriter::Init(const media_file_format* fileFormat) if (buffer == NULL) return B_NO_MEMORY; - // Init I/O context with buffer and hook functions, pass ourself as - // cookie. - if (init_put_byte(fIOContext, buffer, kIOBufferSize, 1, this, - 0, _Write, _Seek) != 0) { - TRACE(" init_put_byte() failed!\n"); + // Allocate I/O context and initialize it with buffer + // and hook functions, pass ourself as cookie. + fIOContext = av_alloc_put_byte(buffer, kIOBufferSize, 1, this, + 0, _Write, _Seek); + if (fIOContext == NULL) { + TRACE("av_alloc_put_byte() failed!\n"); return B_ERROR; }