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