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

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

Issue 10411085: Build AVC decoder configuration record (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: comment Created 8 years, 6 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
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CONTENT_COMMON_GPU_MEDIA_MAC_VIDEO_DECODE_ACCELERATOR_H_ 5 #ifndef CONTENT_COMMON_GPU_MEDIA_MAC_VIDEO_DECODE_ACCELERATOR_H_
6 #define CONTENT_COMMON_GPU_MEDIA_MAC_VIDEO_DECODE_ACCELERATOR_H_ 6 #define CONTENT_COMMON_GPU_MEDIA_MAC_VIDEO_DECODE_ACCELERATOR_H_
7 7
8 #include <CoreVideo/CoreVideo.h> 8 #include <CoreVideo/CoreVideo.h>
9 #include <map> 9 #include <map>
10 #include <list> 10 #include <list>
11 11
12 #include "base/mac/scoped_cftyperef.h" 12 #include "base/mac/scoped_cftyperef.h"
13 #include "base/memory/ref_counted.h" 13 #include "base/memory/ref_counted.h"
14 #include "base/threading/non_thread_safe.h" 14 #include "base/threading/non_thread_safe.h"
15 #include "content/common/gpu/media/avc_config_record_builder.h"
16 #include "content/common/gpu/media/h264_parser.h"
15 #include "media/video/video_decode_accelerator.h" 17 #include "media/video/video_decode_accelerator.h"
16 18
17 namespace base { 19 namespace base {
18 class RefCountedBytes; 20 class RefCountedBytes;
19 } 21 }
20 namespace gfx { 22 namespace gfx {
21 class GLContext; 23 class GLContext;
22 class VideoDecodeAccelerationSupport; 24 class VideoDecodeAccelerationSupport;
23 } 25 }
24 26
25 class GpuCommandBufferStub; 27 class GpuCommandBufferStub;
26 28
27 class MacVideoDecodeAccelerator : public media::VideoDecodeAccelerator, 29 class MacVideoDecodeAccelerator : public media::VideoDecodeAccelerator,
28 public base::NonThreadSafe { 30 public base::NonThreadSafe {
29 public: 31 public:
30 // Does not take ownership of |client| which must outlive |*this|. 32 // Does not take ownership of |client| which must outlive |*this|.
31 MacVideoDecodeAccelerator(media::VideoDecodeAccelerator::Client* client); 33 MacVideoDecodeAccelerator(media::VideoDecodeAccelerator::Client* client);
32 34
33 // Set the OpenGL context to use. 35 // Set the OpenGL context to use.
34 void SetGLContext(void* gl_context); 36 void SetGLContext(void* gl_context);
35 37
36 // Set extra data required to initialize the H.264 video decoder.
37 // TODO(sail): Move this into Initialize.
38 bool SetConfigInfo(uint32_t frame_width,
39 uint32_t frame_height,
40 const std::vector<uint8_t>& avc_data);
41
42 // media::VideoDecodeAccelerator implementation. 38 // media::VideoDecodeAccelerator implementation.
43 virtual bool Initialize(media::VideoCodecProfile profile) OVERRIDE; 39 virtual bool Initialize(media::VideoCodecProfile profile) OVERRIDE;
44 virtual void Decode(const media::BitstreamBuffer& bitstream_buffer) OVERRIDE; 40 virtual void Decode(const media::BitstreamBuffer& bitstream_buffer) OVERRIDE;
45 virtual void AssignPictureBuffers( 41 virtual void AssignPictureBuffers(
46 const std::vector<media::PictureBuffer>& buffers) OVERRIDE; 42 const std::vector<media::PictureBuffer>& buffers) OVERRIDE;
47 virtual void ReusePictureBuffer(int32 picture_buffer_id) OVERRIDE; 43 virtual void ReusePictureBuffer(int32 picture_buffer_id) OVERRIDE;
48 virtual void Flush() OVERRIDE; 44 virtual void Flush() OVERRIDE;
49 virtual void Reset() OVERRIDE; 45 virtual void Reset() OVERRIDE;
50 virtual void Destroy() OVERRIDE; 46 virtual void Destroy() OVERRIDE;
51 47
(...skipping 11 matching lines...) Expand all
63 59
64 // Calls the client's initialize completed callback. 60 // Calls the client's initialize completed callback.
65 void NotifyInitializeDone(); 61 void NotifyInitializeDone();
66 62
67 // Calls the client's flush completed callback. 63 // Calls the client's flush completed callback.
68 void NotifyFlushDone(); 64 void NotifyFlushDone();
69 65
70 // Calls the client's reset completed callback. 66 // Calls the client's reset completed callback.
71 void NotifyResetDone(); 67 void NotifyResetDone();
72 68
69 // Create the decoder.
70 void CreateDecoder(const std::vector<uint8_t>& extra_data);
71
72 // Send the given NALU to the decoder.
73 void DecodeNALU(const content::H264NALU& nalu,
74 int32 bitstream_buffer_id);
75
76
73 // To expose client callbacks from VideoDecodeAccelerator. 77 // To expose client callbacks from VideoDecodeAccelerator.
74 Client* client_; 78 Client* client_;
75 // C++ wrapper around the Mac VDA API. 79 // C++ wrapper around the Mac VDA API.
76 scoped_refptr<gfx::VideoDecodeAccelerationSupport> vda_support_; 80 scoped_refptr<gfx::VideoDecodeAccelerationSupport> vda_support_;
77 // Picture buffers that are available for use by the decoder to draw decoded 81 // Picture buffers that are available for use by the decoder to draw decoded
78 // video frames on. 82 // video frames on.
79 std::list<media::PictureBuffer> available_pictures_; 83 std::list<media::PictureBuffer> available_pictures_;
80 84
81 // Maps ids to picture buffers that are in use by the client. 85 // Maps ids to picture buffers that are in use by the client.
82 struct UsedPictureInfo { 86 struct UsedPictureInfo {
(...skipping 10 matching lines...) Expand all
93 DecodedImageInfo(); 97 DecodedImageInfo();
94 ~DecodedImageInfo(); 98 ~DecodedImageInfo();
95 base::mac::ScopedCFTypeRef<CVImageBufferRef> image; 99 base::mac::ScopedCFTypeRef<CVImageBufferRef> image;
96 int32 bitstream_buffer_id; 100 int32 bitstream_buffer_id;
97 }; 101 };
98 std::list<DecodedImageInfo> decoded_images_; 102 std::list<DecodedImageInfo> decoded_images_;
99 103
100 // The context to use to perform OpenGL operations. 104 // The context to use to perform OpenGL operations.
101 CGLContextObj cgl_context_; 105 CGLContextObj cgl_context_;
102 106
103 // The number of bytes used to store the frame buffer size. 107 // Flag to check if AVC decoder configuration record has been built.
104 size_t nalu_len_field_size_; 108 bool did_build_config_record_;
105 109
106 // Size of a video frame. 110 // Parser for the H264 stream.
107 gfx::Size frame_size_; 111 content::H264Parser h264_parser_;
108 112
109 // Flag to check if pictures have been requested from the client. 113 // Utility to build the AVC configuration record.
110 bool did_request_pictures_; 114 content::AVCConfigRecordBuilder config_record_builder_;
111 }; 115 };
112 116
113 #endif // CONTENT_COMMON_GPU_MEDIA_VIDEO_DECODE_ACCELERATOR_MAC_H_ 117 #endif // CONTENT_COMMON_GPU_MEDIA_VIDEO_DECODE_ACCELERATOR_MAC_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698