Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(197)

Unified Diff: webkit/media/crypto/ppapi/ffmpeg_cdm_video_frame.h

Issue 10899021: Add CDM video decoder. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Allocate PP_DCHECK, rename video buffer callbacks, stop leaking video frames when FFmpeg releases t… Created 8 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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_

Powered by Google App Engine
This is Rietveld 408576698