diff options
Diffstat (limited to 'Source/WebKit/chromium/src/VideoFrameChromiumImpl.cpp')
-rw-r--r-- | Source/WebKit/chromium/src/VideoFrameChromiumImpl.cpp | 39 |
1 files changed, 24 insertions, 15 deletions
diff --git a/Source/WebKit/chromium/src/VideoFrameChromiumImpl.cpp b/Source/WebKit/chromium/src/VideoFrameChromiumImpl.cpp index 86545b7..27783ae 100644 --- a/Source/WebKit/chromium/src/VideoFrameChromiumImpl.cpp +++ b/Source/WebKit/chromium/src/VideoFrameChromiumImpl.cpp @@ -72,6 +72,14 @@ unsigned VideoFrameChromiumImpl::width() const return 0; } +unsigned VideoFrameChromiumImpl::width(unsigned plane) const +{ + unsigned planeWidth = width(); + if (format() == YV12 && plane != static_cast<unsigned>(yPlane)) + planeWidth /= 2; + return planeWidth; +} + unsigned VideoFrameChromiumImpl::height() const { if (m_webVideoFrame) @@ -79,6 +87,14 @@ unsigned VideoFrameChromiumImpl::height() const return 0; } +unsigned VideoFrameChromiumImpl::height(unsigned plane) const +{ + unsigned planeHeight = height(); + if (format() == YV12 && plane != static_cast<unsigned>(yPlane)) + planeHeight /= 2; + return planeHeight; +} + unsigned VideoFrameChromiumImpl::planes() const { if (m_webVideoFrame) @@ -109,21 +125,14 @@ unsigned VideoFrameChromiumImpl::texture(unsigned plane) const const IntSize VideoFrameChromiumImpl::requiredTextureSize(unsigned plane) const { - switch (format()) { - case RGBA: - case YV16: - return IntSize(stride(plane), height()); - case YV12: - if (plane == static_cast<unsigned>(yPlane)) - return IntSize(stride(plane), height()); - else if (plane == static_cast<unsigned>(uPlane)) - return IntSize(stride(plane), height() / 2); - else if (plane == static_cast<unsigned>(vPlane)) - return IntSize(stride(plane), height() / 2); - default: - break; - } - return IntSize(); + return IntSize(stride(plane), height(plane)); +} + +bool VideoFrameChromiumImpl::hasPaddingBytes(unsigned plane) const +{ + if (m_webVideoFrame) + return stride(plane) - width(plane) > 0; + return false; } } // namespace WebKit |