Fri, 16 Jan 2015 04:50:19 +0100
Replace accessor implementation with direct member state manipulation, by
request https://trac.torproject.org/projects/tor/ticket/9701#comment:32
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
3 // found in the LICENSE file.
5 #ifndef MEDIA_BASE_VIDEO_UTIL_H_
6 #define MEDIA_BASE_VIDEO_UTIL_H_
8 #include "mp4_demuxer/basictypes.h"
10 namespace mp4_demuxer {
12 class VideoFrame;
14 // Computes the size of |visible_size| for a given aspect ratio.
15 IntSize GetNaturalSize(const IntSize& visible_size,
16 int aspect_ratio_numerator,
17 int aspect_ratio_denominator);
18 /*
19 // Copies a plane of YUV(A) source into a VideoFrame object, taking into account
20 // source and destinations dimensions.
21 //
22 // NOTE: rows is *not* the same as height!
23 void CopyYPlane(const uint8_t* source, int stride, int rows,
24 VideoFrame* frame);
25 void CopyUPlane(const uint8_t* source, int stride, int rows,
26 VideoFrame* frame);
27 void CopyVPlane(const uint8_t* source, int stride, int rows,
28 VideoFrame* frame);
29 void CopyAPlane(const uint8_t* source, int stride, int rows,
30 VideoFrame* frame);
32 // Sets alpha plane values to be completely opaque (all 255's).
33 void MakeOpaqueAPlane(int stride, int rows, VideoFrame* frame);
35 // |plane| is one of VideoFrame::kYPlane, VideoFrame::kUPlane,
36 // VideoFrame::kVPlane or VideoFrame::kAPlane
37 void CopyPlane(size_t plane, const uint8_t* source, int stride,
38 int rows, VideoFrame* frame);
41 // Fills |frame| containing YUV data to the given color values.
42 void FillYUV(VideoFrame* frame, uint8_t y, uint8_t u, uint8_t v);
44 // Creates a border in |frame| such that all pixels outside of
45 // |view_area| are black. The size and position of |view_area|
46 // must be even to align correctly with the color planes.
47 // Only YV12 format video frames are currently supported.
48 void LetterboxYUV(VideoFrame* frame,
49 const gfx::Rect& view_area);
51 // Rotates |src| plane by |rotation| degree with possible flipping vertically
52 // and horizontally.
53 // |rotation| is limited to {0, 90, 180, 270}.
54 // |width| and |height| are expected to be even numbers.
55 // Both |src| and |dest| planes are packed and have same |width| and |height|.
56 // When |width| != |height| and rotated by 90/270, only the maximum square
57 // portion located in the center is rotated. For example, for width=640 and
58 // height=480, the rotated area is 480x480 located from row 0 through 479 and
59 // from column 80 through 559. The leftmost and rightmost 80 columns are
60 // ignored for both |src| and |dest|.
61 // The caller is responsible for blanking out the margin area.
62 void RotatePlaneByPixels(
63 const uint8_t* src,
64 uint8_t* dest,
65 int width,
66 int height,
67 int rotation, // Clockwise.
68 bool flip_vert,
69 bool flip_horiz);
71 // Return the largest centered rectangle with the same aspect ratio of |content|
72 // that fits entirely inside of |bounds|.
73 gfx::Rect ComputeLetterboxRegion(const gfx::Rect& bounds,
74 const IntSize& content);
76 // Copy an RGB bitmap into the specified |region_in_frame| of a YUV video frame.
77 // Fills the regions outside |region_in_frame| with black.
78 void CopyRGBToVideoFrame(const uint8_t* source,
79 int stride,
80 const gfx::Rect& region_in_frame,
81 VideoFrame* frame);
82 */
84 } // namespace mp4_demuxer
86 #endif // MEDIA_BASE_VIDEO_UTIL_H_