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

Side by Side Diff: content/common/gpu/media/avc_config_record_builder.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
(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_AVC_CONFIG_RECORD_BUILDER_H_
6 #define CONTENT_COMMON_GPU_MEDIA_AVC_CONFIG_RECORD_BUILDER_H_
7
8 #include <vector>
9
10 #include "base/memory/ref_counted.h"
11 #include "base/memory/ref_counted_memory.h"
12
13 namespace content {
14
15 struct H264NALU;
16 class H264Parser;
17
18 // Utility class to build an AVC configuration record given a stream of NALUs
19 // containing SPS and PPS data.
20 class AVCConfigRecordBuilder {
21 public:
22 AVCConfigRecordBuilder();
23 ~AVCConfigRecordBuilder();
24
25 // Processes the given NALU. If the final AVC decoder configuration record
26 // can be built then the NALU is not consumed and the record is returned
27 // in |config_record|. Otherwise the NALU is consumed and |config_record|
28 // is not modified. Returns true on success, false on failure.
29 bool ProcessNALU(H264Parser* parser,
30 const H264NALU& nalu,
31 std::vector<uint8_t>* config_record);
32
33 int coded_width() const { return coded_width_; }
34 int coded_height() const { return coded_height_; }
35
36 private:
37 typedef std::vector<scoped_refptr<base::RefCountedBytes> > NALUVector;
38
39 bool ProcessSPS(H264Parser* parser, const H264NALU& nalu);
40 bool ProcessPPS(H264Parser* parser, const H264NALU& nalu);
41 std::vector<uint8_t> BuildConfigRecord();
42
43 // 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.
44 // that were written.
45 int CopyNALUsToConfigRecord(const NALUVector& nalus, uint8_t* record_buffer);
46
47 // Data for each SPS.
48 NALUVector sps_nalus_;
49 // Data for each PPS.
50 NALUVector pps_nalus_;
51 // The video codec profile stored in the SPS.
52 int sps_profile_idc_;
53 // The constraint setx flags stored in the SPS.
54 int sps_constraint_setx_flag_;
55 // The avc level stored in the SPS.
56 int sps_level_idc_;
57 // The width of the video as enocded in the SPS.
58 uint32_t coded_width_;
59 // The height of the video as enocded in the SPS.
60 uint32_t coded_height_;
61 };
62
63 } // namespace content
64
65 #endif // CONTENT_COMMON_GPU_MEDIA_AVC_CONFIG_RECORD_BUILDER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698