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