OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_ANDROID_MEDIA_CODEC_VIDEO_DECODER_H_ | 5 #ifndef MEDIA_BASE_ANDROID_MEDIA_CODEC_VIDEO_DECODER_H_ |
6 #define MEDIA_BASE_ANDROID_MEDIA_CODEC_VIDEO_DECODER_H_ | 6 #define MEDIA_BASE_ANDROID_MEDIA_CODEC_VIDEO_DECODER_H_ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 #include "media/base/android/media_codec_decoder.h" | 9 #include "media/base/android/media_codec_decoder.h" |
10 #include "ui/gfx/geometry/size.h" | 10 #include "ui/gfx/geometry/size.h" |
(...skipping 14 matching lines...) Expand all Loading... |
25 // video_size_changed_cb: reports the new video size, | 25 // video_size_changed_cb: reports the new video size, |
26 // codec_created_cb: reports that video codec has been created. A controller | 26 // codec_created_cb: reports that video codec has been created. A controller |
27 // class might use it to release more resources so that this | 27 // class might use it to release more resources so that this |
28 // decoder can use them. | 28 // decoder can use them. |
29 MediaCodecVideoDecoder( | 29 MediaCodecVideoDecoder( |
30 const scoped_refptr<base::SingleThreadTaskRunner>& media_runner, | 30 const scoped_refptr<base::SingleThreadTaskRunner>& media_runner, |
31 const base::Closure& request_data_cb, | 31 const base::Closure& request_data_cb, |
32 const base::Closure& starvation_cb, | 32 const base::Closure& starvation_cb, |
33 const base::Closure& drained_requested_cb, | 33 const base::Closure& drained_requested_cb, |
34 const base::Closure& stop_done_cb, | 34 const base::Closure& stop_done_cb, |
| 35 const base::Closure& waiting_for_decryption_key_cb, |
35 const base::Closure& error_cb, | 36 const base::Closure& error_cb, |
36 const SetTimeCallback& update_current_time_cb, | 37 const SetTimeCallback& update_current_time_cb, |
37 const VideoSizeChangedCallback& video_size_changed_cb, | 38 const VideoSizeChangedCallback& video_size_changed_cb, |
38 const base::Closure& codec_created_cb); | 39 const base::Closure& codec_created_cb); |
39 ~MediaCodecVideoDecoder() override; | 40 ~MediaCodecVideoDecoder() override; |
40 | 41 |
41 const char* class_name() const override; | 42 const char* class_name() const override; |
42 | 43 |
43 bool HasStream() const override; | 44 bool HasStream() const override; |
44 void SetDemuxerConfigs(const DemuxerConfigs& configs) override; | 45 void SetDemuxerConfigs(const DemuxerConfigs& configs) override; |
| 46 bool IsContentEncrypted() const override; |
45 void ReleaseDecoderResources() override; | 47 void ReleaseDecoderResources() override; |
46 void ReleaseMediaCodec() override; | 48 void ReleaseMediaCodec() override; |
47 | 49 |
48 // Stores the video surface to use with upcoming Configure() | 50 // Stores the video surface to use with upcoming Configure() |
49 void SetVideoSurface(gfx::ScopedJavaSurface surface); | 51 void SetVideoSurface(gfx::ScopedJavaSurface surface); |
50 | 52 |
51 // Returns true if there is a video surface to use. | 53 // Returns true if there is a video surface to use. |
52 bool HasVideoSurface() const; | 54 bool HasVideoSurface() const; |
53 | 55 |
| 56 // Sets whether protected surface is needed for the currently used DRM. |
| 57 void SetProtectedSurfaceRequired(bool value); |
| 58 |
| 59 // Returns true if protected surface is needed. |
| 60 bool IsProtectedSurfaceRequired() const; |
| 61 |
54 protected: | 62 protected: |
55 bool IsCodecReconfigureNeeded(const DemuxerConfigs& next) const override; | 63 bool IsCodecReconfigureNeeded(const DemuxerConfigs& next) const override; |
56 ConfigStatus ConfigureInternal() override; | 64 ConfigStatus ConfigureInternal(jobject media_crypto) override; |
57 void AssociateCurrentTimeWithPTS(base::TimeDelta pts) override; | 65 void AssociateCurrentTimeWithPTS(base::TimeDelta pts) override; |
58 void DissociatePTSFromTime() override; | 66 void DissociatePTSFromTime() override; |
59 void OnOutputFormatChanged() override; | 67 void OnOutputFormatChanged() override; |
60 void Render(int buffer_index, | 68 void Render(int buffer_index, |
61 size_t offset, | 69 size_t offset, |
62 size_t size, | 70 size_t size, |
63 RenderMode render_mode, | 71 RenderMode render_mode, |
64 base::TimeDelta pts, | 72 base::TimeDelta pts, |
65 bool eos_encountered) override; | 73 bool eos_encountered) override; |
66 | 74 |
(...skipping 15 matching lines...) Expand all Loading... |
82 bool eos_encountered); | 90 bool eos_encountered); |
83 | 91 |
84 // Data. | 92 // Data. |
85 | 93 |
86 // Configuration received from demuxer | 94 // Configuration received from demuxer |
87 DemuxerConfigs configs_; | 95 DemuxerConfigs configs_; |
88 | 96 |
89 // Video surface that we render to. | 97 // Video surface that we render to. |
90 gfx::ScopedJavaSurface surface_; | 98 gfx::ScopedJavaSurface surface_; |
91 | 99 |
| 100 // Flags that indicates whether we need protected surface. |
| 101 bool is_protected_surface_required_; |
| 102 |
92 // Reports current playback time to the callee. | 103 // Reports current playback time to the callee. |
93 SetTimeCallback update_current_time_cb_; | 104 SetTimeCallback update_current_time_cb_; |
94 | 105 |
95 // Informs the callee that video size is changed. | 106 // Informs the callee that video size is changed. |
96 VideoSizeChangedCallback video_size_changed_cb_; | 107 VideoSizeChangedCallback video_size_changed_cb_; |
97 | 108 |
98 // Informs the callee that the MediaCodec is created. | 109 // Informs the callee that the MediaCodec is created. |
99 base::Closure codec_created_cb_; | 110 base::Closure codec_created_cb_; |
100 | 111 |
101 // Current video size to be sent with |video_size_changed_cb_|. | 112 // Current video size to be sent with |video_size_changed_cb_|. |
102 gfx::Size video_size_; | 113 gfx::Size video_size_; |
103 | 114 |
104 // Indices of output buffers that are posted for rendering. | 115 // Indices of output buffers that are posted for rendering. |
105 std::set<int> delayed_buffers_; | 116 std::set<int> delayed_buffers_; |
106 | 117 |
107 // Associate presentation timestamps with time. | 118 // Associate presentation timestamps with time. |
108 base::TimeTicks start_time_ticks_; | 119 base::TimeTicks start_time_ticks_; |
109 base::TimeDelta start_pts_; | 120 base::TimeDelta start_pts_; |
110 | 121 |
111 // Mantain the last seen PTS for stand-alone EOS. | 122 // Mantain the last seen PTS for stand-alone EOS. |
112 base::TimeDelta last_seen_pts_; | 123 base::TimeDelta last_seen_pts_; |
113 | 124 |
114 DISALLOW_COPY_AND_ASSIGN(MediaCodecVideoDecoder); | 125 DISALLOW_COPY_AND_ASSIGN(MediaCodecVideoDecoder); |
115 }; | 126 }; |
116 | 127 |
117 } // namespace media | 128 } // namespace media |
118 | 129 |
119 #endif // MEDIA_BASE_ANDROID_MEDIA_CODEC_VIDEO_DECODER_H_ | 130 #endif // MEDIA_BASE_ANDROID_MEDIA_CODEC_VIDEO_DECODER_H_ |
OLD | NEW |