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" |
| 11 #include "media/base/pipeline_status.h" | 11 #include "media/base/pipeline_status.h" |
| 12 #include "ui/gfx/size.h" | 12 #include "ui/gfx/size.h" |
| 13 | 13 |
| 14 namespace media { | 14 namespace media { |
| 15 | 15 |
| 16 class DecoderBuffer; | 16 class DecoderBuffer; |
| 17 class VideoDecoderConfig; | 17 class VideoDecoderConfig; |
| 18 class VideoFrame; | 18 class VideoFrame; |
| 19 | 19 |
| 20 class MEDIA_EXPORT VideoDecoder { | 20 class MEDIA_EXPORT VideoDecoder { |
| 21 public: | 21 public: |
| 22 // Status codes for decode operations on VideoDecoder. | 22 // Status codes for decode operations on VideoDecoder. |
| 23 enum Status { | 23 enum Status { |
| 24 kOk, // Everything went as planned. | 24 kOk, // Everything went as planned. |
| 25 kAborted, // Decode was aborted. | |
|
xhwang
2014/01/03 01:05:58
Can we have something like:
Decode was aborted as
| |
| 25 kNotEnoughData, // Not enough data to produce a video frame. | 26 kNotEnoughData, // Not enough data to produce a video frame. |
| 26 kDecodeError, // Decoding error happened. | 27 kDecodeError, // Decoding error happened. |
| 27 kDecryptError // Decrypting error happened. | 28 kDecryptError // Decrypting error happened. |
| 28 }; | 29 }; |
| 29 | 30 |
| 30 VideoDecoder(); | 31 VideoDecoder(); |
| 31 virtual ~VideoDecoder(); | 32 virtual ~VideoDecoder(); |
| 32 | 33 |
| 33 // Initializes a VideoDecoder with the given |config|, executing the | 34 // Initializes a VideoDecoder with the given |config|, executing the |
| 34 // |status_cb| upon completion. | 35 // |status_cb| upon completion. |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 45 // Requests a |buffer| to be decoded. The status of the decoder and decoded | 46 // Requests a |buffer| to be decoded. The status of the decoder and decoded |
| 46 // frame are returned via the provided callback. Only one decode may be in | 47 // frame are returned via the provided callback. Only one decode may be in |
| 47 // flight at any given time. | 48 // flight at any given time. |
| 48 // | 49 // |
| 49 // Implementations guarantee that the callback will not be called from within | 50 // Implementations guarantee that the callback will not be called from within |
| 50 // this method. | 51 // this method. |
| 51 // | 52 // |
| 52 // If the returned status is kOk: | 53 // If the returned status is kOk: |
| 53 // - Non-EOS (end of stream) frame contains decoded video data. | 54 // - Non-EOS (end of stream) frame contains decoded video data. |
| 54 // - EOS frame indicates the end of the stream. | 55 // - EOS frame indicates the end of the stream. |
| 55 // - NULL frame indicates an aborted decode. This can happen if Reset() or | 56 // - NULL frame indicates an aborted decode. This can happen if Reset() or |
|
xhwang
2014/01/03 01:05:58
please update this as well
| |
| 56 // Stop() is called during the decoding process. | 57 // Stop() is called during the decoding process. |
| 57 // Otherwise the returned frame must be NULL. | 58 // Otherwise the returned frame must be NULL. |
| 58 typedef base::Callback<void(Status, | 59 typedef base::Callback<void(Status, |
| 59 const scoped_refptr<VideoFrame>&)> DecodeCB; | 60 const scoped_refptr<VideoFrame>&)> DecodeCB; |
| 60 virtual void Decode(const scoped_refptr<DecoderBuffer>& buffer, | 61 virtual void Decode(const scoped_refptr<DecoderBuffer>& buffer, |
| 61 const DecodeCB& decode_cb) = 0; | 62 const DecodeCB& decode_cb) = 0; |
| 62 | 63 |
| 63 // Resets decoder state, fulfilling all pending DecodeCB and dropping extra | 64 // Resets decoder state, fulfilling all pending DecodeCB and dropping extra |
| 64 // queued decoded data. After this call, the decoder is back to an initialized | 65 // queued decoded data. After this call, the decoder is back to an initialized |
| 65 // clean state. | 66 // clean state. |
| (...skipping 21 matching lines...) Expand all Loading... | |
| 87 // use a fixed set of VideoFrames for decoding. | 88 // use a fixed set of VideoFrames for decoding. |
| 88 virtual bool CanReadWithoutStalling() const; | 89 virtual bool CanReadWithoutStalling() const; |
| 89 | 90 |
| 90 private: | 91 private: |
| 91 DISALLOW_COPY_AND_ASSIGN(VideoDecoder); | 92 DISALLOW_COPY_AND_ASSIGN(VideoDecoder); |
| 92 }; | 93 }; |
| 93 | 94 |
| 94 } // namespace media | 95 } // namespace media |
| 95 | 96 |
| 96 #endif // MEDIA_BASE_VIDEO_DECODER_H_ | 97 #endif // MEDIA_BASE_VIDEO_DECODER_H_ |
| OLD | NEW |