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 // |release_resources_cb| - Callback used to release resources. | |
23 // |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 |
24 // demuxer config has changed. | 23 // demuxer config has changed. |
25 VideoDecoderJob( | 24 VideoDecoderJob( |
26 const base::Closure& request_data_cb, | 25 const base::Closure& request_data_cb, |
27 const base::Closure& request_resources_cb, | 26 const base::Closure& request_resources_cb, |
28 const base::Closure& release_resources_cb, | |
29 const base::Closure& on_demuxer_config_changed_cb); | 27 const base::Closure& on_demuxer_config_changed_cb); |
30 virtual ~VideoDecoderJob(); | 28 virtual ~VideoDecoderJob(); |
31 | 29 |
32 // 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 |
33 // can be used by the decoder, or false otherwise. | 31 // can be used by the decoder, or false otherwise. |
34 bool SetVideoSurface(gfx::ScopedJavaSurface surface); | 32 bool SetVideoSurface(gfx::ScopedJavaSurface surface); |
35 | 33 |
36 // MediaDecoderJob implementation. | 34 // MediaDecoderJob implementation. |
37 virtual bool HasStream() const OVERRIDE; | 35 virtual bool HasStream() const OVERRIDE; |
38 virtual void Flush() OVERRIDE; | 36 virtual void Flush() OVERRIDE; |
(...skipping 15 matching lines...) Expand all Loading... |
54 base::TimeDelta current_presentation_timestamp, | 52 base::TimeDelta current_presentation_timestamp, |
55 const ReleaseOutputCompletionCallback& callback) OVERRIDE; | 53 const ReleaseOutputCompletionCallback& callback) OVERRIDE; |
56 virtual bool ComputeTimeToRender() const OVERRIDE; | 54 virtual bool ComputeTimeToRender() const OVERRIDE; |
57 virtual void UpdateDemuxerConfigs(const DemuxerConfigs& configs) OVERRIDE; | 55 virtual void UpdateDemuxerConfigs(const DemuxerConfigs& configs) OVERRIDE; |
58 virtual bool IsCodecReconfigureNeeded( | 56 virtual bool IsCodecReconfigureNeeded( |
59 const DemuxerConfigs& configs) const OVERRIDE; | 57 const DemuxerConfigs& configs) const OVERRIDE; |
60 virtual bool AreDemuxerConfigsChanged( | 58 virtual bool AreDemuxerConfigsChanged( |
61 const DemuxerConfigs& configs) const OVERRIDE; | 59 const DemuxerConfigs& configs) const OVERRIDE; |
62 virtual bool CreateMediaCodecBridgeInternal() OVERRIDE; | 60 virtual bool CreateMediaCodecBridgeInternal() OVERRIDE; |
63 virtual void CurrentDataConsumed(bool is_config_change) OVERRIDE; | 61 virtual void CurrentDataConsumed(bool is_config_change) OVERRIDE; |
64 virtual void OnMediaCodecBridgeReleased() OVERRIDE; | |
65 | 62 |
66 // Returns true if a protected surface is required for video playback. | 63 // Returns true if a protected surface is required for video playback. |
67 bool IsProtectedSurfaceRequired(); | 64 bool IsProtectedSurfaceRequired(); |
68 | 65 |
69 // Video configs from the demuxer. | 66 // Video configs from the demuxer. |
70 VideoCodec video_codec_; | 67 VideoCodec video_codec_; |
71 int width_; | 68 int width_; |
72 int height_; | 69 int height_; |
73 | 70 |
74 // The surface object currently owned by the player. | 71 // The surface object currently owned by the player. |
75 gfx::ScopedJavaSurface surface_; | 72 gfx::ScopedJavaSurface surface_; |
76 | 73 |
77 // Callbacks to inform the caller about decoder resources change. | 74 // Callbacks to inform the caller about decoder resources change. |
78 base::Closure request_resources_cb_; | 75 base::Closure request_resources_cb_; |
79 base::Closure release_resources_cb_; | 76 base::Closure release_resources_cb_; |
80 | 77 |
81 // Track whether the next access unit is an I-frame. The first access | 78 // Track whether the next access unit is an I-frame. The first access |
82 // unit after Flush() and CurrentDataConsumed(true) is guaranteed to be an | 79 // unit after Flush() and CurrentDataConsumed(true) is guaranteed to be an |
83 // I-frame. | 80 // I-frame. |
84 bool next_video_data_is_iframe_; | 81 bool next_video_data_is_iframe_; |
85 | 82 |
86 DISALLOW_COPY_AND_ASSIGN(VideoDecoderJob); | 83 DISALLOW_COPY_AND_ASSIGN(VideoDecoderJob); |
87 }; | 84 }; |
88 | 85 |
89 } // namespace media | 86 } // namespace media |
90 | 87 |
91 #endif // MEDIA_BASE_ANDROID_VIDEO_DECODER_JOB_H_ | 88 #endif // MEDIA_BASE_ANDROID_VIDEO_DECODER_JOB_H_ |
OLD | NEW |