OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 VideoDecoderAccelerator | 5 // This file contains an implementation of VideoDecoderAccelerator |
6 // that utilizes the hardware video decoder present on the Exynos SoC. | 6 // that utilizes the hardware video decoder present on the Exynos SoC. |
7 | 7 |
8 #ifndef CONTENT_COMMON_GPU_MEDIA_EXYNOS_VIDEO_DECODE_ACCELERATOR_H_ | 8 #ifndef CONTENT_COMMON_GPU_MEDIA_EXYNOS_VIDEO_DECODE_ACCELERATOR_H_ |
9 #define CONTENT_COMMON_GPU_MEDIA_EXYNOS_VIDEO_DECODE_ACCELERATOR_H_ | 9 #define CONTENT_COMMON_GPU_MEDIA_EXYNOS_VIDEO_DECODE_ACCELERATOR_H_ |
10 | 10 |
11 #include <queue> | 11 #include <queue> |
12 #include <vector> | 12 #include <vector> |
13 | 13 |
14 #include "base/callback_forward.h" | 14 #include "base/callback_forward.h" |
15 #include "base/memory/linked_ptr.h" | 15 #include "base/memory/linked_ptr.h" |
16 #include "base/memory/scoped_ptr.h" | 16 #include "base/memory/scoped_ptr.h" |
17 #include "base/threading/thread.h" | 17 #include "base/threading/thread.h" |
18 #include "content/common/content_export.h" | 18 #include "content/common/content_export.h" |
19 #include "content/common/gpu/media/video_decode_accelerator_impl.h" | 19 #include "content/common/gpu/media/video_decode_accelerator_impl.h" |
20 #include "media/base/limits.h" | 20 #include "media/base/limits.h" |
21 #include "media/base/video_decoder_config.h" | 21 #include "media/base/video_decoder_config.h" |
22 #include "media/video/picture.h" | 22 #include "media/video/picture.h" |
23 #include "ui/gfx/size.h" | 23 #include "ui/gfx/size.h" |
24 #include "ui/gl/gl_bindings.h" | 24 #include "ui/gl/gl_bindings.h" |
25 | 25 |
26 namespace base { | 26 namespace base { |
27 class MessageLoopProxy; | 27 class MessageLoopProxy; |
28 } | 28 } // namespace base |
| 29 |
| 30 namespace media { |
| 31 class H264Parser; |
| 32 } // namespace media |
29 | 33 |
30 namespace content { | 34 namespace content { |
31 class H264Parser; | |
32 | |
33 // This class handles Exynos video acceleration directly through the V4L2 | 35 // This class handles Exynos video acceleration directly through the V4L2 |
34 // device exported by the Multi Format Codec hardware block. | 36 // device exported by the Multi Format Codec hardware block. |
35 // | 37 // |
36 // The threading model of this class is driven by the fact that it needs to | 38 // The threading model of this class is driven by the fact that it needs to |
37 // interface two fundamentally different event queues -- the one Chromium | 39 // interface two fundamentally different event queues -- the one Chromium |
38 // provides through MessageLoop, and the one driven by the V4L2 devices which | 40 // provides through MessageLoop, and the one driven by the V4L2 devices which |
39 // is waited on with epoll(). There are three threads involved in this class: | 41 // is waited on with epoll(). There are three threads involved in this class: |
40 // | 42 // |
41 // * The child thread, which is the main GPU process thread which calls the | 43 // * The child thread, which is the main GPU process thread which calls the |
42 // media::VideoDecodeAccelerator entry points. Calls from this thread | 44 // media::VideoDecodeAccelerator entry points. Calls from this thread |
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
342 bool decoder_flushing_; | 344 bool decoder_flushing_; |
343 // Got a notification from driver that it reached resolution change point | 345 // Got a notification from driver that it reached resolution change point |
344 // in the stream. | 346 // in the stream. |
345 bool resolution_change_pending_; | 347 bool resolution_change_pending_; |
346 // Got a reset request while we were performing resolution change. | 348 // Got a reset request while we were performing resolution change. |
347 bool resolution_change_reset_pending_; | 349 bool resolution_change_reset_pending_; |
348 // Input queue for decoder_thread_: BitstreamBuffers in. | 350 // Input queue for decoder_thread_: BitstreamBuffers in. |
349 std::queue<linked_ptr<BitstreamBufferRef> > decoder_input_queue_; | 351 std::queue<linked_ptr<BitstreamBufferRef> > decoder_input_queue_; |
350 // For H264 decode, hardware requires that we send it frame-sized chunks. | 352 // For H264 decode, hardware requires that we send it frame-sized chunks. |
351 // We'll need to parse the stream. | 353 // We'll need to parse the stream. |
352 scoped_ptr<content::H264Parser> decoder_h264_parser_; | 354 scoped_ptr<media::H264Parser> decoder_h264_parser_; |
353 // Set if the decoder has a pending incomplete frame in an input buffer. | 355 // Set if the decoder has a pending incomplete frame in an input buffer. |
354 bool decoder_partial_frame_pending_; | 356 bool decoder_partial_frame_pending_; |
355 | 357 |
356 // | 358 // |
357 // Hardware state and associated queues. Since decoder_thread_ services | 359 // Hardware state and associated queues. Since decoder_thread_ services |
358 // the hardware, decoder_thread_ owns these too. | 360 // the hardware, decoder_thread_ owns these too. |
359 // | 361 // |
360 | 362 |
361 // Completed decode buffers, waiting for MFC. | 363 // Completed decode buffers, waiting for MFC. |
362 std::queue<int> mfc_input_ready_queue_; | 364 std::queue<int> mfc_input_ready_queue_; |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
418 | 420 |
419 // The codec we'll be decoding for. | 421 // The codec we'll be decoding for. |
420 media::VideoCodecProfile video_profile_; | 422 media::VideoCodecProfile video_profile_; |
421 | 423 |
422 DISALLOW_COPY_AND_ASSIGN(ExynosVideoDecodeAccelerator); | 424 DISALLOW_COPY_AND_ASSIGN(ExynosVideoDecodeAccelerator); |
423 }; | 425 }; |
424 | 426 |
425 } // namespace content | 427 } // namespace content |
426 | 428 |
427 #endif // CONTENT_COMMON_GPU_MEDIA_EXYNOS_VIDEO_DECODE_ACCELERATOR_H_ | 429 #endif // CONTENT_COMMON_GPU_MEDIA_EXYNOS_VIDEO_DECODE_ACCELERATOR_H_ |
OLD | NEW |