| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_VIDEO_VIDEO_DECODE_ENGINE_H_ | 5 #ifndef MEDIA_VIDEO_VIDEO_DECODE_ENGINE_H_ |
| 6 #define MEDIA_VIDEO_VIDEO_DECODE_ENGINE_H_ | 6 #define MEDIA_VIDEO_VIDEO_DECODE_ENGINE_H_ |
| 7 | 7 |
| 8 #include "base/callback.h" | 8 #include "base/callback.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "media/base/media_export.h" | 10 #include "media/base/media_export.h" |
| 11 #include "media/base/video_decoder_config.h" | 11 #include "media/base/video_decoder_config.h" |
| 12 #include "media/base/video_frame.h" | 12 #include "media/base/video_frame.h" |
| 13 | 13 |
| 14 class MessageLoop; | |
| 15 | |
| 16 namespace media { | 14 namespace media { |
| 17 | 15 |
| 18 class Buffer; | 16 class Buffer; |
| 19 class VideoDecodeContext; | |
| 20 | |
| 21 struct PipelineStatistics; | 17 struct PipelineStatistics; |
| 22 | 18 |
| 23 class MEDIA_EXPORT VideoDecodeEngine { | 19 class MEDIA_EXPORT VideoDecodeEngine { |
| 24 public: | 20 public: |
| 25 struct MEDIA_EXPORT EventHandler { | 21 struct MEDIA_EXPORT EventHandler { |
| 26 public: | 22 public: |
| 27 virtual ~EventHandler() {} | 23 virtual ~EventHandler() {} |
| 28 virtual void OnInitializeComplete(bool success) = 0; | 24 virtual void OnInitializeComplete(bool success) = 0; |
| 29 virtual void OnUninitializeComplete() = 0; | 25 virtual void OnUninitializeComplete() = 0; |
| 30 virtual void OnFlushComplete() = 0; | 26 virtual void OnFlushComplete() = 0; |
| (...skipping 28 matching lines...) Expand all Loading... |
| 59 // method is called to return the video frame object to the owner. | 55 // method is called to return the video frame object to the owner. |
| 60 // The content of the video frame may be invalid. | 56 // The content of the video frame may be invalid. |
| 61 virtual void ConsumeVideoFrame(scoped_refptr<VideoFrame> frame, | 57 virtual void ConsumeVideoFrame(scoped_refptr<VideoFrame> frame, |
| 62 const PipelineStatistics& statistics) = 0; | 58 const PipelineStatistics& statistics) = 0; |
| 63 }; | 59 }; |
| 64 | 60 |
| 65 virtual ~VideoDecodeEngine() {} | 61 virtual ~VideoDecodeEngine() {} |
| 66 | 62 |
| 67 // Initialize the engine with specified configuration. | 63 // Initialize the engine with specified configuration. |
| 68 // | 64 // |
| 69 // |decode_context| is used for allocation of VideoFrame. | |
| 70 // It is important that |decode_context| is called only on |message_loop|. | |
| 71 // | |
| 72 // TODO(hclam): Currently refactoring code to use VideoDecodeContext so | |
| 73 // |context| may be NULL in some cases. | |
| 74 // | |
| 75 // Engine should call EventHandler::OnInitializeDone() whether the | 65 // Engine should call EventHandler::OnInitializeDone() whether the |
| 76 // initialization operation finished successfully or not. | 66 // initialization operation finished successfully or not. |
| 77 virtual void Initialize(MessageLoop* message_loop, | 67 virtual void Initialize(EventHandler* event_handler, |
| 78 EventHandler* event_handler, | |
| 79 VideoDecodeContext* context, | |
| 80 const VideoDecoderConfig& config) = 0; | 68 const VideoDecoderConfig& config) = 0; |
| 81 | 69 |
| 82 // Uninitialize the engine. Engine should destroy all resources and call | 70 // Uninitialize the engine. Engine should destroy all resources and call |
| 83 // EventHandler::OnUninitializeComplete(). | 71 // EventHandler::OnUninitializeComplete(). |
| 84 virtual void Uninitialize() = 0; | 72 virtual void Uninitialize() = 0; |
| 85 | 73 |
| 86 // Flush the engine. Engine should return all the buffers to owner ( which | 74 // Flush the engine. Engine should return all the buffers to owner ( which |
| 87 // could be itself. ) then call EventHandler::OnFlushDone(). | 75 // could be itself. ) then call EventHandler::OnFlushDone(). |
| 88 virtual void Flush() = 0; | 76 virtual void Flush() = 0; |
| 89 | 77 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 110 // is called by the user to return the video frame object. | 98 // is called by the user to return the video frame object. |
| 111 // | 99 // |
| 112 // In response to this method call, ConsumeVideoFrame() is called with a | 100 // In response to this method call, ConsumeVideoFrame() is called with a |
| 113 // video frame object containing decoded video content. | 101 // video frame object containing decoded video content. |
| 114 virtual void ProduceVideoFrame(scoped_refptr<VideoFrame> frame) = 0; | 102 virtual void ProduceVideoFrame(scoped_refptr<VideoFrame> frame) = 0; |
| 115 }; | 103 }; |
| 116 | 104 |
| 117 } // namespace media | 105 } // namespace media |
| 118 | 106 |
| 119 #endif // MEDIA_VIDEO_VIDEO_DECODE_ENGINE_H_ | 107 #endif // MEDIA_VIDEO_VIDEO_DECODE_ENGINE_H_ |
| OLD | NEW |