Fix leak when a PeerConnection offer or answer is created.
[chromium-blink-merge.git] / media / video / picture.h
blobd5be2276f2be78ad037bfd045798ebd7f629defb
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.
5 #ifndef MEDIA_VIDEO_PICTURE_H_
6 #define MEDIA_VIDEO_PICTURE_H_
8 #include "base/basictypes.h"
9 #include "gpu/command_buffer/common/mailbox.h"
10 #include "media/base/media_export.h"
11 #include "ui/gfx/size.h"
13 namespace media {
15 // A picture buffer that is composed of a GLES2 texture.
16 // This is the media-namespace equivalent of PP_PictureBuffer_Dev.
17 class MEDIA_EXPORT PictureBuffer {
18 public:
19 PictureBuffer(int32 id, gfx::Size size, uint32 texture_id);
20 PictureBuffer(int32 id,
21 gfx::Size size,
22 uint32 texture_id,
23 const gpu::Mailbox& texture_mailbox);
25 // Returns the client-specified id of the buffer.
26 int32 id() const {
27 return id_;
30 // Returns the size of the buffer.
31 gfx::Size size() const {
32 return size_;
35 // Returns the id of the texture.
36 // NOTE: The texture id in the renderer process corresponds to a different
37 // texture id in the GPU process.
38 uint32 texture_id() const {
39 return texture_id_;
42 const gpu::Mailbox& texture_mailbox() const {
43 return texture_mailbox_;
46 private:
47 int32 id_;
48 gfx::Size size_;
49 uint32 texture_id_;
50 gpu::Mailbox texture_mailbox_;
53 // A decoded picture frame.
54 // This is the media-namespace equivalent of PP_Picture_Dev.
55 class MEDIA_EXPORT Picture {
56 public:
57 Picture(int32 picture_buffer_id, int32 bitstream_buffer_id);
59 // Returns the id of the picture buffer where this picture is contained.
60 int32 picture_buffer_id() const {
61 return picture_buffer_id_;
64 // Returns the id of the bitstream buffer from which this frame was decoded.
65 int32 bitstream_buffer_id() const {
66 return bitstream_buffer_id_;
69 void set_bitstream_buffer_id(int32 bitstream_buffer_id) {
70 bitstream_buffer_id_ = bitstream_buffer_id;
73 private:
74 int32 picture_buffer_id_;
75 int32 bitstream_buffer_id_;
78 } // namespace media
80 #endif // MEDIA_VIDEO_PICTURE_H_