Upstream version 7.36.149.0
[platform/framework/web/crosswalk.git] / src / media / base / android / video_decoder_job.h
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
10 #include "media/base/android/media_decoder_job.h"
11
12 namespace media {
13
14 class VideoCodecBridge;
15
16 // Class for managing video decoding jobs.
17 class VideoDecoderJob : public MediaDecoderJob {
18  public:
19   virtual ~VideoDecoderJob();
20
21   // Create a new VideoDecoderJob instance.
22   // |video_codec| - The video format the object needs to decode.
23   // |is_secure| - Whether secure decoding is required.
24   // |size| -  The natural size of the output frames.
25   // |surface| - The surface to render the frames to.
26   // |media_crypto| - Handle to a Java object responsible for decrypting the
27   // video data.
28   // |request_data_cb| - Callback used to request more data for the decoder.
29   // |request_resources_cb| - Callback used to request resources.
30   // |release_resources_cb| - Callback used to release resources.
31   static VideoDecoderJob* Create(const VideoCodec video_codec,
32                                  bool is_secure,
33                                  const gfx::Size& size,
34                                  jobject surface,
35                                  jobject media_crypto,
36                                  const base::Closure& request_data_cb,
37                                  const base::Closure& request_resources_cb,
38                                  const base::Closure& release_resources_cb);
39
40  private:
41   VideoDecoderJob(scoped_ptr<VideoCodecBridge> video_codec_bridge,
42                   const base::Closure& request_data_cb,
43                   const base::Closure& request_resources_cb,
44                   const base::Closure& release_resources_cb);
45
46   // MediaDecoderJob implementation.
47   virtual void ReleaseOutputBuffer(
48       int output_buffer_index,
49       size_t size,
50       bool render_output,
51       base::TimeDelta current_presentation_timestamp,
52       const ReleaseOutputCompletionCallback& callback) OVERRIDE;
53
54   virtual bool ComputeTimeToRender() const OVERRIDE;
55
56   scoped_ptr<VideoCodecBridge> video_codec_bridge_;
57
58   base::Closure release_resources_cb_;
59 };
60
61 }  // namespace media
62
63 #endif  // MEDIA_BASE_ANDROID_VIDEO_DECODER_JOB_H_