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/cdm_context.h" | |
14 #include "media/base/media_export.h" | 13 #include "media/base/media_export.h" |
15 #include "media/base/pipeline_status.h" | 14 #include "media/base/pipeline_status.h" |
16 #include "ui/gfx/geometry/size.h" | 15 #include "ui/gfx/geometry/size.h" |
17 | 16 |
18 namespace media { | 17 namespace media { |
19 | 18 |
| 19 class CdmContext; |
20 class DecoderBuffer; | 20 class DecoderBuffer; |
21 class VideoDecoderConfig; | 21 class VideoDecoderConfig; |
22 class VideoFrame; | 22 class VideoFrame; |
23 | 23 |
24 class MEDIA_EXPORT VideoDecoder { | 24 class MEDIA_EXPORT VideoDecoder { |
25 public: | 25 public: |
26 // Status codes for decode operations on VideoDecoder. | 26 // Status codes for decode operations on VideoDecoder. |
27 // TODO(rileya): Now that both AudioDecoder and VideoDecoder Status enums | 27 // TODO(rileya): Now that both AudioDecoder and VideoDecoder Status enums |
28 // match, break them into a decoder_status.h. | 28 // match, break them into a decoder_status.h. |
29 enum Status { | 29 enum Status { |
(...skipping 28 matching lines...) Expand all Loading... |
58 // Initializes a VideoDecoder with the given |config|, executing the | 58 // Initializes a VideoDecoder with the given |config|, executing the |
59 // |init_cb| upon completion. |output_cb| is called for each output frame | 59 // |init_cb| upon completion. |output_cb| is called for each output frame |
60 // decoded by Decode(). | 60 // decoded by Decode(). |
61 // | 61 // |
62 // If |low_delay| is true then the decoder is not allowed to queue frames, | 62 // If |low_delay| is true then the decoder is not allowed to queue frames, |
63 // except for out-of-order frames, i.e. if the next frame can be returned it | 63 // except for out-of-order frames, i.e. if the next frame can be returned it |
64 // must be returned without waiting for Decode() to be called again. | 64 // must be returned without waiting for Decode() to be called again. |
65 // Initialization should fail if |low_delay| is true and the decoder cannot | 65 // Initialization should fail if |low_delay| is true and the decoder cannot |
66 // satisfy the requirements above. | 66 // satisfy the requirements above. |
67 // | 67 // |
68 // |set_cdm_ready_cb| can be used to set/cancel a CdmReadyCB with which the | 68 // |cdm_context| can be used to handle encrypted buffers. May be null if the |
69 // decoder can be notified when a CDM is ready. The decoder can use the CDM to | 69 // stream is not encrypted. |
70 // handle encrypted video stream. | |
71 // | 70 // |
72 // Note: | 71 // Note: |
73 // 1) The VideoDecoder will be reinitialized if it was initialized before. | 72 // 1) The VideoDecoder will be reinitialized if it was initialized before. |
74 // Upon reinitialization, all internal buffered frames will be dropped. | 73 // Upon reinitialization, all internal buffered frames will be dropped. |
75 // 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. |
76 // 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. |
77 virtual void Initialize(const VideoDecoderConfig& config, | 76 virtual void Initialize(const VideoDecoderConfig& config, |
78 bool low_delay, | 77 bool low_delay, |
79 const SetCdmReadyCB& set_cdm_ready_cb, | 78 CdmContext* cdm_context, |
80 const InitCB& init_cb, | 79 const InitCB& init_cb, |
81 const OutputCB& output_cb) = 0; | 80 const OutputCB& output_cb) = 0; |
82 | 81 |
83 // 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 |
84 // frame are returned via the provided callback. Some decoders may allow | 83 // frame are returned via the provided callback. Some decoders may allow |
85 // decoding multiple buffers in parallel. Callers should call | 84 // decoding multiple buffers in parallel. Callers should call |
86 // GetMaxDecodeRequests() to get number of buffers that may be decoded in | 85 // GetMaxDecodeRequests() to get number of buffers that may be decoded in |
87 // 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() |
88 // is called. | 87 // is called. |
89 // | 88 // |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 // Returns maximum number of parallel decode requests. | 120 // Returns maximum number of parallel decode requests. |
122 virtual int GetMaxDecodeRequests() const; | 121 virtual int GetMaxDecodeRequests() const; |
123 | 122 |
124 private: | 123 private: |
125 DISALLOW_COPY_AND_ASSIGN(VideoDecoder); | 124 DISALLOW_COPY_AND_ASSIGN(VideoDecoder); |
126 }; | 125 }; |
127 | 126 |
128 } // namespace media | 127 } // namespace media |
129 | 128 |
130 #endif // MEDIA_BASE_VIDEO_DECODER_H_ | 129 #endif // MEDIA_BASE_VIDEO_DECODER_H_ |
OLD | NEW |