OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_VIDEO_DECODER_JOB_H_ | 5 #ifndef MEDIA_BASE_ANDROID_VIDEO_DECODER_JOB_H_ |
6 #define MEDIA_BASE_ANDROID_VIDEO_DECODER_JOB_H_ | 6 #define MEDIA_BASE_ANDROID_VIDEO_DECODER_JOB_H_ |
7 | 7 |
8 #include <jni.h> | 8 #include <jni.h> |
9 | 9 |
10 #include "media/base/android/media_decoder_job.h" | 10 #include "media/base/android/media_decoder_job.h" |
11 | 11 |
12 namespace media { | 12 namespace media { |
13 | 13 |
14 class VideoCodecBridge; | 14 class VideoCodecBridge; |
15 | 15 |
16 // Class for managing video decoding jobs. | 16 // Class for managing video decoding jobs. |
17 class VideoDecoderJob : public MediaDecoderJob { | 17 class VideoDecoderJob : public MediaDecoderJob { |
18 public: | 18 public: |
19 // Create a new VideoDecoderJob instance. | 19 // Create a new VideoDecoderJob instance. |
20 // |request_data_cb| - Callback used to request more data for the decoder. | 20 // |request_data_cb| - Callback used to request more data for the decoder. |
21 // |request_resources_cb| - Callback used to request resources. | 21 // |request_resources_cb| - Callback used to request resources. |
22 // |on_demuxer_config_changed_cb| - Callback used to inform the caller that | 22 // |on_demuxer_config_changed_cb| - Callback used to inform the caller that |
23 // demuxer config has changed. | 23 // demuxer config has changed. |
24 VideoDecoderJob( | 24 VideoDecoderJob( |
25 const base::Closure& request_data_cb, | 25 const base::Closure& request_data_cb, |
26 const base::Closure& request_resources_cb, | 26 const base::Closure& request_resources_cb, |
27 const base::Closure& on_demuxer_config_changed_cb); | 27 const base::Closure& on_demuxer_config_changed_cb); |
28 virtual ~VideoDecoderJob(); | 28 ~VideoDecoderJob() override; |
29 | 29 |
30 // Passes a java surface object to the codec. Returns true if the surface | 30 // Passes a java surface object to the codec. Returns true if the surface |
31 // can be used by the decoder, or false otherwise. | 31 // can be used by the decoder, or false otherwise. |
32 bool SetVideoSurface(gfx::ScopedJavaSurface surface); | 32 bool SetVideoSurface(gfx::ScopedJavaSurface surface); |
33 | 33 |
34 // MediaDecoderJob implementation. | 34 // MediaDecoderJob implementation. |
35 virtual bool HasStream() const override; | 35 bool HasStream() const override; |
36 virtual void ReleaseDecoderResources() override; | 36 void ReleaseDecoderResources() override; |
37 virtual void SetDemuxerConfigs(const DemuxerConfigs& configs) override; | 37 void SetDemuxerConfigs(const DemuxerConfigs& configs) override; |
38 | 38 |
39 int output_width() const { return output_width_; } | 39 int output_width() const { return output_width_; } |
40 int output_height() const { return output_height_; } | 40 int output_height() const { return output_height_; } |
41 | 41 |
42 private: | 42 private: |
43 // MediaDecoderJob implementation. | 43 // MediaDecoderJob implementation. |
44 virtual void ReleaseOutputBuffer( | 44 void ReleaseOutputBuffer( |
45 int output_buffer_index, | 45 int output_buffer_index, |
46 size_t size, | 46 size_t size, |
47 bool render_output, | 47 bool render_output, |
48 base::TimeDelta current_presentation_timestamp, | 48 base::TimeDelta current_presentation_timestamp, |
49 const ReleaseOutputCompletionCallback& callback) override; | 49 const ReleaseOutputCompletionCallback& callback) override; |
50 virtual bool ComputeTimeToRender() const override; | 50 bool ComputeTimeToRender() const override; |
51 virtual bool IsCodecReconfigureNeeded( | 51 bool IsCodecReconfigureNeeded(const DemuxerConfigs& configs) const override; |
52 const DemuxerConfigs& configs) const override; | 52 bool AreDemuxerConfigsChanged(const DemuxerConfigs& configs) const override; |
53 virtual bool AreDemuxerConfigsChanged( | 53 MediaDecoderJobStatus CreateMediaCodecBridgeInternal() override; |
54 const DemuxerConfigs& configs) const override; | 54 bool UpdateOutputFormat() override; |
55 virtual MediaDecoderJobStatus CreateMediaCodecBridgeInternal() override; | |
56 virtual bool UpdateOutputFormat() override; | |
57 | 55 |
58 // Returns true if a protected surface is required for video playback. | 56 // Returns true if a protected surface is required for video playback. |
59 bool IsProtectedSurfaceRequired(); | 57 bool IsProtectedSurfaceRequired(); |
60 | 58 |
61 // Video configs from the demuxer. | 59 // Video configs from the demuxer. |
62 VideoCodec video_codec_; | 60 VideoCodec video_codec_; |
63 int config_width_; | 61 int config_width_; |
64 int config_height_; | 62 int config_height_; |
65 | 63 |
66 // Video output format. | 64 // Video output format. |
67 int output_width_; | 65 int output_width_; |
68 int output_height_; | 66 int output_height_; |
69 | 67 |
70 // The surface object currently owned by the player. | 68 // The surface object currently owned by the player. |
71 gfx::ScopedJavaSurface surface_; | 69 gfx::ScopedJavaSurface surface_; |
72 | 70 |
73 // Callbacks to inform the caller about decoder resources change. | 71 // Callbacks to inform the caller about decoder resources change. |
74 base::Closure request_resources_cb_; | 72 base::Closure request_resources_cb_; |
75 base::Closure release_resources_cb_; | 73 base::Closure release_resources_cb_; |
76 | 74 |
77 DISALLOW_COPY_AND_ASSIGN(VideoDecoderJob); | 75 DISALLOW_COPY_AND_ASSIGN(VideoDecoderJob); |
78 }; | 76 }; |
79 | 77 |
80 } // namespace media | 78 } // namespace media |
81 | 79 |
82 #endif // MEDIA_BASE_ANDROID_VIDEO_DECODER_JOB_H_ | 80 #endif // MEDIA_BASE_ANDROID_VIDEO_DECODER_JOB_H_ |
OLD | NEW |