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