OLD | NEW |
---|---|
(Empty) | |
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. | |
4 | |
5 #ifndef WEBKIT_MEDIA_CRYPTO_PPAPI_FFMPEG_CDM_VIDEO_FRAME_H_ | |
6 #define WEBKIT_MEDIA_CRYPTO_PPAPI_FFMPEG_CDM_VIDEO_FRAME_H_ | |
7 | |
8 #include "base/basictypes.h" | |
9 #include "base/compiler_specific.h" | |
10 #include "webkit/media/crypto/ppapi/content_decryption_module.h" | |
11 | |
12 namespace webkit_media { | |
13 | |
14 // Allocates storage for video frames using cdm::Allocator, and contains all | |
15 // the information necessary to read and write the video frame data. | |
16 class FFmpegCdmVideoFrame { | |
17 public: | |
18 ~FFmpegCdmVideoFrame(); | |
19 // Returns a pointer to FFmpegCdmVideoFrame of the specified |format| and | |
ddorwin
2012/10/16 18:04:30
newline before the comment.
Tom Finegan
2012/10/16 21:44:44
Done.
| |
20 // |size|. Returns NULL on failure. | |
21 static FFmpegCdmVideoFrame* Create(cdm::Allocator* allocator, | |
22 cdm::VideoFormat format, | |
23 const cdm::Size& size); | |
24 | |
25 cdm::VideoFormat format() const; | |
26 cdm::Buffer* frame_buffer(); | |
27 const cdm::Size& size() const; | |
28 int32_t plane_offset(cdm::VideoFrame::VideoPlane plane); | |
ddorwin
2012/10/16 18:04:30
const on both these accessors?
Tom Finegan
2012/10/16 21:44:44
Done.
| |
29 int32_t stride(cdm::VideoFrame::VideoPlane plane); | |
30 | |
31 // Releases ownership of |frame_buffer_| to caller. | |
32 cdm::Buffer* ReleaseCdmBuffer(); | |
33 | |
34 private: | |
35 // Clients must use the static Create() method to create a new frame. | |
36 FFmpegCdmVideoFrame(cdm::VideoFormat format, const cdm::Size& size); | |
37 | |
38 // Allocates a YUV video frame buffer of type |format_| using |size_|. | |
39 // Returns true when the frame buffer is successfully allocated. Returns | |
40 // false otherwise. | |
41 bool AllocateYUV(cdm::Allocator* allocator); | |
42 | |
43 // The video buffer format. | |
44 cdm::VideoFormat format_; | |
45 | |
46 // Width and height of the video frame. | |
47 cdm::Size size_; | |
48 | |
49 // The video frame buffer. Owned by FFmpegCdmVideoFrame until | |
50 // ReleaseCdmBuffer() is called. | |
51 cdm::Buffer* frame_buffer_; | |
ddorwin
2012/10/16 18:04:30
scoped_ptr?
Tom Finegan
2012/10/16 21:44:44
Discussed offline. Same issue as w/the FFmpeg obje
| |
52 | |
53 // Array of data pointers to each plane in the video frame buffer. | |
54 int32_t plane_offsets_[cdm::VideoFrame::kMaxPlanes]; | |
55 | |
56 // Array of strides for each plane, typically greater or equal to the width | |
57 // of the surface divided by the horizontal sampling period. Note that | |
58 // strides can be negative. | |
59 int32_t strides_[cdm::VideoFrame::kMaxPlanes]; | |
60 | |
61 DISALLOW_COPY_AND_ASSIGN(FFmpegCdmVideoFrame); | |
62 }; | |
63 | |
64 } // namespace webkit_media | |
65 | |
66 #endif // WEBKIT_MEDIA_CRYPTO_PPAPI_FFMPEG_CDM_VIDEO_FRAME_H_ | |
OLD | NEW |