Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_FILTERS_VIDEO_DECODE_ENGINE_H_ | 5 #ifndef MEDIA_FILTERS_VIDEO_DECODE_ENGINE_H_ |
| 6 #define MEDIA_FILTERS_VIDEO_DECODE_ENGINE_H_ | 6 #define MEDIA_FILTERS_VIDEO_DECODE_ENGINE_H_ |
| 7 | 7 |
| 8 #include "base/callback.h" | 8 #include "base/callback.h" |
| 9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
| 10 #include "media/base/video_frame.h" | 10 #include "media/base/video_frame.h" |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 65 | 65 |
| 66 // Initial Stream Info. Only part of them could be valid. | 66 // Initial Stream Info. Only part of them could be valid. |
| 67 // If they are not valid, Engine should update with OnFormatChange. | 67 // If they are not valid, Engine should update with OnFormatChange. |
| 68 VideoStreamInfo stream_info_; | 68 VideoStreamInfo stream_info_; |
| 69 }; | 69 }; |
| 70 | 70 |
| 71 class VideoDecodeEngine : public base::RefCountedThreadSafe<VideoDecodeEngine> { | 71 class VideoDecodeEngine : public base::RefCountedThreadSafe<VideoDecodeEngine> { |
| 72 public: | 72 public: |
| 73 struct EventHandler { | 73 struct EventHandler { |
| 74 public: | 74 public: |
| 75 virtual ~EventHandler() {} | |
|
Alpha Left Google
2010/08/24 23:03:33
good catch.
| |
| 75 virtual void OnInitializeComplete(const VideoCodecInfo& info) = 0; | 76 virtual void OnInitializeComplete(const VideoCodecInfo& info) = 0; |
| 76 virtual void OnUninitializeComplete() = 0; | 77 virtual void OnUninitializeComplete() = 0; |
| 77 virtual void OnFlushComplete() = 0; | 78 virtual void OnFlushComplete() = 0; |
| 78 virtual void OnSeekComplete() = 0; | 79 virtual void OnSeekComplete() = 0; |
| 79 virtual void OnError() = 0; | 80 virtual void OnError() = 0; |
| 80 virtual void OnFormatChange(VideoStreamInfo stream_info) = 0; | 81 virtual void OnFormatChange(VideoStreamInfo stream_info) = 0; |
| 81 virtual void OnEmptyBufferCallback(scoped_refptr<Buffer> buffer) = 0; | 82 virtual void OnEmptyBufferCallback(scoped_refptr<Buffer> buffer) = 0; |
| 82 virtual void OnFillBufferCallback(scoped_refptr<VideoFrame> frame) = 0; | 83 virtual void OnFillBufferCallback(scoped_refptr<VideoFrame> frame) = 0; |
| 83 }; | 84 }; |
| 84 | 85 |
| 85 VideoDecodeEngine() {} | 86 VideoDecodeEngine() {} |
| 86 virtual ~VideoDecodeEngine() {} | 87 virtual ~VideoDecodeEngine() {} |
| 87 | 88 |
| 88 // Initialized the engine with specified configuration. |message_loop| could | 89 // Initialized the engine with specified configuration. |message_loop| could |
| 89 // be NULL if every operation is synchronous. Engine should call the | 90 // be NULL if every operation is synchronous. Engine should call the |
| 90 // EventHandler::OnInitializeDone() no matter finished successfully or not. | 91 // EventHandler::OnInitializeDone() no matter finished successfully or not. |
| 91 // TODO(jiesun): remove message_loop and create thread inside openmax engine? | 92 // TODO(jiesun): remove message_loop and create thread inside openmax engine? |
| 92 // or create thread in GpuVideoDecoder and pass message loop here? | 93 // or create thread in GpuVideoDecoder and pass message loop here? |
| 93 virtual void Initialize(MessageLoop* message_loop, | 94 virtual void Initialize(MessageLoop* message_loop, |
| 94 EventHandler* event_handler, | 95 EventHandler* event_handler, |
| 95 const VideoCodecConfig& config) = 0; | 96 const VideoCodecConfig& config) = 0; |
| 96 | 97 |
| 97 // Uninitialize the engine. Engine should destroy all resources and call | 98 // Uninitialize the engine. Engine should destroy all resources and call |
| 98 // EventHandler::OnInitializeDone(). | 99 // EventHandler::OnUninitializeComplete(). |
| 99 virtual void Uninitialize() = 0; | 100 virtual void Uninitialize() = 0; |
| 100 | 101 |
| 101 // Flush the engine. Engine should return all the buffers to owner ( which | 102 // Flush the engine. Engine should return all the buffers to owner ( which |
| 102 // could be itself. ) then call EventHandler::OnFlushDone(). | 103 // could be itself. ) then call EventHandler::OnFlushDone(). |
| 103 virtual void Flush() = 0; | 104 virtual void Flush() = 0; |
| 104 | 105 |
| 105 // Used in openmax to InitialReadBuffers(). | 106 // Used in openmax to InitialReadBuffers(). |
| 106 virtual void Seek() = 0; // TODO(jiesun): Do we need this? | 107 virtual void Seek() = 0; // TODO(jiesun): Do we need this? |
| 107 | 108 |
| 108 // Buffer exchange method for input and output stream. | 109 // Buffer exchange method for input and output stream. |
| 109 // These functions and callbacks could be used in two scenarios for both | 110 // These functions and callbacks could be used in two scenarios for both |
| 110 // input and output streams: | 111 // input and output streams: |
| 111 // 1. Engine provide buffers. | 112 // 1. Engine provide buffers. |
| 112 // 2. Outside party provide buffers. | 113 // 2. Outside party provide buffers. |
| 113 // The currently planned engine implementation: | 114 // The currently planned engine implementation: |
| 114 // 1. provides the input buffer request inside engine through | 115 // 1. provides the input buffer request inside engine through |
| 115 // |EmptyThisBufferCallback|. The engine implementation has better knowledge | 116 // |EmptyThisBufferCallback|. The engine implementation has better knowledge |
| 116 // of the decoder reordering delay and jittery removal requirements. Input | 117 // of the decoder reordering delay and jittery removal requirements. Input |
| 117 // buffers are returned into engine through |EmptyThisBuffer|. | 118 // buffers are returned into engine through |EmptyThisBuffer|. |
| 118 // 2. Output buffers are provided from outside the engine, and feed into | 119 // 2. Output buffers are provided from outside the engine, and feed into |
| 119 // engine through |FillThisBuffer|. Output buffers are returned to outside | 120 // engine through |FillThisBuffer|. Output buffers are returned to outside |
| 120 // by |FillThisBufferCallback|. | 121 // by |FillThisBufferCallback|. |
| 121 virtual void EmptyThisBuffer(scoped_refptr<Buffer> buffer) = 0; | 122 virtual void EmptyThisBuffer(scoped_refptr<Buffer> buffer) = 0; |
| 122 virtual void FillThisBuffer(scoped_refptr<VideoFrame> frame) = 0; | 123 virtual void FillThisBuffer(scoped_refptr<VideoFrame> frame) = 0; |
| 123 }; | 124 }; |
| 124 | 125 |
| 125 } // namespace media | 126 } // namespace media |
| 126 | 127 |
| 127 #endif // MEDIA_FILTERS_VIDEO_DECODE_ENGINE_H_ | 128 #endif // MEDIA_FILTERS_VIDEO_DECODE_ENGINE_H_ |
| OLD | NEW |