| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef MEDIA_GPU_ANDROID_COPYING_BACKING_STRATEGY_H_ | |
| 6 #define MEDIA_GPU_ANDROID_COPYING_BACKING_STRATEGY_H_ | |
| 7 | |
| 8 #include <stdint.h> | |
| 9 | |
| 10 #include <memory> | |
| 11 | |
| 12 #include "base/compiler_specific.h" | |
| 13 #include "media/gpu/android_video_decode_accelerator.h" | |
| 14 #include "media/gpu/media_gpu_export.h" | |
| 15 | |
| 16 namespace gpu { | |
| 17 class CopyTextureCHROMIUMResourceManager; | |
| 18 } | |
| 19 | |
| 20 namespace media { | |
| 21 class PictureBuffer; | |
| 22 } | |
| 23 | |
| 24 namespace media { | |
| 25 | |
| 26 class AVDAStateProvider; | |
| 27 | |
| 28 // A BackingStrategy implementation that copies images to PictureBuffer | |
| 29 // textures via gpu texture copy. | |
| 30 class MEDIA_GPU_EXPORT AndroidCopyingBackingStrategy | |
| 31 : public AndroidVideoDecodeAccelerator::BackingStrategy { | |
| 32 public: | |
| 33 explicit AndroidCopyingBackingStrategy(AVDAStateProvider* state_provider); | |
| 34 ~AndroidCopyingBackingStrategy() override; | |
| 35 | |
| 36 // AndroidVideoDecodeAccelerator::BackingStrategy | |
| 37 gl::ScopedJavaSurface Initialize(int surface_view_id) override; | |
| 38 void BeginCleanup( | |
| 39 bool have_context, | |
| 40 const AndroidVideoDecodeAccelerator::OutputBufferMap& buffers) override; | |
| 41 void EndCleanup() override; | |
| 42 scoped_refptr<gl::SurfaceTexture> GetSurfaceTexture() const override; | |
| 43 uint32_t GetTextureTarget() const override; | |
| 44 gfx::Size GetPictureBufferSize() const override; | |
| 45 void UseCodecBufferForPictureBuffer( | |
| 46 int32_t codec_buffer_index, | |
| 47 const PictureBuffer& picture_buffer) override; | |
| 48 void CodecChanged(VideoCodecBridge* codec) override; | |
| 49 void OnFrameAvailable() override; | |
| 50 bool ArePicturesOverlayable() override; | |
| 51 void UpdatePictureBufferSize(PictureBuffer* picture_buffer, | |
| 52 const gfx::Size& new_size) override; | |
| 53 | |
| 54 private: | |
| 55 // Used for copy the texture from surface texture to picture buffers. | |
| 56 std::unique_ptr<gpu::CopyTextureCHROMIUMResourceManager> copier_; | |
| 57 | |
| 58 AVDAStateProvider* state_provider_; | |
| 59 | |
| 60 // A container of texture. Used to set a texture to |media_codec_|. | |
| 61 scoped_refptr<gl::SurfaceTexture> surface_texture_; | |
| 62 | |
| 63 // The texture id which is set to |surface_texture_|. | |
| 64 uint32_t surface_texture_id_; | |
| 65 | |
| 66 VideoCodecBridge* media_codec_; | |
| 67 }; | |
| 68 | |
| 69 } // namespace media | |
| 70 | |
| 71 #endif // MEDIA_GPU_ANDROID_COPYING_BACKING_STRATEGY_H_ | |
| OLD | NEW |