| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 return Invalid; | 65 return Invalid; |
| 66 } | 66 } |
| 67 | 67 |
| 68 unsigned VideoFrameChromiumImpl::width() const | 68 unsigned VideoFrameChromiumImpl::width() const |
| 69 { | 69 { |
| 70 if (m_webVideoFrame) | 70 if (m_webVideoFrame) |
| 71 return m_webVideoFrame->width(); | 71 return m_webVideoFrame->width(); |
| 72 return 0; | 72 return 0; |
| 73 } | 73 } |
| 74 | 74 |
| 75 unsigned VideoFrameChromiumImpl::width(unsigned plane) const |
| 76 { |
| 77 unsigned planeWidth = width(); |
| 78 if (format() == YV12 && plane != static_cast<unsigned>(yPlane)) |
| 79 planeWidth /= 2; |
| 80 return planeWidth; |
| 81 } |
| 82 |
| 75 unsigned VideoFrameChromiumImpl::height() const | 83 unsigned VideoFrameChromiumImpl::height() const |
| 76 { | 84 { |
| 77 if (m_webVideoFrame) | 85 if (m_webVideoFrame) |
| 78 return m_webVideoFrame->height(); | 86 return m_webVideoFrame->height(); |
| 79 return 0; | 87 return 0; |
| 80 } | 88 } |
| 81 | 89 |
| 90 unsigned VideoFrameChromiumImpl::height(unsigned plane) const |
| 91 { |
| 92 unsigned planeHeight = height(); |
| 93 if (format() == YV12 && plane != static_cast<unsigned>(yPlane)) |
| 94 planeHeight /= 2; |
| 95 return planeHeight; |
| 96 } |
| 97 |
| 82 unsigned VideoFrameChromiumImpl::planes() const | 98 unsigned VideoFrameChromiumImpl::planes() const |
| 83 { | 99 { |
| 84 if (m_webVideoFrame) | 100 if (m_webVideoFrame) |
| 85 return m_webVideoFrame->planes(); | 101 return m_webVideoFrame->planes(); |
| 86 return 0; | 102 return 0; |
| 87 } | 103 } |
| 88 | 104 |
| 89 int VideoFrameChromiumImpl::stride(unsigned plane) const | 105 int VideoFrameChromiumImpl::stride(unsigned plane) const |
| 90 { | 106 { |
| 91 if (m_webVideoFrame) | 107 if (m_webVideoFrame) |
| (...skipping 10 matching lines...) Expand all Loading... |
| 102 | 118 |
| 103 unsigned VideoFrameChromiumImpl::texture(unsigned plane) const | 119 unsigned VideoFrameChromiumImpl::texture(unsigned plane) const |
| 104 { | 120 { |
| 105 if (m_webVideoFrame) | 121 if (m_webVideoFrame) |
| 106 return m_webVideoFrame->texture(plane); | 122 return m_webVideoFrame->texture(plane); |
| 107 return 0; | 123 return 0; |
| 108 } | 124 } |
| 109 | 125 |
| 110 const IntSize VideoFrameChromiumImpl::requiredTextureSize(unsigned plane) const | 126 const IntSize VideoFrameChromiumImpl::requiredTextureSize(unsigned plane) const |
| 111 { | 127 { |
| 112 switch (format()) { | 128 return IntSize(stride(plane), height(plane)); |
| 113 case RGBA: | 129 } |
| 114 case YV16: | 130 |
| 115 return IntSize(stride(plane), height()); | 131 bool VideoFrameChromiumImpl::hasPaddingBytes(unsigned plane) const |
| 116 case YV12: | 132 { |
| 117 if (plane == static_cast<unsigned>(yPlane)) | 133 if (m_webVideoFrame) |
| 118 return IntSize(stride(plane), height()); | 134 return stride(plane) - width(plane) > 0; |
| 119 else if (plane == static_cast<unsigned>(uPlane)) | 135 return false; |
| 120 return IntSize(stride(plane), height() / 2); | |
| 121 else if (plane == static_cast<unsigned>(vPlane)) | |
| 122 return IntSize(stride(plane), height() / 2); | |
| 123 default: | |
| 124 break; | |
| 125 } | |
| 126 return IntSize(); | |
| 127 } | 136 } |
| 128 | 137 |
| 129 } // namespace WebKit | 138 } // namespace WebKit |
| OLD | NEW |