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

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

Issue 10834071: Add unittest for H264BitReader. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Remove MultiFileStreamParser and empty ctor/dtor. Created 8 years, 4 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
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 // This file contains an implementation of an H264 Annex-B video stream parser. 5 // This file contains an implementation of an H264 Annex-B video stream parser.
6 6
7 #ifndef CONTENT_COMMON_GPU_MEDIA_H264_PARSER_H_ 7 #ifndef CONTENT_COMMON_GPU_MEDIA_H264_PARSER_H_
8 #define CONTENT_COMMON_GPU_MEDIA_H264_PARSER_H_ 8 #define CONTENT_COMMON_GPU_MEDIA_H264_PARSER_H_
9 9
10 #include <sys/types.h> 10 #include <sys/types.h>
11 11
12 #include <map> 12 #include <map>
13 13
14 #include "base/basictypes.h" 14 #include "base/basictypes.h"
15 #include "content/common/content_export.h" 15 #include "content/common/content_export.h"
16 16
17 class H264BitReaderTest;
18
17 namespace content { 19 namespace content {
18 20
19 // For explanations of each struct and its members, see H.264 specification 21 // For explanations of each struct and its members, see H.264 specification
20 // at http://www.itu.int/rec/T-REC-H.264. 22 // at http://www.itu.int/rec/T-REC-H.264.
21 struct CONTENT_EXPORT H264NALU { 23 struct CONTENT_EXPORT H264NALU {
22 H264NALU(); 24 H264NALU();
23 25
24 enum Type { 26 enum Type {
25 kUnspecified = 0, 27 kUnspecified = 0,
26 kNonIDRSlice = 1, 28 kNonIDRSlice = 1,
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after
294 296
295 // Parse a slice header, returning it in |*shdr|. |*nalu| must be set to 297 // Parse a slice header, returning it in |*shdr|. |*nalu| must be set to
296 // the NALU returned from AdvanceToNextNALU() and corresponding to |*shdr|. 298 // the NALU returned from AdvanceToNextNALU() and corresponding to |*shdr|.
297 Result ParseSliceHeader(const H264NALU& nalu, H264SliceHeader* shdr); 299 Result ParseSliceHeader(const H264NALU& nalu, H264SliceHeader* shdr);
298 300
299 // Parse a SEI message, returning it in |*sei_msg|, provided and managed 301 // Parse a SEI message, returning it in |*sei_msg|, provided and managed
300 // by the caller. 302 // by the caller.
301 Result ParseSEI(H264SEIMessage* sei_msg); 303 Result ParseSEI(H264SEIMessage* sei_msg);
302 304
303 private: 305 private:
306 friend class ::H264BitReaderTest;
307
304 // A class to provide bit-granularity reading of H.264 streams. 308 // A class to provide bit-granularity reading of H.264 streams.
305 // This is not a generic bit reader class, as it takes into account 309 // This is not a generic bit reader class, as it takes into account
306 // H.264 stream-specific constraints, such as skipping emulation-prevention 310 // H.264 stream-specific constraints, such as skipping emulation-prevention
307 // bytes and stop bits. See spec for more details. 311 // bytes and stop bits. See spec for more details.
308 // TODO(posciak): need separate unittests for this class.
309 class H264BitReader { 312 class H264BitReader {
310 public: 313 public:
311 H264BitReader(); 314 H264BitReader();
312 ~H264BitReader(); 315 ~H264BitReader();
313 316
314 // Initialize the reader to start reading at |data|, |size| being size 317 // Initialize the reader to start reading at |data|, |size| being size
315 // of |data| in bytes. 318 // of |data| in bytes.
316 // Return false on insufficient size of stream.. 319 // Return false on insufficient size of stream..
317 // TODO(posciak,fischman): consider replacing Initialize() with 320 // TODO(posciak,fischman): consider replacing Initialize() with
318 // heap-allocating and creating bit readers on demand instead. 321 // heap-allocating and creating bit readers on demand instead.
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
399 typedef std::map<int, H264PPS*> PPSById; 402 typedef std::map<int, H264PPS*> PPSById;
400 SPSById active_SPSes_; 403 SPSById active_SPSes_;
401 PPSById active_PPSes_; 404 PPSById active_PPSes_;
402 405
403 DISALLOW_COPY_AND_ASSIGN(H264Parser); 406 DISALLOW_COPY_AND_ASSIGN(H264Parser);
404 }; 407 };
405 408
406 } // namespace content 409 } // namespace content
407 410
408 #endif // CONTENT_COMMON_GPU_MEDIA_H264_PARSER_H_ 411 #endif // CONTENT_COMMON_GPU_MEDIA_H264_PARSER_H_
OLDNEW
« no previous file with comments | « no previous file | content/common/gpu/media/h264_parser_unittest.cc » ('j') | content/common/gpu/media/h264_parser_unittest.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698