Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef MEDIA_CDM_CDM_HELPERS_H_ | 5 #ifndef MEDIA_CDM_CDM_VIDEO_FRAME_H_ |
| 6 #define MEDIA_CDM_CDM_HELPERS_H_ | 6 #define MEDIA_CDM_CDM_VIDEO_FRAME_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 #include "base/memory/ref_counted.h" | |
| 11 #include "media/cdm/api/content_decryption_module.h" | 12 #include "media/cdm/api/content_decryption_module.h" |
| 13 #include "ui/gfx/geometry/size.h" | |
| 12 | 14 |
| 13 namespace media { | 15 namespace media { |
| 14 | 16 |
| 15 class DecryptedBlockImpl : public cdm::DecryptedBlock { | 17 class VideoFrame; |
| 18 | |
| 19 class CdmVideoFrame : public cdm::VideoFrame { | |
| 16 public: | 20 public: |
| 17 DecryptedBlockImpl(); | 21 CdmVideoFrame(); |
| 18 ~DecryptedBlockImpl() final; | 22 ~CdmVideoFrame() override; |
| 19 | |
| 20 // cdm::DecryptedBlock implementation. | |
| 21 void SetDecryptedBuffer(cdm::Buffer* buffer) final; | |
| 22 cdm::Buffer* DecryptedBuffer() final; | |
| 23 void SetTimestamp(int64_t timestamp) final; | |
| 24 int64_t Timestamp() const final; | |
| 25 | |
| 26 private: | |
| 27 cdm::Buffer* buffer_; | |
| 28 int64_t timestamp_; | |
| 29 | |
| 30 DISALLOW_COPY_AND_ASSIGN(DecryptedBlockImpl); | |
| 31 }; | |
| 32 | |
| 33 class VideoFrameImpl : public cdm::VideoFrame { | |
| 34 public: | |
| 35 VideoFrameImpl(); | |
| 36 ~VideoFrameImpl() final; | |
| 37 | 23 |
| 38 // cdm::VideoFrame implementation. | 24 // cdm::VideoFrame implementation. |
| 39 void SetFormat(cdm::VideoFormat format) final; | 25 void SetFormat(cdm::VideoFormat format) final; |
| 40 cdm::VideoFormat Format() const final; | 26 cdm::VideoFormat Format() const final; |
| 41 void SetSize(cdm::Size size) final; | 27 void SetSize(cdm::Size size) final; |
| 42 cdm::Size Size() const final; | 28 cdm::Size Size() const final; |
| 43 void SetFrameBuffer(cdm::Buffer* frame_buffer) final; | 29 void SetFrameBuffer(cdm::Buffer* frame_buffer) final; |
| 44 cdm::Buffer* FrameBuffer() final; | 30 cdm::Buffer* FrameBuffer() final; |
| 45 void SetPlaneOffset(cdm::VideoFrame::VideoPlane plane, uint32_t offset) final; | 31 void SetPlaneOffset(cdm::VideoFrame::VideoPlane plane, uint32_t offset) final; |
| 46 uint32_t PlaneOffset(VideoPlane plane) final; | 32 uint32_t PlaneOffset(VideoPlane plane) final; |
| 47 void SetStride(VideoPlane plane, uint32_t stride) final; | 33 void SetStride(VideoPlane plane, uint32_t stride) final; |
| 48 uint32_t Stride(VideoPlane plane) final; | 34 uint32_t Stride(VideoPlane plane) final; |
| 49 void SetTimestamp(int64_t timestamp) final; | 35 void SetTimestamp(int64_t timestamp) final; |
| 50 int64_t Timestamp() const final; | 36 int64_t Timestamp() const final; |
| 51 | 37 |
| 52 private: | 38 // Create a media::VideoFrame based on the data contained in this object. |
| 39 virtual scoped_refptr<media::VideoFrame> CreateVideoFrame( | |
| 40 gfx::Size natural_size) = 0; | |
|
xhwang
2016/02/11 19:24:14
After this call, what's the state of |this|? Can w
jrummell
2016/02/11 22:08:16
Updated comment. FrameBuffer is transferred to bec
| |
| 41 | |
| 42 protected: | |
| 53 // The video buffer format. | 43 // The video buffer format. |
| 54 cdm::VideoFormat format_; | 44 cdm::VideoFormat format_; |
| 55 | 45 |
| 56 // Width and height of the video frame. | 46 // Width and height of the video frame. |
| 57 cdm::Size size_; | 47 cdm::Size size_; |
| 58 | 48 |
| 59 // The video frame buffer. | 49 // The video frame buffer. |
| 60 cdm::Buffer* frame_buffer_; | 50 cdm::Buffer* frame_buffer_; |
| 61 | 51 |
| 62 // Array of data pointers to each plane in the video frame buffer. | 52 // Array of data pointers to each plane in the video frame buffer. |
| 63 uint32_t plane_offsets_[kMaxPlanes]; | 53 uint32_t plane_offsets_[kMaxPlanes]; |
| 64 | 54 |
| 65 // Array of strides for each plane, typically greater or equal to the width | 55 // Array of strides for each plane, typically greater or equal to the width |
| 66 // of the surface divided by the horizontal sampling period. Note that | 56 // of the surface divided by the horizontal sampling period. Note that |
| 67 // strides can be negative. | 57 // strides can be negative. |
| 68 uint32_t strides_[kMaxPlanes]; | 58 uint32_t strides_[kMaxPlanes]; |
| 69 | 59 |
| 70 // Presentation timestamp in microseconds. | 60 // Presentation timestamp in microseconds. |
| 71 int64_t timestamp_; | 61 int64_t timestamp_; |
| 72 | 62 |
| 73 DISALLOW_COPY_AND_ASSIGN(VideoFrameImpl); | |
| 74 }; | |
| 75 | |
| 76 class AudioFramesImpl : public cdm::AudioFrames { | |
| 77 public: | |
| 78 AudioFramesImpl(); | |
| 79 ~AudioFramesImpl() final; | |
| 80 | |
| 81 // cdm::AudioFrames implementation. | |
| 82 void SetFrameBuffer(cdm::Buffer* buffer) final; | |
| 83 cdm::Buffer* FrameBuffer() final; | |
| 84 void SetFormat(cdm::AudioFormat format) final; | |
| 85 cdm::AudioFormat Format() const final; | |
| 86 | |
| 87 cdm::Buffer* PassFrameBuffer(); | |
| 88 | |
| 89 private: | 63 private: |
| 90 cdm::Buffer* buffer_; | 64 DISALLOW_COPY_AND_ASSIGN(CdmVideoFrame); |
| 91 cdm::AudioFormat format_; | |
| 92 | |
| 93 DISALLOW_COPY_AND_ASSIGN(AudioFramesImpl); | |
| 94 }; | 65 }; |
| 95 | 66 |
| 96 } // namespace media | 67 } // namespace media |
| 97 | 68 |
| 98 #endif // MEDIA_CDM_CDM_HELPERS_H_ | 69 #endif // MEDIA_CDM_CDM_VIDEO_FRAME_H_ |
| OLD | NEW |