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.
5 #ifndef MEDIA_BASE_ANDROID_VIDEO_DECODER_JOB_H_
6 #define MEDIA_BASE_ANDROID_VIDEO_DECODER_JOB_H_
10 #include "media/base/android/media_decoder_job.h"
14 class VideoCodecBridge
;
16 // Class for managing video decoding jobs.
17 class VideoDecoderJob
: public MediaDecoderJob
{
19 // Create a new VideoDecoderJob instance.
20 // |request_data_cb| - Callback used to request more data for the decoder.
21 // |request_resources_cb| - Callback used to request resources.
22 // |on_demuxer_config_changed_cb| - Callback used to inform the caller that
23 // demuxer config has changed.
25 const base::Closure
& request_data_cb
,
26 const base::Closure
& request_resources_cb
,
27 const base::Closure
& on_demuxer_config_changed_cb
);
28 ~VideoDecoderJob() override
;
30 // Passes a java surface object to the codec. Returns true if the surface
31 // can be used by the decoder, or false otherwise.
32 bool SetVideoSurface(gfx::ScopedJavaSurface surface
);
34 // MediaDecoderJob implementation.
35 bool HasStream() const override
;
36 void ReleaseDecoderResources() override
;
37 void SetDemuxerConfigs(const DemuxerConfigs
& configs
) override
;
39 int output_width() const { return output_width_
; }
40 int output_height() const { return output_height_
; }
43 // MediaDecoderJob implementation.
44 void ReleaseOutputBuffer(
45 int output_buffer_index
,
49 base::TimeDelta current_presentation_timestamp
,
50 const ReleaseOutputCompletionCallback
& 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
;
57 // Returns true if a protected surface is required for video playback.
58 bool IsProtectedSurfaceRequired();
60 // Video configs from the demuxer.
61 VideoCodec video_codec_
;
65 // Video output format.
69 // The surface object currently owned by the player.
70 gfx::ScopedJavaSurface surface_
;
72 // Callbacks to inform the caller about decoder resources change.
73 base::Closure request_resources_cb_
;
74 base::Closure release_resources_cb_
;
76 DISALLOW_COPY_AND_ASSIGN(VideoDecoderJob
);
81 #endif // MEDIA_BASE_ANDROID_VIDEO_DECODER_JOB_H_