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

Side by Side 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: Address more comments. 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(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
20 // Returns a pointer to FFmpegCdmVideoFrame of the specified |format| and
21 // |size|. Returns NULL on failure.
22 static FFmpegCdmVideoFrame* Create(cdm::Allocator* allocator,
23 cdm::VideoFormat format,
24 const cdm::Size& size);
25
26 cdm::VideoFormat format() const { return format_; }
27 cdm::Buffer* frame_buffer() { return frame_buffer_; }
28 const cdm::Size& size() const { return size_; }
29
30 int32_t plane_offset(cdm::VideoFrame::VideoPlane plane) const;
31 int32_t stride(cdm::VideoFrame::VideoPlane plane) const;
32
33 // Returns true when |format| and |data_size| can be used to create a valid
34 // FFmpegCdmVideoFrame.
35 static bool IsValidConfig(cdm::VideoFormat format,
36 const cdm::Size& data_size);
37
38 // Transfers ownership of |frame_buffer_| to |target|, and copies all video
39 // frame meta data stored in FFmpegCdmVideoFrame.
40 void MoveVideoFrame(cdm::VideoFrame* target);
ddorwin 2012/10/17 03:18:20 Export, Extract, Convert, Transfer, ...?
Tom Finegan 2012/10/17 04:25:29 Transfer works. Done.
41
42 private:
43 // Clients must use the static Create() method to create a new frame.
44 FFmpegCdmVideoFrame(cdm::VideoFormat format, const cdm::Size& size);
45
46 // Allocates a YUV video frame buffer of type |format_| using |size_|.
47 // Returns true when the frame buffer is successfully allocated. Returns
48 // false otherwise.
49 bool AllocateYuv(cdm::Allocator* allocator);
50
51 // The video buffer format.
52 cdm::VideoFormat format_;
53
54 // Width and height of the video frame.
55 cdm::Size size_;
56
57 // The video frame buffer. Owned by FFmpegCdmVideoFrame until
58 // ReleaseCdmBuffer() is called.
59 cdm::Buffer* frame_buffer_;
60
61 // Array of data pointers to each plane in the video frame buffer.
62 int32_t plane_offsets_[cdm::VideoFrame::kMaxPlanes];
63
64 // Array of strides for each plane, typically greater or equal to the width
65 // of the surface divided by the horizontal sampling period. Note that
66 // strides can be negative.
67 int32_t strides_[cdm::VideoFrame::kMaxPlanes];
68
69 DISALLOW_COPY_AND_ASSIGN(FFmpegCdmVideoFrame);
70 };
71
72 } // namespace webkit_media
73
74 #endif // WEBKIT_MEDIA_CRYPTO_PPAPI_FFMPEG_CDM_VIDEO_FRAME_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698