| OLD | NEW |
| 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/content_export.h" | 15 #include "content/common/content_export.h" |
| 16 #include "content/common/gpu/media/avc_config_record_builder.h" | 16 #include "content/common/gpu/media/avc_config_record_builder.h" |
| 17 #include "content/common/gpu/media/h264_parser.h" | 17 #include "content/common/gpu/media/h264_parser.h" |
| 18 #include "media/video/video_decode_accelerator.h" | 18 #include "media/video/video_decode_accelerator.h" |
| 19 | 19 |
| 20 namespace base { | 20 namespace base { |
| 21 class RefCountedBytes; | 21 class RefCountedBytes; |
| 22 } | 22 } |
| 23 namespace gfx { | 23 namespace gfx { |
| 24 class GLContext; | 24 class GLContext; |
| 25 class VideoDecodeAccelerationSupport; | 25 class VideoDecodeAccelerationSupport; |
| 26 } | 26 } |
| 27 | 27 |
| 28 namespace content { |
| 29 |
| 28 class GpuCommandBufferStub; | 30 class GpuCommandBufferStub; |
| 29 | 31 |
| 30 class CONTENT_EXPORT MacVideoDecodeAccelerator | 32 class CONTENT_EXPORT MacVideoDecodeAccelerator |
| 31 : public media::VideoDecodeAccelerator, | 33 : public media::VideoDecodeAccelerator, |
| 32 public base::NonThreadSafe { | 34 public base::NonThreadSafe { |
| 33 public: | 35 public: |
| 34 // Does not take ownership of |client| which must outlive |*this|. | 36 // Does not take ownership of |client| which must outlive |*this|. |
| 35 MacVideoDecodeAccelerator(CGLContextObj cgl_context, | 37 MacVideoDecodeAccelerator(CGLContextObj cgl_context, |
| 36 media::VideoDecodeAccelerator::Client* client); | 38 media::VideoDecodeAccelerator::Client* client); |
| 37 virtual ~MacVideoDecodeAccelerator(); | 39 virtual ~MacVideoDecodeAccelerator(); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 57 // Sends available decoded frames to the client. | 59 // Sends available decoded frames to the client. |
| 58 void SendImages(); | 60 void SendImages(); |
| 59 | 61 |
| 60 // Stop the component when any error is detected. | 62 // Stop the component when any error is detected. |
| 61 void StopOnError(media::VideoDecodeAccelerator::Error error); | 63 void StopOnError(media::VideoDecodeAccelerator::Error error); |
| 62 | 64 |
| 63 // Create the decoder. | 65 // Create the decoder. |
| 64 bool CreateDecoder(const std::vector<uint8_t>& extra_data); | 66 bool CreateDecoder(const std::vector<uint8_t>& extra_data); |
| 65 | 67 |
| 66 // Send the given NALU to the decoder. | 68 // Send the given NALU to the decoder. |
| 67 void DecodeNALU(const content::H264NALU& nalu, | 69 void DecodeNALU(const H264NALU& nalu, int32 bitstream_buffer_id); |
| 68 int32 bitstream_buffer_id); | |
| 69 | 70 |
| 70 // Calls the client's initialize completed callback. | 71 // Calls the client's initialize completed callback. |
| 71 void NotifyInitializeDone(); | 72 void NotifyInitializeDone(); |
| 72 | 73 |
| 73 // Requests pictures from the client. | 74 // Requests pictures from the client. |
| 74 void RequestPictures(); | 75 void RequestPictures(); |
| 75 | 76 |
| 76 // Calls the client's flush completed callback. | 77 // Calls the client's flush completed callback. |
| 77 void NotifyFlushDone(); | 78 void NotifyFlushDone(); |
| 78 | 79 |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 }; | 114 }; |
| 114 std::list<DecodedImageInfo> decoded_images_; | 115 std::list<DecodedImageInfo> decoded_images_; |
| 115 | 116 |
| 116 // The context to use to perform OpenGL operations. | 117 // The context to use to perform OpenGL operations. |
| 117 CGLContextObj cgl_context_; | 118 CGLContextObj cgl_context_; |
| 118 | 119 |
| 119 // Flag to check if AVC decoder configuration record has been built. | 120 // Flag to check if AVC decoder configuration record has been built. |
| 120 bool did_build_config_record_; | 121 bool did_build_config_record_; |
| 121 | 122 |
| 122 // Parser for the H264 stream. | 123 // Parser for the H264 stream. |
| 123 content::H264Parser h264_parser_; | 124 H264Parser h264_parser_; |
| 124 | 125 |
| 125 // Utility to build the AVC configuration record. | 126 // Utility to build the AVC configuration record. |
| 126 content::AVCConfigRecordBuilder config_record_builder_; | 127 AVCConfigRecordBuilder config_record_builder_; |
| 127 | 128 |
| 128 // Maps a bitstream ID to the number of NALUs that are being decoded for | 129 // Maps a bitstream ID to the number of NALUs that are being decoded for |
| 129 // that bitstream. This is used to ensure that NotifyEndOfBitstreamBuffer() | 130 // that bitstream. This is used to ensure that NotifyEndOfBitstreamBuffer() |
| 130 // is called after all NALUs contained in a bitstream have been decoded. | 131 // is called after all NALUs contained in a bitstream have been decoded. |
| 131 std::map<int32, int> bitstream_nalu_count_; | 132 std::map<int32, int> bitstream_nalu_count_; |
| 132 }; | 133 }; |
| 133 | 134 |
| 135 } // namespace content |
| 136 |
| 134 #endif // CONTENT_COMMON_GPU_MEDIA_VIDEO_DECODE_ACCELERATOR_MAC_H_ | 137 #endif // CONTENT_COMMON_GPU_MEDIA_VIDEO_DECODE_ACCELERATOR_MAC_H_ |
| OLD | NEW |