mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-27 21:35:24 +00:00
Merge branch 'videoplayback' of https://github.com/ChrisKCat/openmw into videoplayback
This commit is contained in:
commit
18623a5efe
@ -854,20 +854,20 @@ void VideoState::init(const std::string& resourceName)
|
|||||||
if(this->stream.isNull())
|
if(this->stream.isNull())
|
||||||
throw std::runtime_error("Failed to open video resource");
|
throw std::runtime_error("Failed to open video resource");
|
||||||
|
|
||||||
|
AVIOContext *ioCtx = avio_alloc_context(NULL, 0, 0, this, OgreResource_Read, OgreResource_Write, OgreResource_Seek);
|
||||||
|
if(!ioCtx) throw std::runtime_error("Failed to allocate AVIOContext");
|
||||||
|
|
||||||
this->format_ctx = avformat_alloc_context();
|
this->format_ctx = avformat_alloc_context();
|
||||||
this->format_ctx->pb = avio_alloc_context(NULL, 0, 0, this, OgreResource_Read, OgreResource_Write, OgreResource_Seek);
|
if(this->format_ctx)
|
||||||
if(!this->format_ctx->pb)
|
this->format_ctx->pb = ioCtx;
|
||||||
{
|
|
||||||
avformat_free_context(this->format_ctx);
|
|
||||||
throw std::runtime_error("Failed to allocate ioContext ");
|
|
||||||
}
|
|
||||||
|
|
||||||
// Open video file
|
// Open video file
|
||||||
/// \todo leak here, ffmpeg or valgrind bug ?
|
/// \todo leak here, ffmpeg or valgrind bug ?
|
||||||
if (avformat_open_input(&this->format_ctx, resourceName.c_str(), NULL, NULL))
|
if(!this->format_ctx || avformat_open_input(&this->format_ctx, resourceName.c_str(), NULL, NULL))
|
||||||
{
|
{
|
||||||
// "Note that a user-supplied AVFormatContext will be freed on failure."
|
// "Note that a user-supplied AVFormatContext will be freed on failure."
|
||||||
this->format_ctx = NULL;
|
this->format_ctx = NULL;
|
||||||
|
av_free(ioCtx);
|
||||||
throw std::runtime_error("Failed to open video input");
|
throw std::runtime_error("Failed to open video input");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user