Skip to content

Commit

Permalink
videosource: Always have an alignment of 4 when allocating images
Browse files Browse the repository at this point in the history
Works around a ridiculous silent API break in FFmpeg.

Fixes #256.

Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
  • Loading branch information
dwbuiten committed Feb 22, 2016
1 parent 75efc38 commit 829731e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/core/videosource.cpp
Expand Up @@ -157,7 +157,7 @@ FFMS_VideoSource::FFMS_VideoSource(const char *SourceFile, FFMS_Index &Index, in
LastDecodedFrame = av_frame_alloc();

// Dummy allocations so the unallocated case doesn't have to be handled later
if (av_image_alloc(SWSFrame.data, SWSFrame.linesize, 16, 16, FFMS_PIX_FMT(GRAY8), 1) < 0)
if (av_image_alloc(SWSFrame.data, SWSFrame.linesize, 16, 16, FFMS_PIX_FMT(GRAY8), 4) < 0)
throw FFMS_Exception(FFMS_ERROR_INDEX, FFMS_ERROR_ALLOCATION_FAILED,
"Could not allocate dummy frame.");

Expand Down Expand Up @@ -280,7 +280,7 @@ void FFMS_VideoSource::ReAdjustOutputFormat() {
}

av_freep(&SWSFrame.data[0]);
if (av_image_alloc(SWSFrame.data, SWSFrame.linesize, TargetWidth, TargetHeight, OutputFormat, 1) < 0)
if (av_image_alloc(SWSFrame.data, SWSFrame.linesize, TargetWidth, TargetHeight, OutputFormat, 4) < 0)
throw FFMS_Exception(FFMS_ERROR_SCALING, FFMS_ERROR_ALLOCATION_FAILED,
"Could not allocate frame with new resolution.");
}
Expand Down

0 comments on commit 829731e

Please sign in to comment.