| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 // This file contains an implementation of VideoDecodeAccelerator | 5 // This file contains an implementation of VideoDecodeAccelerator |
| 6 // that utilizes hardware video decoders, which expose Video4Linux 2 API | 6 // that utilizes hardware video decoders, which expose Video4Linux 2 API |
| 7 // (http://linuxtv.org/downloads/v4l-dvb-apis/). | 7 // (http://linuxtv.org/downloads/v4l-dvb-apis/). |
| 8 | 8 |
| 9 #ifndef CONTENT_COMMON_GPU_MEDIA_V4L2_VIDEO_DECODE_ACCELERATOR_H_ | 9 #ifndef CONTENT_COMMON_GPU_MEDIA_V4L2_VIDEO_DECODE_ACCELERATOR_H_ |
| 10 #define CONTENT_COMMON_GPU_MEDIA_V4L2_VIDEO_DECODE_ACCELERATOR_H_ | 10 #define CONTENT_COMMON_GPU_MEDIA_V4L2_VIDEO_DECODE_ACCELERATOR_H_ |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 class CONTENT_EXPORT V4L2VideoDecodeAccelerator | 76 class CONTENT_EXPORT V4L2VideoDecodeAccelerator |
| 77 : public media::VideoDecodeAccelerator { | 77 : public media::VideoDecodeAccelerator { |
| 78 public: | 78 public: |
| 79 V4L2VideoDecodeAccelerator( | 79 V4L2VideoDecodeAccelerator( |
| 80 EGLDisplay egl_display, | 80 EGLDisplay egl_display, |
| 81 EGLContext egl_context, | 81 EGLContext egl_context, |
| 82 const base::WeakPtr<Client>& io_client_, | 82 const base::WeakPtr<Client>& io_client_, |
| 83 const base::Callback<bool(void)>& make_context_current, | 83 const base::Callback<bool(void)>& make_context_current, |
| 84 const scoped_refptr<V4L2Device>& device, | 84 const scoped_refptr<V4L2Device>& device, |
| 85 const scoped_refptr<base::MessageLoopProxy>& io_message_loop_proxy); | 85 const scoped_refptr<base::MessageLoopProxy>& io_message_loop_proxy); |
| 86 virtual ~V4L2VideoDecodeAccelerator(); | 86 ~V4L2VideoDecodeAccelerator() override; |
| 87 | 87 |
| 88 // media::VideoDecodeAccelerator implementation. | 88 // media::VideoDecodeAccelerator implementation. |
| 89 // Note: Initialize() and Destroy() are synchronous. | 89 // Note: Initialize() and Destroy() are synchronous. |
| 90 virtual bool Initialize(media::VideoCodecProfile profile, | 90 bool Initialize(media::VideoCodecProfile profile, |
| 91 Client* client) override; | 91 Client* client) override; |
| 92 virtual void Decode(const media::BitstreamBuffer& bitstream_buffer) override; | 92 void Decode(const media::BitstreamBuffer& bitstream_buffer) override; |
| 93 virtual void AssignPictureBuffers( | 93 void AssignPictureBuffers( |
| 94 const std::vector<media::PictureBuffer>& buffers) override; | 94 const std::vector<media::PictureBuffer>& buffers) override; |
| 95 virtual void ReusePictureBuffer(int32 picture_buffer_id) override; | 95 void ReusePictureBuffer(int32 picture_buffer_id) override; |
| 96 virtual void Flush() override; | 96 void Flush() override; |
| 97 virtual void Reset() override; | 97 void Reset() override; |
| 98 virtual void Destroy() override; | 98 void Destroy() override; |
| 99 virtual bool CanDecodeOnIOThread() override; | 99 bool CanDecodeOnIOThread() override; |
| 100 | 100 |
| 101 private: | 101 private: |
| 102 // These are rather subjectively tuned. | 102 // These are rather subjectively tuned. |
| 103 enum { | 103 enum { |
| 104 kInputBufferCount = 8, | 104 kInputBufferCount = 8, |
| 105 // TODO(posciak): determine input buffer size based on level limits. | 105 // TODO(posciak): determine input buffer size based on level limits. |
| 106 // See http://crbug.com/255116. | 106 // See http://crbug.com/255116. |
| 107 // Input bitstream buffer size for up to 1080p streams. | 107 // Input bitstream buffer size for up to 1080p streams. |
| 108 kInputBufferMaxSizeFor1080p = 1024 * 1024, | 108 kInputBufferMaxSizeFor1080p = 1024 * 1024, |
| 109 // Input bitstream buffer size for up to 4k streams. | 109 // Input bitstream buffer size for up to 4k streams. |
| (...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 443 | 443 |
| 444 // The WeakPtrFactory for |weak_this_|. | 444 // The WeakPtrFactory for |weak_this_|. |
| 445 base::WeakPtrFactory<V4L2VideoDecodeAccelerator> weak_this_factory_; | 445 base::WeakPtrFactory<V4L2VideoDecodeAccelerator> weak_this_factory_; |
| 446 | 446 |
| 447 DISALLOW_COPY_AND_ASSIGN(V4L2VideoDecodeAccelerator); | 447 DISALLOW_COPY_AND_ASSIGN(V4L2VideoDecodeAccelerator); |
| 448 }; | 448 }; |
| 449 | 449 |
| 450 } // namespace content | 450 } // namespace content |
| 451 | 451 |
| 452 #endif // CONTENT_COMMON_GPU_MEDIA_V4L2_VIDEO_DECODE_ACCELERATOR_H_ | 452 #endif // CONTENT_COMMON_GPU_MEDIA_V4L2_VIDEO_DECODE_ACCELERATOR_H_ |
| OLD | NEW |