• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright (c) 2011 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.
4 
5 #ifndef PICTURE_H_
6 #define PICTURE_H_
7 
8 #include <stdint.h>
9 
10 #include <vector>
11 
12 #include "rect.h"
13 #include "size.h"
14 #include "video_pixel_format.h"
15 
16 namespace media {
17 
18 // A picture buffer that has size and pixel format information.
19 class PictureBuffer {
20  public:
21   PictureBuffer(int32_t id, const Size& size);
22   PictureBuffer(int32_t id,
23                 const Size& size,
24                 VideoPixelFormat pixel_format);
25   PictureBuffer(const PictureBuffer& other);
26   ~PictureBuffer();
27 
28   // Returns the client-specified id of the buffer.
id()29   int32_t id() const { return id_; }
30 
31   // Returns the size of the buffer.
size()32   Size size() const { return size_; }
33 
set_size(const Size & size)34   void set_size(const Size& size) { size_ = size; }
35 
pixel_format()36   VideoPixelFormat pixel_format() const { return pixel_format_; }
37 
38  private:
39   int32_t id_;
40   Size size_;
41   VideoPixelFormat pixel_format_ = PIXEL_FORMAT_UNKNOWN;
42 };
43 
44 // A decoded picture frame.
45 class Picture {
46  public:
47   Picture(int32_t picture_buffer_id,
48           int32_t bitstream_buffer_id,
49           const Rect& visible_rect,
50           bool allow_overlay);
51   Picture(const Picture&);
52   ~Picture();
53 
54   // Returns the id of the picture buffer where this picture is contained.
picture_buffer_id()55   int32_t picture_buffer_id() const { return picture_buffer_id_; }
56 
57   // Returns the id of the bitstream buffer from which this frame was decoded.
bitstream_buffer_id()58   int32_t bitstream_buffer_id() const { return bitstream_buffer_id_; }
59 
set_bitstream_buffer_id(int32_t bitstream_buffer_id)60   void set_bitstream_buffer_id(int32_t bitstream_buffer_id) {
61     bitstream_buffer_id_ = bitstream_buffer_id;
62   }
63 
64   // Returns the visible rectangle of the picture. Its size may be smaller
65   // than the size of the PictureBuffer, as it is the only visible part of the
66   // Picture contained in the PictureBuffer.
visible_rect()67   Rect visible_rect() const { return visible_rect_; }
68 
allow_overlay()69   bool allow_overlay() const { return allow_overlay_; }
70 
71  private:
72   int32_t picture_buffer_id_;
73   int32_t bitstream_buffer_id_;
74   Rect visible_rect_;
75   bool allow_overlay_;
76 };
77 
78 }  // namespace media
79 
80 #endif  // PICTURE_H_
81