OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 CHROME_RENDERER_MEDIA_GLES2_VIDEO_DECODE_CONTEXT_H_ | 5 #ifndef CHROME_RENDERER_MEDIA_GLES2_VIDEO_DECODE_CONTEXT_H_ |
6 #define CHROME_RENDERER_MEDIA_GLES2_VIDEO_DECODE_CONTEXT_H_ | 6 #define CHROME_RENDERER_MEDIA_GLES2_VIDEO_DECODE_CONTEXT_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "media/video/video_decode_context.h" | 10 #include "media/video/video_decode_context.h" |
(...skipping 19 matching lines...) Expand all Loading... |
30 // 1. Memory mapped textures (aka software decoding mode). | 30 // 1. Memory mapped textures (aka software decoding mode). |
31 // Each texture is memory mapped and appears to the VideoDecodeEngine as | 31 // Each texture is memory mapped and appears to the VideoDecodeEngine as |
32 // system memory. | 32 // system memory. |
33 // | 33 // |
34 // The usage of the textures is that the VideoDecodeEngine is performing | 34 // The usage of the textures is that the VideoDecodeEngine is performing |
35 // software video decoding and use them as if they are allocated in plain | 35 // software video decoding and use them as if they are allocated in plain |
36 // system memory (in fact they are allocated in system memory and shared | 36 // system memory (in fact they are allocated in system memory and shared |
37 // bwith the GPU process). An additional step of uploading the content to | 37 // bwith the GPU process). An additional step of uploading the content to |
38 // video memory is needed. Since VideoDecodeEngine is unaware of the video | 38 // video memory is needed. Since VideoDecodeEngine is unaware of the video |
39 // memory, this upload operation is performed by calling | 39 // memory, this upload operation is performed by calling |
40 // UploadToVideoFrame(). | 40 // ConvertToVideoFrame(). |
41 // | 41 // |
42 // After the content is uploaded to video memory, WebKit will see the video | 42 // After the content is uploaded to video memory, WebKit will see the video |
43 // frame as textures and will perform the necessary operations for | 43 // frame as textures and will perform the necessary operations for |
44 // rendering. | 44 // rendering. |
45 // | 45 // |
46 // 2. Opaque textures (aka hardware decoding mode). | 46 // 2. Opaque textures (aka hardware decoding mode). |
47 // In this mode of operation each video frame is backed by some opaque | 47 // In this mode of operation each video frame is backed by some opaque |
48 // textures. This is used only when hardware video decoding is used. The | 48 // textures. This is used only when hardware video decoding is used. The |
49 // textures needs to be generated and allocated inside the renderer process | 49 // textures needs to be generated and allocated inside the renderer process |
50 // first. This will establish a translation between texture ID in the | 50 // first. This will establish a translation between texture ID in the |
(...skipping 28 matching lines...) Expand all Loading... |
79 bool memory_mapped, ggl::Context* context); | 79 bool memory_mapped, ggl::Context* context); |
80 virtual ~Gles2VideoDecodeContext(); | 80 virtual ~Gles2VideoDecodeContext(); |
81 | 81 |
82 // media::VideoDecodeContext implementation. | 82 // media::VideoDecodeContext implementation. |
83 virtual void* GetDevice(); | 83 virtual void* GetDevice(); |
84 virtual void AllocateVideoFrames( | 84 virtual void AllocateVideoFrames( |
85 int frames_num, size_t width, size_t height, | 85 int frames_num, size_t width, size_t height, |
86 media::VideoFrame::Format format, | 86 media::VideoFrame::Format format, |
87 std::vector<scoped_refptr<media::VideoFrame> >* frames_out, Task* task); | 87 std::vector<scoped_refptr<media::VideoFrame> >* frames_out, Task* task); |
88 virtual void ReleaseAllVideoFrames(); | 88 virtual void ReleaseAllVideoFrames(); |
89 virtual void UploadToVideoFrame(void* buffer, | 89 virtual void ConvertToVideoFrame(void* buffer, |
90 scoped_refptr<media::VideoFrame> frame, | 90 scoped_refptr<media::VideoFrame> frame, |
91 Task* task); | 91 Task* task); |
92 virtual void Destroy(Task* task); | 92 virtual void Destroy(Task* task); |
93 | 93 |
94 // Accessor of the current mode of this decode context. | 94 // Accessor of the current mode of this decode context. |
95 bool IsMemoryMapped() const { return memory_mapped_; } | 95 bool IsMemoryMapped() const { return memory_mapped_; } |
96 | 96 |
97 private: | 97 private: |
98 // Message loop for Render Thread. | 98 // Message loop for Render Thread. |
99 MessageLoop* message_loop_; | 99 MessageLoop* message_loop_; |
100 | 100 |
101 // Type of storage provided by this class. | 101 // Type of storage provided by this class. |
102 bool memory_mapped_; | 102 bool memory_mapped_; |
103 | 103 |
104 // Pointer to the GLES2 context. | 104 // Pointer to the GLES2 context. |
105 ggl::Context* context_; | 105 ggl::Context* context_; |
106 | 106 |
107 // VideoFrames allocated. | 107 // VideoFrames allocated. |
108 std::vector<scoped_refptr<media::VideoFrame> > frames_; | 108 std::vector<scoped_refptr<media::VideoFrame> > frames_; |
109 | 109 |
110 DISALLOW_COPY_AND_ASSIGN(Gles2VideoDecodeContext); | 110 DISALLOW_COPY_AND_ASSIGN(Gles2VideoDecodeContext); |
111 }; | 111 }; |
112 | 112 |
113 #endif // CHROME_RENDERER_MEDIA_GLES2_VIDEO_DECODE_CONTEXT_H_ | 113 #endif // CHROME_RENDERER_MEDIA_GLES2_VIDEO_DECODE_CONTEXT_H_ |
OLD | NEW |