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/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
| 12 #include "media/base/cdm_context.h" |
12 #include "media/base/media_export.h" | 13 #include "media/base/media_export.h" |
13 #include "media/base/pipeline_status.h" | 14 #include "media/base/pipeline_status.h" |
14 #include "ui/gfx/geometry/size.h" | 15 #include "ui/gfx/geometry/size.h" |
15 | 16 |
16 namespace media { | 17 namespace media { |
17 | 18 |
18 class DecoderBuffer; | 19 class DecoderBuffer; |
19 class VideoDecoderConfig; | 20 class VideoDecoderConfig; |
20 class VideoFrame; | 21 class VideoFrame; |
21 | 22 |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 // Initializes a VideoDecoder with the given |config|, executing the | 57 // Initializes a VideoDecoder with the given |config|, executing the |
57 // |init_cb| upon completion. |output_cb| is called for each output frame | 58 // |init_cb| upon completion. |output_cb| is called for each output frame |
58 // decoded by Decode(). | 59 // decoded by Decode(). |
59 // | 60 // |
60 // If |low_delay| is true then the decoder is not allowed to queue frames, | 61 // If |low_delay| is true then the decoder is not allowed to queue frames, |
61 // except for out-of-order frames, i.e. if the next frame can be returned it | 62 // except for out-of-order frames, i.e. if the next frame can be returned it |
62 // must be returned without waiting for Decode() to be called again. | 63 // must be returned without waiting for Decode() to be called again. |
63 // Initialization should fail if |low_delay| is true and the decoder cannot | 64 // Initialization should fail if |low_delay| is true and the decoder cannot |
64 // satisfy the requirements above. | 65 // satisfy the requirements above. |
65 // | 66 // |
| 67 // |set_cdm_ready_cb| can be used to set/cancel a CdmReadyCB with which the |
| 68 // decoder can be notified when a CDM is ready. The decoder can use the CDM to |
| 69 // handle encrypted video stream. |
| 70 // |
66 // Note: | 71 // Note: |
67 // 1) The VideoDecoder will be reinitialized if it was initialized before. | 72 // 1) The VideoDecoder will be reinitialized if it was initialized before. |
68 // Upon reinitialization, all internal buffered frames will be dropped. | 73 // Upon reinitialization, all internal buffered frames will be dropped. |
69 // 2) This method should not be called during pending decode or reset. | 74 // 2) This method should not be called during pending decode or reset. |
70 // 3) No VideoDecoder calls should be made before |init_cb| is executed. | 75 // 3) No VideoDecoder calls should be made before |init_cb| is executed. |
71 virtual void Initialize(const VideoDecoderConfig& config, | 76 virtual void Initialize(const VideoDecoderConfig& config, |
72 bool low_delay, | 77 bool low_delay, |
| 78 const SetCdmReadyCB& set_cdm_ready_cb, |
73 const InitCB& init_cb, | 79 const InitCB& init_cb, |
74 const OutputCB& output_cb) = 0; | 80 const OutputCB& output_cb) = 0; |
75 | 81 |
76 // Requests a |buffer| to be decoded. The status of the decoder and decoded | 82 // Requests a |buffer| to be decoded. The status of the decoder and decoded |
77 // frame are returned via the provided callback. Some decoders may allow | 83 // frame are returned via the provided callback. Some decoders may allow |
78 // decoding multiple buffers in parallel. Callers should call | 84 // decoding multiple buffers in parallel. Callers should call |
79 // GetMaxDecodeRequests() to get number of buffers that may be decoded in | 85 // GetMaxDecodeRequests() to get number of buffers that may be decoded in |
80 // parallel. Decoder must call |decode_cb| in the same order in which Decode() | 86 // parallel. Decoder must call |decode_cb| in the same order in which Decode() |
81 // is called. | 87 // is called. |
82 // | 88 // |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 // Returns maximum number of parallel decode requests. | 120 // Returns maximum number of parallel decode requests. |
115 virtual int GetMaxDecodeRequests() const; | 121 virtual int GetMaxDecodeRequests() const; |
116 | 122 |
117 private: | 123 private: |
118 DISALLOW_COPY_AND_ASSIGN(VideoDecoder); | 124 DISALLOW_COPY_AND_ASSIGN(VideoDecoder); |
119 }; | 125 }; |
120 | 126 |
121 } // namespace media | 127 } // namespace media |
122 | 128 |
123 #endif // MEDIA_BASE_VIDEO_DECODER_H_ | 129 #endif // MEDIA_BASE_VIDEO_DECODER_H_ |
OLD | NEW |