| 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 <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| 11 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
| 13 #include "media/base/decode_status.h" |
| 13 #include "media/base/media_export.h" | 14 #include "media/base/media_export.h" |
| 14 #include "media/base/pipeline_status.h" | 15 #include "media/base/pipeline_status.h" |
| 15 #include "ui/gfx/geometry/size.h" | 16 #include "ui/gfx/geometry/size.h" |
| 16 | 17 |
| 17 namespace media { | 18 namespace media { |
| 18 | 19 |
| 19 class CdmContext; | 20 class CdmContext; |
| 20 class DecoderBuffer; | 21 class DecoderBuffer; |
| 21 class VideoDecoderConfig; | 22 class VideoDecoderConfig; |
| 22 class VideoFrame; | 23 class VideoFrame; |
| 23 | 24 |
| 24 class MEDIA_EXPORT VideoDecoder { | 25 class MEDIA_EXPORT VideoDecoder { |
| 25 public: | 26 public: |
| 26 // Status codes for decode operations on VideoDecoder. | |
| 27 // TODO(rileya): Now that both AudioDecoder and VideoDecoder Status enums | |
| 28 // match, break them into a decoder_status.h. | |
| 29 enum Status { | |
| 30 kOk, // Everything went as planned. | |
| 31 kAborted, // Decode was aborted as a result of Reset() being called. | |
| 32 kDecodeError // Decoding error happened. | |
| 33 }; | |
| 34 | |
| 35 // Callback for VideoDecoder initialization. | 27 // Callback for VideoDecoder initialization. |
| 36 typedef base::Callback<void(bool success)> InitCB; | 28 typedef base::Callback<void(bool success)> InitCB; |
| 37 | 29 |
| 38 // Callback for VideoDecoder to return a decoded frame whenever it becomes | 30 // Callback for VideoDecoder to return a decoded frame whenever it becomes |
| 39 // available. Only non-EOS frames should be returned via this callback. | 31 // available. Only non-EOS frames should be returned via this callback. |
| 40 typedef base::Callback<void(const scoped_refptr<VideoFrame>&)> OutputCB; | 32 typedef base::Callback<void(const scoped_refptr<VideoFrame>&)> OutputCB; |
| 41 | 33 |
| 42 // Callback type for Decode(). Called after the decoder has completed decoding | 34 // Callback type for Decode(). Called after the decoder has completed decoding |
| 43 // corresponding DecoderBuffer, indicating that it's ready to accept another | 35 // corresponding DecoderBuffer, indicating that it's ready to accept another |
| 44 // buffer to decode. | 36 // buffer to decode. |
| 45 typedef base::Callback<void(Status status)> DecodeCB; | 37 typedef base::Callback<void(DecodeStatus)> DecodeCB; |
| 46 | 38 |
| 47 VideoDecoder(); | 39 VideoDecoder(); |
| 48 | 40 |
| 49 // Fires any pending callbacks, stops and destroys the decoder. | 41 // Fires any pending callbacks, stops and destroys the decoder. |
| 50 // Note: Since this is a destructor, |this| will be destroyed after this call. | 42 // Note: Since this is a destructor, |this| will be destroyed after this call. |
| 51 // Make sure the callbacks fired from this call doesn't post any task that | 43 // Make sure the callbacks fired from this call doesn't post any task that |
| 52 // depends on |this|. | 44 // depends on |this|. |
| 53 virtual ~VideoDecoder(); | 45 virtual ~VideoDecoder(); |
| 54 | 46 |
| 55 // Returns the name of the decoder for logging purpose. | 47 // Returns the name of the decoder for logging purpose. |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 // Returns maximum number of parallel decode requests. | 112 // Returns maximum number of parallel decode requests. |
| 121 virtual int GetMaxDecodeRequests() const; | 113 virtual int GetMaxDecodeRequests() const; |
| 122 | 114 |
| 123 private: | 115 private: |
| 124 DISALLOW_COPY_AND_ASSIGN(VideoDecoder); | 116 DISALLOW_COPY_AND_ASSIGN(VideoDecoder); |
| 125 }; | 117 }; |
| 126 | 118 |
| 127 } // namespace media | 119 } // namespace media |
| 128 | 120 |
| 129 #endif // MEDIA_BASE_VIDEO_DECODER_H_ | 121 #endif // MEDIA_BASE_VIDEO_DECODER_H_ |
| OLD | NEW |