Chromium Code Reviews| 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 #ifndef MEDIA_BASE_VIDEO_DECODER_H_ | 5 #ifndef MEDIA_BASE_VIDEO_DECODER_H_ |
| 6 #define MEDIA_BASE_VIDEO_DECODER_H_ | 6 #define MEDIA_BASE_VIDEO_DECODER_H_ |
| 7 | 7 |
| 8 #include "base/callback.h" | 8 #include "base/callback.h" |
| 9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
| 10 #include "media/base/media_export.h" | 10 #include "media/base/media_export.h" |
| (...skipping 28 matching lines...) Expand all Loading... | |
| 39 // Note: | 39 // Note: |
| 40 // 1) The VideoDecoder will be reinitialized if it was initialized before. | 40 // 1) The VideoDecoder will be reinitialized if it was initialized before. |
| 41 // Upon reinitialization, all internal buffered frames will be dropped. | 41 // Upon reinitialization, all internal buffered frames will be dropped. |
| 42 // 2) This method should not be called during pending decode, reset or stop. | 42 // 2) This method should not be called during pending decode, reset or stop. |
| 43 // 3) No VideoDecoder calls except for Stop() should be made before | 43 // 3) No VideoDecoder calls except for Stop() should be made before |
| 44 // |status_cb| is executed. | 44 // |status_cb| is executed. |
| 45 virtual void Initialize(const VideoDecoderConfig& config, | 45 virtual void Initialize(const VideoDecoderConfig& config, |
| 46 const PipelineStatusCB& status_cb) = 0; | 46 const PipelineStatusCB& status_cb) = 0; |
| 47 | 47 |
| 48 // Requests a |buffer| to be decoded. The status of the decoder and decoded | 48 // Requests a |buffer| to be decoded. The status of the decoder and decoded |
| 49 // frame are returned via the provided callback. Only one decode may be in | 49 // frame are returned via the provided callback. Some decoders may allow |
| 50 // flight at any given time. | 50 // decoding multiple frames in parallel. Callers should call |
| 51 // GetMaxDecodeRequests() to get number of frames that may be decoded in | |
| 52 // parallel. | |
|
Ami GONE FROM CHROMIUM
2014/04/16 01:00:00
An alternative approach that may work better is to
Sergey Ulanov
2014/04/16 01:44:14
Isn't DecodeStream the only client of this interfa
| |
| 51 // | 53 // |
| 52 // Implementations guarantee that the callback will not be called from within | 54 // Implementations guarantee that the callback will not be called from within |
| 53 // this method. | 55 // this method. |
| 54 // | 56 // |
| 55 // If the returned status is kOk: | 57 // If the returned status is kOk: |
| 56 // - Non-EOS (end of stream) frame contains decoded video data. | 58 // - Non-EOS (end of stream) frame contains decoded video data. |
| 57 // - EOS frame indicates the end of the stream. | 59 // - EOS frame indicates the end of the stream. |
| 58 // Otherwise the returned frame must be NULL. | 60 // Otherwise the returned frame must be NULL. |
| 59 typedef base::Callback<void(Status, | 61 typedef base::Callback<void(Status, |
| 60 const scoped_refptr<VideoFrame>&)> DecodeCB; | 62 const scoped_refptr<VideoFrame>&)> DecodeCB; |
| (...skipping 25 matching lines...) Expand all Loading... | |
| 86 | 88 |
| 87 // Returns true if the decoder needs bitstream conversion before decoding. | 89 // Returns true if the decoder needs bitstream conversion before decoding. |
| 88 virtual bool NeedsBitstreamConversion() const; | 90 virtual bool NeedsBitstreamConversion() const; |
| 89 | 91 |
| 90 // Returns true if the decoder currently has the ability to decode and return | 92 // Returns true if the decoder currently has the ability to decode and return |
| 91 // a VideoFrame. Most implementations can allocate a new VideoFrame and hence | 93 // a VideoFrame. Most implementations can allocate a new VideoFrame and hence |
| 92 // this will always return true. Override and return false for decoders that | 94 // this will always return true. Override and return false for decoders that |
| 93 // use a fixed set of VideoFrames for decoding. | 95 // use a fixed set of VideoFrames for decoding. |
| 94 virtual bool CanReadWithoutStalling() const; | 96 virtual bool CanReadWithoutStalling() const; |
| 95 | 97 |
| 98 // Returns how many frames that may be decoded in parallel. | |
| 99 virtual int GetMaxDecodeRequests() const; | |
| 100 | |
| 96 private: | 101 private: |
| 97 DISALLOW_COPY_AND_ASSIGN(VideoDecoder); | 102 DISALLOW_COPY_AND_ASSIGN(VideoDecoder); |
| 98 }; | 103 }; |
| 99 | 104 |
| 100 } // namespace media | 105 } // namespace media |
| 101 | 106 |
| 102 #endif // MEDIA_BASE_VIDEO_DECODER_H_ | 107 #endif // MEDIA_BASE_VIDEO_DECODER_H_ |
| OLD | NEW |