| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef MEDIA_BASE_VIDEO_UTIL_H_ | 5 #ifndef MEDIA_BASE_VIDEO_UTIL_H_ |
| 6 #define MEDIA_BASE_VIDEO_UTIL_H_ | 6 #define MEDIA_BASE_VIDEO_UTIL_H_ |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "media/base/media_export.h" | 9 #include "media/base/media_export.h" |
| 10 #include "ui/gfx/rect.h" | 10 #include "ui/gfx/rect.h" |
| 11 #include "ui/gfx/size.h" | 11 #include "ui/gfx/size.h" |
| 12 | 12 |
| 13 namespace media { | 13 namespace media { |
| 14 | 14 |
| 15 class VideoFrame; | 15 class VideoFrame; |
| 16 | 16 |
| 17 // Computes the size of |visible_size| for a given aspect ratio. | 17 // Computes the size of |visible_size| for a given aspect ratio. |
| 18 MEDIA_EXPORT gfx::Size GetNaturalSize(const gfx::Size& visible_size, | 18 MEDIA_EXPORT gfx::Size GetNaturalSize(const gfx::Size& visible_size, |
| 19 int aspect_ratio_numerator, | 19 int aspect_ratio_numerator, |
| 20 int aspect_ratio_denominator); | 20 int aspect_ratio_denominator); |
| 21 | 21 |
| 22 // Copies a plane of YUV(A) source into a VideoFrame object, taking into account | 22 // Copies a plane of YUV source into a VideoFrame object, taking into account |
| 23 // source and destinations dimensions. | 23 // source and destinations dimensions. |
| 24 // | 24 // |
| 25 // NOTE: rows is *not* the same as height! | 25 // NOTE: rows is *not* the same as height! |
| 26 MEDIA_EXPORT void CopyYPlane(const uint8* source, int stride, int rows, | 26 MEDIA_EXPORT void CopyYPlane(const uint8* source, int stride, int rows, |
| 27 VideoFrame* frame); | 27 VideoFrame* frame); |
| 28 MEDIA_EXPORT void CopyUPlane(const uint8* source, int stride, int rows, | 28 MEDIA_EXPORT void CopyUPlane(const uint8* source, int stride, int rows, |
| 29 VideoFrame* frame); | 29 VideoFrame* frame); |
| 30 MEDIA_EXPORT void CopyVPlane(const uint8* source, int stride, int rows, | 30 MEDIA_EXPORT void CopyVPlane(const uint8* source, int stride, int rows, |
| 31 VideoFrame* frame); | 31 VideoFrame* frame); |
| 32 MEDIA_EXPORT void CopyAPlane(const uint8* source, int stride, int rows, | |
| 33 VideoFrame* frame); | |
| 34 | |
| 35 // Sets alpha plane values to be completely opaque (all 255's). | |
| 36 MEDIA_EXPORT void MakeOpaqueAPlane(int stride, int rows, VideoFrame* frame); | |
| 37 | |
| 38 // |plane| is one of VideoFrame::kYPlane, VideoFrame::kUPlane, | 32 // |plane| is one of VideoFrame::kYPlane, VideoFrame::kUPlane, |
| 39 // VideoFrame::kVPlane or VideoFrame::kAPlane | 33 // or VideoFrame::kVPlane. |
| 40 MEDIA_EXPORT void CopyPlane(size_t plane, const uint8* source, int stride, | 34 MEDIA_EXPORT void CopyPlane(size_t plane, const uint8* source, int stride, |
| 41 int rows, VideoFrame* frame); | 35 int rows, VideoFrame* frame); |
| 42 | 36 |
| 43 | 37 |
| 44 // Fills |frame| containing YUV data to the given color values. | 38 // Fills |frame| containing YUV data to the given color values. |
| 45 MEDIA_EXPORT void FillYUV(VideoFrame* frame, uint8 y, uint8 u, uint8 v); | 39 MEDIA_EXPORT void FillYUV(VideoFrame* frame, uint8 y, uint8 u, uint8 v); |
| 46 | 40 |
| 47 // Creates a border in |frame| such that all pixels outside of | 41 // Creates a border in |frame| such that all pixels outside of |
| 48 // |view_area| are black. The size and position of |view_area| | 42 // |view_area| are black. The size and position of |view_area| |
| 49 // must be even to align correctly with the color planes. | 43 // must be even to align correctly with the color planes. |
| (...skipping 29 matching lines...) Expand all Loading... |
| 79 // Copy an RGB bitmap into the specified |region_in_frame| of a YUV video frame. | 73 // Copy an RGB bitmap into the specified |region_in_frame| of a YUV video frame. |
| 80 // Fills the regions outside |region_in_frame| with black. | 74 // Fills the regions outside |region_in_frame| with black. |
| 81 MEDIA_EXPORT void CopyRGBToVideoFrame(const uint8* source, | 75 MEDIA_EXPORT void CopyRGBToVideoFrame(const uint8* source, |
| 82 int stride, | 76 int stride, |
| 83 const gfx::Rect& region_in_frame, | 77 const gfx::Rect& region_in_frame, |
| 84 VideoFrame* frame); | 78 VideoFrame* frame); |
| 85 | 79 |
| 86 } // namespace media | 80 } // namespace media |
| 87 | 81 |
| 88 #endif // MEDIA_BASE_VIDEO_UTIL_H_ | 82 #endif // MEDIA_BASE_VIDEO_UTIL_H_ |
| OLD | NEW |