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..86a7414542a6825043fe0d1b8869350ad92c53b9 |
| --- /dev/null |
| +++ b/content/common/gpu/media/avc_config_record_builder.h |
| @@ -0,0 +1,65 @@ |
| +// 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" |
| +#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. If the final AVC decoder configuration record |
| + // can be built then the NALU is not consumed and the record is returned |
| + // in |config_record|. Otherwise the NALU is consumed and |config_record| |
| + // is not modified. Returns true on success, false on failure. |
| + bool ProcessNALU(H264Parser* parser, |
| + const H264NALU& nalu, |
| + std::vector<uint8_t>* config_record); |
| + |
| + int coded_width() const { return coded_width_; } |
| + int coded_height() const { return coded_height_; } |
| + |
| + private: |
| + typedef std::vector<scoped_refptr<base::RefCountedBytes> > NALUVector; |
| + |
| + bool ProcessSPS(H264Parser* parser, const H264NALU& nalu); |
| + bool ProcessPPS(H264Parser* parser, const H264NALU& nalu); |
| + std::vector<uint8_t> BuildConfigRecord(); |
| + |
| + // Copyies data from |nalus| into |record_buffer|. Returns the number of bytes |
|
Ami GONE FROM CHROMIUM
2012/05/30 00:07:54
s/Copyies/Copies/
sail
2012/06/02 21:05:49
Done.
|
| + // that were written. |
| + int CopyNALUsToConfigRecord(const NALUVector& nalus, uint8_t* record_buffer); |
| + |
| + // 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_; |
| +}; |
| + |
| +} // namespace content |
| + |
| +#endif // CONTENT_COMMON_GPU_MEDIA_AVC_CONFIG_RECORD_BUILDER_H_ |