| 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/pipeline_status.h" | 10 #include "media/base/pipeline_status.h" |
| 11 #include "media/base/media_export.h" | 11 #include "media/base/media_export.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 DemuxerStream; | 16 class DemuxerStream; |
| 17 class VideoFrame; | 17 class VideoFrame; |
| 18 | 18 |
| 19 class MEDIA_EXPORT VideoDecoder { | 19 class MEDIA_EXPORT VideoDecoder |
| 20 : public base::RefCountedThreadSafe<VideoDecoder> { |
| 20 public: | 21 public: |
| 21 // Status codes for read operations on VideoDecoder. | 22 // Status codes for read operations on VideoDecoder. |
| 22 enum Status { | 23 enum Status { |
| 23 kOk, // Everything went as planned. | 24 kOk, // Everything went as planned. |
| 24 kDecodeError, // Decoding error happened. | 25 kDecodeError, // Decoding error happened. |
| 25 kDecryptError // Decrypting error happened. | 26 kDecryptError // Decrypting error happened. |
| 26 }; | 27 }; |
| 27 | 28 |
| 28 VideoDecoder(); | |
| 29 virtual ~VideoDecoder(); | |
| 30 | |
| 31 // Initializes a VideoDecoder with the given DemuxerStream, executing the | 29 // Initializes a VideoDecoder with the given DemuxerStream, executing the |
| 32 // |status_cb| upon completion. | 30 // |status_cb| upon completion. |
| 33 // |statistics_cb| is used to update the global pipeline statistics. | 31 // |statistics_cb| is used to update the global pipeline statistics. |
| 34 // Note: | 32 // Note: |
| 35 // 1) No VideoDecoder calls should be made before |status_cb| is executed. | 33 // 1) No VideoDecoder calls should be made before |status_cb| is executed. |
| 36 // 2) DemuxerStream should not be accessed after the VideoDecoder is stopped. | 34 // 2) DemuxerStream should not be accessed after the VideoDecoder is stopped. |
| 37 virtual void Initialize(const scoped_refptr<DemuxerStream>& stream, | 35 virtual void Initialize(const scoped_refptr<DemuxerStream>& stream, |
| 38 const PipelineStatusCB& status_cb, | 36 const PipelineStatusCB& status_cb, |
| 39 const StatisticsCB& statistics_cb) = 0; | 37 const StatisticsCB& statistics_cb) = 0; |
| 40 | 38 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 // have alpha so the default is false. Override and return true for decoders | 70 // have alpha so the default is false. Override and return true for decoders |
| 73 // that return formats with an alpha channel. | 71 // that return formats with an alpha channel. |
| 74 virtual bool HasAlpha() const; | 72 virtual bool HasAlpha() const; |
| 75 | 73 |
| 76 // Returns true if the decoder currently has the ability to decode and return | 74 // Returns true if the decoder currently has the ability to decode and return |
| 77 // a VideoFrame. Most implementations can allocate a new VideoFrame and hence | 75 // a VideoFrame. Most implementations can allocate a new VideoFrame and hence |
| 78 // this will always return true. Override and return false for decoders that | 76 // this will always return true. Override and return false for decoders that |
| 79 // use a fixed set of VideoFrames for decoding. | 77 // use a fixed set of VideoFrames for decoding. |
| 80 virtual bool HasOutputFrameAvailable() const; | 78 virtual bool HasOutputFrameAvailable() const; |
| 81 | 79 |
| 82 private: | 80 protected: |
| 81 friend class base::RefCountedThreadSafe<VideoDecoder>; |
| 82 virtual ~VideoDecoder(); |
| 83 VideoDecoder(); |
| 84 |
| 83 DISALLOW_COPY_AND_ASSIGN(VideoDecoder); | 85 DISALLOW_COPY_AND_ASSIGN(VideoDecoder); |
| 84 }; | 86 }; |
| 85 | 87 |
| 86 } // namespace media | 88 } // namespace media |
| 87 | 89 |
| 88 #endif // MEDIA_BASE_VIDEO_DECODER_H_ | 90 #endif // MEDIA_BASE_VIDEO_DECODER_H_ |
| OLD | NEW |