ozone: evdev: Sync caps lock LED state to evdev
[chromium-blink-merge.git] / content / common / gpu / media / fake_video_decode_accelerator.h
blobde7df4ae7a52505dfbbedb16615e191b20758cab
1 // Copyright 2014 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 CONTENT_COMMON_GPU_MEDIA_FAKE_VIDEO_DECODE_ACCELERATOR_H_
6 #define CONTENT_COMMON_GPU_MEDIA_FAKE_VIDEO_DECODE_ACCELERATOR_H_
8 #include <queue>
9 #include <vector>
11 #include "base/memory/weak_ptr.h"
12 #include "base/message_loop/message_loop_proxy.h"
13 #include "content/common/content_export.h"
14 #include "media/video/video_decode_accelerator.h"
15 #include "ui/gfx/geometry/size_f.h"
16 #include "ui/gl/gl_context.h"
18 namespace content {
20 class CONTENT_EXPORT FakeVideoDecodeAccelerator
21 : public media::VideoDecodeAccelerator {
22 public:
23 FakeVideoDecodeAccelerator(
24 gfx::GLContext* gl,
25 gfx::Size size,
26 const base::Callback<bool(void)>& make_context_current);
27 ~FakeVideoDecodeAccelerator() override;
29 bool Initialize(media::VideoCodecProfile profile,
30 Client* client) override;
31 void Decode(const media::BitstreamBuffer& bitstream_buffer) override;
32 void AssignPictureBuffers(
33 const std::vector<media::PictureBuffer>& buffers) override;
34 void ReusePictureBuffer(int32 picture_buffer_id) override;
35 void Flush() override;
36 void Reset() override;
37 void Destroy() override;
38 bool CanDecodeOnIOThread() override;
40 private:
41 void DoPictureReady();
43 // The message loop that created the class. Used for all callbacks. This
44 // class expects all calls to this class to be on this message loop (not
45 // checked).
46 const scoped_refptr<base::MessageLoopProxy> child_message_loop_proxy_;
48 Client* client_;
50 // Make our context current before running any GL entry points.
51 base::Callback<bool(void)> make_context_current_;
52 gfx::GLContext* gl_;
54 // Output picture size.
55 gfx::Size frame_buffer_size_;
57 // Picture buffer ids that are available for putting fake frames in.
58 std::queue<int> free_output_buffers_;
59 // BitstreamBuffer ids for buffers that contain new data to decode.
60 std::queue<int> queued_bitstream_ids_;
62 bool flushing_;
64 // The WeakPtrFactory for |weak_this_|.
65 base::WeakPtrFactory<FakeVideoDecodeAccelerator> weak_this_factory_;
67 DISALLOW_COPY_AND_ASSIGN(FakeVideoDecodeAccelerator);
70 } // namespace content
72 #endif // CONTENT_COMMON_GPU_MEDIA_FAKE_VIDEO_DECODE_ACCELERATOR_H_