Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 CONTENT_COMMON_GPU_MEDIA_AVDA_CODEC_IMAGE_H_ | 5 #ifndef CONTENT_COMMON_GPU_MEDIA_AVDA_CODEC_IMAGE_H_ |
| 6 #define CONTENT_COMMON_GPU_MEDIA_AVDA_CODEC_IMAGE_H_ | 6 #define CONTENT_COMMON_GPU_MEDIA_AVDA_CODEC_IMAGE_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 45 const gfx::RectF& crop_rect) override; | 45 const gfx::RectF& crop_rect) override; |
| 46 void OnMemoryDump(base::trace_event::ProcessMemoryDump* pmd, | 46 void OnMemoryDump(base::trace_event::ProcessMemoryDump* pmd, |
| 47 uint64_t process_tracing_id, | 47 uint64_t process_tracing_id, |
| 48 const std::string& dump_name) override; | 48 const std::string& dump_name) override; |
| 49 // gpu::gles2::GLStreamTextureMatrix implementation | 49 // gpu::gles2::GLStreamTextureMatrix implementation |
| 50 void GetTextureMatrix(float xform[16]) override; | 50 void GetTextureMatrix(float xform[16]) override; |
| 51 | 51 |
| 52 // Decoded buffer index that has the image for us to display. | 52 // Decoded buffer index that has the image for us to display. |
| 53 void SetMediaCodecBufferIndex(int buffer_index); | 53 void SetMediaCodecBufferIndex(int buffer_index); |
| 54 | 54 |
| 55 // Return the codec buffer that we will return to the codec, or | |
| 56 // <0 if there is no such buffer. | |
| 57 int GetMediaCodecBufferIndex() const; | |
| 58 | |
| 59 // Set the size of the current image. | 55 // Set the size of the current image. |
| 60 void SetSize(const gfx::Size& size); | 56 void SetSize(const gfx::Size& size); |
| 61 | 57 |
| 58 enum class ReleaseMode { SKIP_RENDER, RENDER_ONLY, RENDER_AND_UPDATE }; | |
|
liberato (no reviews please)
2016/04/22 00:51:06
i think these might be better named { DISCARD_CODE
DaleCurtis
2016/04/22 01:33:58
I like it. Done.
| |
| 59 void ReleaseOutputBuffer(ReleaseMode release_mode); | |
| 60 | |
| 61 // Indicates if the codec buffer has been released to the back buffer. | |
| 62 bool is_rendered_to_back_buffer() const { | |
| 63 return codec_buffer_index_ == kUpdateOnly; | |
| 64 } | |
| 65 | |
| 66 // Indicates if the codec buffer has been released to the front or back | |
| 67 // buffer. | |
| 68 bool is_rendered() const { | |
| 69 return codec_buffer_index_ <= kInvalidCodecBufferIndex; | |
| 70 } | |
| 71 | |
| 62 // Updates the MediaCodec for this image; clears |codec_buffer_index_|. | 72 // Updates the MediaCodec for this image; clears |codec_buffer_index_|. |
| 63 void SetMediaCodec(media::MediaCodecBridge* codec); | 73 void SetMediaCodec(media::MediaCodecBridge* codec); |
| 64 | 74 |
| 65 void SetTexture(gpu::gles2::Texture* texture); | 75 void SetTexture(gpu::gles2::Texture* texture); |
| 66 | 76 |
| 67 protected: | 77 protected: |
| 68 ~AVDACodecImage() override; | 78 ~AVDACodecImage() override; |
| 69 | 79 |
| 80 enum { kInvalidCodecBufferIndex = -1, kUpdateOnly = -2 }; | |
| 81 | |
| 70 private: | 82 private: |
| 71 enum { kInvalidCodecBufferIndex = -1 }; | |
| 72 | |
| 73 // Make sure that the surface texture's front buffer is current. This will | 83 // Make sure that the surface texture's front buffer is current. This will |
| 74 // save / restore the current context. It will optionally restore the texture | 84 // save / restore the current context. It will optionally restore the texture |
| 75 // bindings in the surface texture's context, based on |mode|. This is | 85 // bindings in the surface texture's context, based on |mode|. This is |
| 76 // intended as a hint if we don't need to change contexts. If we do need to | 86 // intended as a hint if we don't need to change contexts. If we do need to |
| 77 // change contexts, then we'll always preserve the texture bindings in the | 87 // change contexts, then we'll always preserve the texture bindings in the |
| 78 // both contexts. In other words, the caller is telling us whether it's | 88 // both contexts. In other words, the caller is telling us whether it's |
| 79 // okay to change the binding in the current context. | 89 // okay to change the binding in the current context. |
| 80 enum RestoreBindingsMode { kDontRestoreBindings, kDoRestoreBindings }; | 90 enum RestoreBindingsMode { kDontRestoreBindings, kDoRestoreBindings }; |
| 81 void UpdateSurfaceTexture(RestoreBindingsMode mode); | 91 void UpdateSurfaceTexture(RestoreBindingsMode mode); |
| 82 | 92 |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 124 | 134 |
| 125 // Texture matrix of the front buffer of the surface texture. | 135 // Texture matrix of the front buffer of the surface texture. |
| 126 float gl_matrix_[16]; | 136 float gl_matrix_[16]; |
| 127 | 137 |
| 128 DISALLOW_COPY_AND_ASSIGN(AVDACodecImage); | 138 DISALLOW_COPY_AND_ASSIGN(AVDACodecImage); |
| 129 }; | 139 }; |
| 130 | 140 |
| 131 } // namespace content | 141 } // namespace content |
| 132 | 142 |
| 133 #endif // CONTENT_COMMON_GPU_MEDIA_AVDA_CODEC_IMAGE_H_ | 143 #endif // CONTENT_COMMON_GPU_MEDIA_AVDA_CODEC_IMAGE_H_ |
| OLD | NEW |