Index: content/common/gpu/media/android_video_decode_accelerator.h |
diff --git a/content/common/gpu/media/android_video_decode_accelerator.h b/content/common/gpu/media/android_video_decode_accelerator.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..92d2ecb5e1029cccafa97453dd8cd66c989441ee |
--- /dev/null |
+++ b/content/common/gpu/media/android_video_decode_accelerator.h |
@@ -0,0 +1,110 @@ |
+// Copyright (c) 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 CONTENT_COMMON_GPU_MEDIA_ANDROID_VIDEO_DECODE_ACCELERATOR_H_ |
+#define CONTENT_COMMON_GPU_MEDIA_ANDROID_VIDEO_DECODE_ACCELERATOR_H_ |
+ |
+#include <dlfcn.h> |
+#include <map> |
+#include <queue> |
+#include <set> |
Ami GONE FROM CHROMIUM
2013/01/23 01:32:32
unused
dwkang1
2013/01/28 14:54:30
Done.
|
+#include <string> |
+#include <utility> |
Ami GONE FROM CHROMIUM
2013/01/23 01:32:32
unused?
dwkang1
2013/01/28 14:54:30
Done.
|
+#include <vector> |
+ |
+#include "base/compiler_specific.h" |
+#include "base/logging.h" |
+#include "base/message_loop.h" |
Ami GONE FROM CHROMIUM
2013/01/23 01:32:32
replace with fwd-declaration
dwkang1
2013/01/28 14:54:30
Done.
|
+#include "base/shared_memory.h" |
Ami GONE FROM CHROMIUM
2013/01/23 01:32:32
unnecessary (please audit the rest of the #include
dwkang1
2013/01/28 14:54:30
Done.
|
+#include "content/common/android/surface_texture_bridge.h" |
+#include "content/common/content_export.h" |
+#include "media/video/video_decode_accelerator.h" |
+ |
+namespace media { |
+class MediaCodecBridge; |
+} |
+ |
+namespace content { |
+ |
+class Gles2ExternalTextureCopier; |
+ |
+typedef std::map<int32, media::PictureBuffer> PictureMap; |
Ami GONE FROM CHROMIUM
2013/01/23 01:32:32
Only used for a private member; move into the priv
dwkang1
2013/01/28 14:54:30
Done.
|
+ |
+// A VideoDecodeAccelerator implementation for Android. |
+// This class decodes the input encoded stream by using Android's MediaCodec |
+// class. http://developer.android.com/reference/android/media/MediaCodec.html |
+class CONTENT_EXPORT AndroidVideoDecodeAccelerator : |
+ public media::VideoDecodeAccelerator { |
+ public: |
+ // Does not take ownership of |client| which must outlive |*this|. |
+ AndroidVideoDecodeAccelerator( |
+ media::VideoDecodeAccelerator::Client* client, |
+ const base::Callback<bool(void)>& make_context_current); |
+ virtual ~AndroidVideoDecodeAccelerator(); |
Ami GONE FROM CHROMIUM
2013/01/23 01:32:32
dtor should be private since only Destroy should b
dwkang1
2013/01/28 14:54:30
Done.
|
+ |
+ // media::VideoDecodeAccelerator implementation. |
+ bool Initialize(media::VideoCodecProfile profile) OVERRIDE; |
+ void Decode(const media::BitstreamBuffer& bitstream_buffer) OVERRIDE; |
+ virtual void AssignPictureBuffers( |
+ const std::vector<media::PictureBuffer>& buffers) OVERRIDE; |
+ void ReusePictureBuffer(int32 picture_buffer_id) OVERRIDE; |
+ void Flush() OVERRIDE; |
+ void Reset() OVERRIDE; |
+ void Destroy() OVERRIDE; |
+ |
+ private: |
+ enum Codec { |
Ami GONE FROM CHROMIUM
2013/01/23 01:32:32
You can drop this enum and the codec_ parameter by
dwkang1
2013/01/28 14:54:30
Actually, codec_ is needed when we reconfigure Med
|
+ UNKNOWN, |
+ H264, |
+ VP8 |
+ }; |
+ enum State { |
+ NO_ERROR, |
+ ERROR, |
+ }; |
+ |
+ static const base::TimeDelta kDecodePollDelay; |
Ami GONE FROM CHROMIUM
2013/01/23 01:32:32
I don't know what this is used for yet, but I susp
dwkang1
2013/01/28 14:54:30
As you found, I am afraid that I have to say Media
|
+ |
+ void SendCurrentSurfaceToClient(); |
Ami GONE FROM CHROMIUM
2013/01/23 01:32:32
You need to document everything that's not obvious
dwkang1
2013/01/28 14:54:30
Done.
|
+ void CopyCurrentFrameToPictureBuffer( |
+ int32 picture_buffer_id, float transfrom_matrix[16]); |
+ |
+ void DoDecode(); |
+ void ConfigureMediaCodec(); |
+ void QueueInput(); |
+ void DequeueOutput(); |
+ |
+ MessageLoop* message_loop_; |
+ |
+ // To expose client callbacks from VideoDecodeAccelerator. |
+ // NOTE: all calls to this object *MUST* be executed in message_loop_. |
Ami GONE FROM CHROMIUM
2013/01/23 01:32:32
This is the first time there's an implication that
dwkang1
2013/01/28 14:54:30
That is not true. I should have deleted this comme
|
+ Client* client_; |
+ |
+ base::Callback<bool(void)> make_context_current_; |
+ |
+ // These members are only used during Initialization. |
Ami GONE FROM CHROMIUM
2013/01/23 01:32:32
I think this comment refers to just one member, so
dwkang1
2013/01/28 14:54:30
Ditto. My bad. I should have removed this also.
|
+ Codec codec_; |
+ |
+ State state_; |
+ PictureMap picture_map_; |
+ std::queue<int32> free_picture_ids_; |
+ scoped_ptr<media::MediaCodecBridge> media_codec_; |
+ scoped_refptr<SurfaceTextureBridge> surface_texture_; |
+ uint32 surface_texture_id_; |
+ bool picturebuffer_requested_; |
Ami GONE FROM CHROMIUM
2013/01/23 01:32:32
s/buffer/buffers/ ?
dwkang1
2013/01/28 14:54:30
Done.
|
+ |
+ typedef std::queue<media::BitstreamBuffer> BitstreamBufferList; |
+ BitstreamBufferList pending_bitstream_buffers_; |
Ami GONE FROM CHROMIUM
2013/01/23 01:32:32
pending where? At the decoder or awaiting submiss
dwkang1
2013/01/28 14:54:30
Done.
|
+ |
+ int32 color_format_; |
Ami GONE FROM CHROMIUM
2013/01/23 01:32:32
Can this not be a more specifically-typed member?
Ami GONE FROM CHROMIUM
2013/01/23 01:32:32
I believe this and the next two members (width/hei
dwkang1
2013/01/28 14:54:30
Done.
dwkang1
2013/01/28 14:54:30
Done.
|
+ int32 width_; |
+ int32 height_; |
Ami GONE FROM CHROMIUM
2013/01/23 01:32:32
Replace width/height with gfx::Size
dwkang1
2013/01/28 14:54:30
Removed.
|
+ int32 current_bitstream_id_; |
+ |
+ scoped_ptr<Gles2ExternalTextureCopier> texture_copier_; |
+}; |
+ |
+} // namespace content |
+ |
+#endif // CONTENT_COMMON_GPU_MEDIA_ANDROID_VIDEO_DECODE_ACCELERATOR_H_ |