Chromium Code Reviews| Index: content/common/gpu/media/avc_config_record_builder.h |
| diff --git a/content/common/gpu/media/avc_config_record_builder.h b/content/common/gpu/media/avc_config_record_builder.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..65c6e360b07273a1ed1a133fa2a8894078711b88 |
| --- /dev/null |
| +++ b/content/common/gpu/media/avc_config_record_builder.h |
| @@ -0,0 +1,62 @@ |
| +// Copyright (c) 2012 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_AVC_CONFIG_RECORD_BUILDER_H_ |
| +#define CONTENT_COMMON_GPU_MEDIA_AVC_CONFIG_RECORD_BUILDER_H_ |
| + |
| +#include <vector> |
| + |
| +#include "base/memory/ref_counted.h" |
|
Ami GONE FROM CHROMIUM
2012/05/23 19:41:19
unnecessary?
sail
2012/05/28 21:45:46
used for scoped_refptr
|
| +#include "base/memory/ref_counted_memory.h" |
| + |
| +namespace content { |
| + |
| +struct H264NALU; |
| +class H264Parser; |
| + |
| +// Utility class to build an AVC configuration record given a stream of NALUs |
| +// containing SPS and PPS data. |
| +class AVCConfigRecordBuilder { |
| + public: |
| + AVCConfigRecordBuilder(); |
| + ~AVCConfigRecordBuilder(); |
| + |
| + // Processes the given NALU. Returns true on success, false on failure. |
| + bool ProcessNextNALU(H264Parser* parser, |
| + const H264NALU* nalu, |
| + bool* did_consume_nalu); |
| + |
| + // Builds the AVC decoder configuration record. |
| + std::vector<uint8_t> BuildConfigRecord(); |
| + |
| + bool can_build_record() const { return can_build_record_; } |
| + int coded_width() const { return coded_width_; } |
| + int coded_height() const { return coded_height_; } |
| + |
| + private: |
| + bool ProcessSPS(H264Parser* parser, const H264NALU* nalu); |
| + bool ProcessPPS(H264Parser* parser, const H264NALU* nalu); |
| + |
| + typedef std::vector<scoped_refptr<base::RefCountedBytes> > NALUVector; |
| + // Data for each SPS. |
| + NALUVector sps_nalus_; |
| + // Data for each PPS. |
| + NALUVector pps_nalus_; |
| + // The video codec profile stored in the SPS. |
| + int sps_profile_idc_; |
| + // The constraint setx flags stored in the SPS. |
| + int sps_constraint_setx_flag_; |
| + // The avc level stored in the SPS. |
| + int sps_level_idc_; |
| + // The width of the video as enocded in the SPS. |
| + uint32_t coded_width_; |
| + // The height of the video as enocded in the SPS. |
| + uint32_t coded_height_; |
| + // Flag to check if the AVC configuration record can be built. |
| + bool can_build_record_; |
| +}; |
| + |
| +} // namespace content |
| + |
| +#endif // CONTENT_COMMON_GPU_MEDIA_AVC_CONFIG_RECORD_BUILDER_H_ |