Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(225)

Side by Side Diff: content/common/gpu/media/video_decode_accelerator_mac.h

Issue 10388108: Implement media::VideoDecodeAccelerator on Mac (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: a Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2012 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 CONTENT_COMMON_GPU_MEDIA_VIDEO_DECODE_ACCELERATOR_MAC_H_
6 #define CONTENT_COMMON_GPU_MEDIA_VIDEO_DECODE_ACCELERATOR_MAC_H_
7
8 #include <CoreVideo/CoreVideo.h>
9 #include <map>
10 #include <list>
11
12 #include "base/mac/scoped_refptr_cftype.h"
13 #include "base/memory/ref_counted.h"
14 #include "media/video/video_decode_accelerator.h"
15
16 namespace base {
17 class RefCountedBytes;
18 }
19 namespace gfx {
20 class GLContext;
21 class VideoDecodeAccelerationSupport;
22 }
23
24 class GpuCommandBufferStub;
25
26 class VideoDecodeAcceleratorMac : public media::VideoDecodeAccelerator {
Ami GONE FROM CHROMIUM 2012/05/15 17:55:22 FWIW, the other VDA's follow the convention FooVDA
sail 2012/05/15 23:53:31 Done.
27 public:
28 // Does not take ownership of |client| which must outlive |*this|.
29 VideoDecodeAcceleratorMac(media::VideoDecodeAccelerator::Client* client);
30
31 // Set the OpenGL context to use.
32 void SetGLContext(void* gl_context);
33
34 // Set extra data required to initialize the H.264 video decoder.
35 // TODO(sail): Move this into Initialize.
Ami GONE FROM CHROMIUM 2012/05/15 17:55:22 Initialize() is a member of the VDA interface, and
sail 2012/05/15 23:53:31 These are the dimensions stored in the extra_data(
36 bool SetConfigInfo(uint32_t frame_width,
37 uint32_t frame_height,
38 const std::vector<uint8_t>& avc_data);
39
40 // media::VideoDecodeAccelerator implementation.
41 virtual bool Initialize(media::VideoCodecProfile profile) OVERRIDE;
42 virtual void Decode(const media::BitstreamBuffer& bitstream_buffer) OVERRIDE;
43 virtual void AssignPictureBuffers(
44 const std::vector<media::PictureBuffer>& buffers) OVERRIDE;
45 virtual void ReusePictureBuffer(int32 picture_buffer_id) OVERRIDE;
46 virtual void Flush() OVERRIDE;
47 virtual void Reset() OVERRIDE;
48 virtual void Destroy() OVERRIDE;
49
50 private:
51 virtual ~VideoDecodeAcceleratorMac();
52
53 // Callback for a completed frame.
54 void OnFrameReady(int32 bitstream_buffer_id,
55 scoped_refptr<base::RefCountedBytes> bytes,
56 CVImageBufferRef image,
57 int status);
58
59 // Sends available decoded frames to the client.
60 void SendImages();
61
62 // Calls the client's flush completed callback.
63 void NotifyFlushDone();
64
65 // Calls the client's reset completed callback.
66 void NotifyResetDone();
67
68 // To expose client callbacks from VideoDecodeAccelerator.
69 Client* client_;
70 // C++ wrapper around the Mac VDA API.
71 scoped_refptr<gfx::VideoDecodeAccelerationSupport> vda_;
72 // Picture buffers that are available for use by the decoder to draw decoded
73 // video frames on.
74 std::list<media::PictureBuffer> available_pictures_;
75
76 // Maps ids to picture buffers that are in use by the client.
77 struct PendingPictureInfo {
78 PendingPictureInfo(media::PictureBuffer pic,
79 CVImageBufferRef image);
80 ~PendingPictureInfo();
81 media::PictureBuffer picture_buffer;
82 base::mac::scoped_refptr_cftype<CVImageBufferRef> image;
83 };
84 std::map<int32, PendingPictureInfo> pending_pictures_;
85
86 // List of decoded images waiting to be sent to the client.
87 struct DecodedImageInfo {
88 DecodedImageInfo();
89 ~DecodedImageInfo();
90 base::mac::scoped_refptr_cftype<CVImageBufferRef> image;
91 int32 bitstream_buffer_id;
92 };
93 std::list<DecodedImageInfo> decoded_images_;
94
95 // The context to use to perform OpenGL operations.
96 CGLContextObj cgl_context_;
97
98 // The number of bytes used to store the frame buffer size.
99 size_t nalu_len_field_size_;
100
101 // Width of a video frame.
102 uint32_t frame_width_;
103 // Height of a video frame.
104 uint32_t frame_height_;
105 // Flag to check if pictures have been requested from the client.
106 bool did_request_pictures_;
107 };
108
109 #endif // CONTENT_COMMON_GPU_MEDIA_VIDEO_DECODE_ACCELERATOR_MAC_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698