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
,
48 base::TimeDelta current_presentation_timestamp
,
49 const ReleaseOutputCompletionCallback
& callback
) override
;
50 bool ComputeTimeToRender() const override
;
51 bool IsCodecReconfigureNeeded(const DemuxerConfigs
& configs
) const override
;
52 bool AreDemuxerConfigsChanged(const DemuxerConfigs
& configs
) const override
;
53 MediaDecoderJobStatus
CreateMediaCodecBridgeInternal() override
;
54 bool UpdateOutputFormat() override
;
56 // Returns true if a protected surface is required for video playback.
57 bool IsProtectedSurfaceRequired();
59 // Video configs from the demuxer.
60 VideoCodec video_codec_
;
64 // Video output format.
68 // The surface object currently owned by the player.
69 gfx::ScopedJavaSurface surface_
;
71 // Callbacks to inform the caller about decoder resources change.
72 base::Closure request_resources_cb_
;
73 base::Closure release_resources_cb_
;
75 DISALLOW_COPY_AND_ASSIGN(VideoDecoderJob
);
80 #endif // MEDIA_BASE_ANDROID_VIDEO_DECODER_JOB_H_