| 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 MEDIA_GPU_AVDA_PICTURE_BUFFER_MANAGER_H_ | 5 #ifndef MEDIA_GPU_AVDA_PICTURE_BUFFER_MANAGER_H_ |
| 6 #define MEDIA_GPU_AVDA_PICTURE_BUFFER_MANAGER_H_ | 6 #define MEDIA_GPU_AVDA_PICTURE_BUFFER_MANAGER_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 // the front buffer can then be used to draw without needing to copy the pixels. | 36 // the front buffer can then be used to draw without needing to copy the pixels. |
| 37 // If the Surface is a SurfaceView, the release causes the frame to be displayed | 37 // If the Surface is a SurfaceView, the release causes the frame to be displayed |
| 38 // immediately. | 38 // immediately. |
| 39 class MEDIA_GPU_EXPORT AVDAPictureBufferManager { | 39 class MEDIA_GPU_EXPORT AVDAPictureBufferManager { |
| 40 public: | 40 public: |
| 41 using PictureBufferMap = std::map<int32_t, PictureBuffer>; | 41 using PictureBufferMap = std::map<int32_t, PictureBuffer>; |
| 42 | 42 |
| 43 explicit AVDAPictureBufferManager(AVDAStateProvider* state_provider); | 43 explicit AVDAPictureBufferManager(AVDAStateProvider* state_provider); |
| 44 virtual ~AVDAPictureBufferManager(); | 44 virtual ~AVDAPictureBufferManager(); |
| 45 | 45 |
| 46 // Must be called before anything else. If |surface_id| is |kNoSurfaceID| | 46 // Call either InitializeForOverlay or InitializeForSurfaceTexture before |
| 47 // then a new SurfaceTexture will be returned. Otherwise, the corresponding | 47 // anything else. InitializeForOverlay will set us up to render codec buffers |
| 48 // SurfaceView will be returned. | 48 // at the approrpriate time for display, but will assume that consuming the |
| 49 // resulting buffers is handled elsewhere (e.g., SurfaceFlinger). |
| 49 // | 50 // |
| 50 // May be called multiple times to switch to a new |surface_id|. Picture | 51 // InitializeForSurfaceTexture will create a SurfaceTexture and return the |
| 51 // buffers will be updated to use the new surface during the call to | 52 // surface for it. We will arrange to consume the buffers at the right time, |
| 52 // UseCodecBufferForPictureBuffer(). | 53 // in addition to releasing codec buffers for rendering. |
| 53 gl::ScopedJavaSurface Initialize(int surface_id); | 54 // |
| 55 // One may call these multiple times to change between overlay and ST. |
| 56 // |
| 57 // Picture buffers will be updated to reflect the new surface during the call |
| 58 // to UseCodecBufferForPicture(). |
| 59 void InitializeForOverlay(); |
| 60 gl::ScopedJavaSurface InitializeForSurfaceTexture(); |
| 54 | 61 |
| 55 void Destroy(const PictureBufferMap& buffers); | 62 void Destroy(const PictureBufferMap& buffers); |
| 56 | 63 |
| 57 // Sets up |picture_buffer| so that its texture will refer to the image that | 64 // Sets up |picture_buffer| so that its texture will refer to the image that |
| 58 // is represented by the decoded output buffer at codec_buffer_index. | 65 // is represented by the decoded output buffer at codec_buffer_index. |
| 59 void UseCodecBufferForPictureBuffer(int32_t codec_buffer_index, | 66 void UseCodecBufferForPictureBuffer(int32_t codec_buffer_index, |
| 60 const PictureBuffer& picture_buffer); | 67 const PictureBuffer& picture_buffer); |
| 61 | 68 |
| 62 // Assigns a picture buffer and attaches an image to its texture. | 69 // Assigns a picture buffer and attaches an image to its texture. |
| 63 void AssignOnePictureBuffer(const PictureBuffer& picture_buffer, | 70 void AssignOnePictureBuffer(const PictureBuffer& picture_buffer, |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 | 128 |
| 122 // Maps a picture buffer id to a AVDACodecImage. | 129 // Maps a picture buffer id to a AVDACodecImage. |
| 123 std::map<int, scoped_refptr<AVDACodecImage>> codec_images_; | 130 std::map<int, scoped_refptr<AVDACodecImage>> codec_images_; |
| 124 | 131 |
| 125 DISALLOW_COPY_AND_ASSIGN(AVDAPictureBufferManager); | 132 DISALLOW_COPY_AND_ASSIGN(AVDAPictureBufferManager); |
| 126 }; | 133 }; |
| 127 | 134 |
| 128 } // namespace media | 135 } // namespace media |
| 129 | 136 |
| 130 #endif // MEDIA_GPU_AVDA_PICTURE_BUFFER_MANAGER_H_ | 137 #endif // MEDIA_GPU_AVDA_PICTURE_BUFFER_MANAGER_H_ |
| OLD | NEW |