Skip to content

Commit

Permalink
MMAL: Add hevc support by allowing 4 planes
Browse files Browse the repository at this point in the history
  • Loading branch information
popcornmix committed Jul 14, 2017
1 parent 76df766 commit 39bd7d3
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
4 changes: 3 additions & 1 deletion xbmc/cores/VideoPlayer/DVDCodecs/Video/MMALFFmpeg.cpp
Expand Up @@ -96,6 +96,8 @@ void CMMALYUVBuffer::GetStrides(int(&strides)[YuvImage::MAX_PLANES])
strides[0] = geo.stride_y;
strides[1] = geo.stride_c;
strides[2] = geo.stride_c;
if (geo.stripes > 1)
strides[3] = geo.height_y + geo.height_c; // abuse: strides[3] = stripe stride
}

void CMMALYUVBuffer::SetDimensions(int width, int height, const int (&strides)[YuvImage::MAX_PLANES])
Expand Down Expand Up @@ -273,7 +275,7 @@ CDVDVideoCodec::VCReturn CDecoder::Decode(AVCodecContext* avctx, AVFrame* frame)

if (frame)
{
if ((frame->format != AV_PIX_FMT_YUV420P && frame->format != AV_PIX_FMT_BGR0 && frame->format != AV_PIX_FMT_RGB565LE) ||
if ((frame->format != AV_PIX_FMT_YUV420P && frame->format != AV_PIX_FMT_SAND128 && frame->format != AV_PIX_FMT_BGR0 && frame->format != AV_PIX_FMT_RGB565LE) ||
frame->buf[1] != nullptr || frame->buf[0] == nullptr)
{
CLog::Log(LOGERROR, "%s::%s frame format invalid format:%d buf:%p,%p", CLASSNAME, __func__, frame->format, frame->buf[0], frame->buf[1]);
Expand Down
2 changes: 1 addition & 1 deletion xbmc/cores/VideoPlayer/Process/VideoBuffer.h
Expand Up @@ -32,7 +32,7 @@ extern "C" {

struct YuvImage
{
static const int MAX_PLANES = 3;
static const int MAX_PLANES = 4;

uint8_t* plane[MAX_PLANES];
int planesize[MAX_PLANES];
Expand Down
Expand Up @@ -199,6 +199,7 @@ CMMALPool::~CMMALPool()
std::vector<CMMALPool::MMALEncodingTable> CMMALPool::mmal_encoding_table =
{
{ AV_PIX_FMT_YUV420P, MMAL_ENCODING_I420 },
{ AV_PIX_FMT_SAND128, MMAL_ENCODING_YUVUV128 },
{ AV_PIX_FMT_RGBA, MMAL_ENCODING_RGBA, },
{ AV_PIX_FMT_BGRA, MMAL_ENCODING_BGRA },
{ AV_PIX_FMT_RGB0, MMAL_ENCODING_RGBA },
Expand Down

0 comments on commit 39bd7d3

Please sign in to comment.