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" |
11 | 11 |
12 // FFmpeg types. | 12 // FFmpeg types. |
13 // | 13 // |
14 // TODO(ajwong): Try to cut the dependency on the FFmpeg types. | 14 // TODO(ajwong): Try to cut the dependency on the FFmpeg types. |
15 struct AVStream; | 15 struct AVStream; |
16 | 16 |
17 class Task; | 17 class Task; |
18 | 18 |
19 namespace media { | 19 namespace media { |
20 | 20 |
21 class Buffer; | 21 class Buffer; |
22 | 22 |
23 class VideoDecodeEngine { | 23 class VideoDecodeEngine { |
24 public: | 24 public: |
25 enum State { | 25 enum State { |
26 kCreated, | 26 kCreated, |
27 kNormal, | 27 kNormal, |
28 kStopped, | 28 kStopped, |
| 29 kFlushing, |
29 kError, | 30 kError, |
30 }; | 31 }; |
31 | 32 |
32 VideoDecodeEngine() {} | 33 VideoDecodeEngine() {} |
33 virtual ~VideoDecodeEngine() {} | 34 virtual ~VideoDecodeEngine() {} |
34 | 35 |
35 // This calback is called by the decode engine to notify that the decode | 36 // This calback is called by the decode engine to notify that the decode |
36 // engine has consumed an input bufer in response to a EmptyThisBuffer() call. | 37 // engine has consumed an input bufer in response to a EmptyThisBuffer() call. |
37 typedef Callback1<scoped_refptr<Buffer> >::Type EmptyThisBufferCallback; | 38 typedef Callback1<scoped_refptr<Buffer> >::Type EmptyThisBufferCallback; |
38 | 39 |
(...skipping 19 matching lines...) Expand all Loading... |
58 // of the decoder reordering delay and jittery removal requirements. Input | 59 // of the decoder reordering delay and jittery removal requirements. Input |
59 // buffers are returned into engine through |EmptyThisBuffer|. | 60 // buffers are returned into engine through |EmptyThisBuffer|. |
60 // 2. Output buffers are provided from outside the engine, and feed into | 61 // 2. Output buffers are provided from outside the engine, and feed into |
61 // engine through |FillThisBuffer|. Output buffers are returned to outside | 62 // engine through |FillThisBuffer|. Output buffers are returned to outside |
62 // by |FillThisBufferCallback|. | 63 // by |FillThisBufferCallback|. |
63 virtual void EmptyThisBuffer(scoped_refptr<Buffer> buffer) = 0; | 64 virtual void EmptyThisBuffer(scoped_refptr<Buffer> buffer) = 0; |
64 virtual void FillThisBuffer(scoped_refptr<VideoFrame> frame) = 0; | 65 virtual void FillThisBuffer(scoped_refptr<VideoFrame> frame) = 0; |
65 | 66 |
66 virtual void Stop(Task* done_cb) = 0; | 67 virtual void Stop(Task* done_cb) = 0; |
67 virtual void Pause(Task* done_cb) = 0; | 68 virtual void Pause(Task* done_cb) = 0; |
| 69 virtual void Seek(Task* done_cb) = 0; |
68 | 70 |
69 // Flushes the decode engine of any buffered input packets. | 71 // Flushes the decode engine of any buffered input packets. |
70 virtual void Flush(Task* done_cb) = 0; | 72 virtual void Flush(Task* done_cb) = 0; |
71 | 73 |
72 // Returns the VideoSurface::Format of the resulting |yuv_frame| from | 74 // Returns the VideoSurface::Format of the resulting |yuv_frame| from |
73 // DecodeFrame(). | 75 // DecodeFrame(). |
74 virtual VideoFrame::Format GetSurfaceFormat() const = 0; | 76 virtual VideoFrame::Format GetSurfaceFormat() const = 0; |
75 | 77 |
| 78 virtual bool ProvidesBuffer() const = 0; |
| 79 |
76 // Returns the current state of the decode engine. | 80 // Returns the current state of the decode engine. |
77 virtual State state() const = 0; | 81 virtual State state() const = 0; |
78 }; | 82 }; |
79 | 83 |
80 } // namespace media | 84 } // namespace media |
81 | 85 |
82 #endif // MEDIA_FILTERS_VIDEO_DECODE_ENGINE_H_ | 86 #endif // MEDIA_FILTERS_VIDEO_DECODE_ENGINE_H_ |
OLD | NEW |