Index: webkit/media/crypto/ppapi/ffmpeg_cdm_video_frame.h |
diff --git a/webkit/media/crypto/ppapi/ffmpeg_cdm_video_frame.h b/webkit/media/crypto/ppapi/ffmpeg_cdm_video_frame.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..daf05db5fccde3fc2080bac6ce01644595fc1b64 |
--- /dev/null |
+++ b/webkit/media/crypto/ppapi/ffmpeg_cdm_video_frame.h |
@@ -0,0 +1,66 @@ |
+// Copyright (c) 2012 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef WEBKIT_MEDIA_CRYPTO_PPAPI_FFMPEG_CDM_VIDEO_FRAME_H_ |
+#define WEBKIT_MEDIA_CRYPTO_PPAPI_FFMPEG_CDM_VIDEO_FRAME_H_ |
+ |
+#include "base/basictypes.h" |
+#include "base/compiler_specific.h" |
+#include "webkit/media/crypto/ppapi/content_decryption_module.h" |
+ |
+namespace webkit_media { |
+ |
+// Allocates storage for video frames using cdm::Allocator, and contains all |
+// the information necessary to read and write the video frame data. |
+class FFmpegCdmVideoFrame { |
+ public: |
+ ~FFmpegCdmVideoFrame(); |
+ // 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.
|
+ // |size|. Returns NULL on failure. |
+ static FFmpegCdmVideoFrame* Create(cdm::Allocator* allocator, |
+ cdm::VideoFormat format, |
+ const cdm::Size& size); |
+ |
+ cdm::VideoFormat format() const; |
+ cdm::Buffer* frame_buffer(); |
+ const cdm::Size& size() const; |
+ 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.
|
+ int32_t stride(cdm::VideoFrame::VideoPlane plane); |
+ |
+ // Releases ownership of |frame_buffer_| to caller. |
+ cdm::Buffer* ReleaseCdmBuffer(); |
+ |
+ private: |
+ // Clients must use the static Create() method to create a new frame. |
+ FFmpegCdmVideoFrame(cdm::VideoFormat format, const cdm::Size& size); |
+ |
+ // Allocates a YUV video frame buffer of type |format_| using |size_|. |
+ // Returns true when the frame buffer is successfully allocated. Returns |
+ // false otherwise. |
+ bool AllocateYUV(cdm::Allocator* allocator); |
+ |
+ // The video buffer format. |
+ cdm::VideoFormat format_; |
+ |
+ // Width and height of the video frame. |
+ cdm::Size size_; |
+ |
+ // The video frame buffer. Owned by FFmpegCdmVideoFrame until |
+ // ReleaseCdmBuffer() is called. |
+ 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
|
+ |
+ // Array of data pointers to each plane in the video frame buffer. |
+ int32_t plane_offsets_[cdm::VideoFrame::kMaxPlanes]; |
+ |
+ // Array of strides for each plane, typically greater or equal to the width |
+ // of the surface divided by the horizontal sampling period. Note that |
+ // strides can be negative. |
+ int32_t strides_[cdm::VideoFrame::kMaxPlanes]; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(FFmpegCdmVideoFrame); |
+}; |
+ |
+} // namespace webkit_media |
+ |
+#endif // WEBKIT_MEDIA_CRYPTO_PPAPI_FFMPEG_CDM_VIDEO_FRAME_H_ |