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

Side by Side Diff: media/filters/h264_parser.h

Issue 816353010: Implemented HEVC video demuxing and parsing (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Moved back h265_parser_unittest.cc in media/BUILD.gn Created 5 years, 3 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 MEDIA_FILTERS_H264_PARSER_H_ 7 #ifndef MEDIA_FILTERS_H264_PARSER_H_
8 #define MEDIA_FILTERS_H264_PARSER_H_ 8 #define MEDIA_FILTERS_H264_PARSER_H_
9 9
10 #include <sys/types.h> 10 #include <sys/types.h>
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after
334 // code) and |*start_code_size| is set to 0. 334 // code) and |*start_code_size| is set to 0.
335 // Preconditions: 335 // Preconditions:
336 // - |data_size| >= 0 336 // - |data_size| >= 0
337 // Postconditions: 337 // Postconditions:
338 // - |*offset| is between 0 and |data_size| included. 338 // - |*offset| is between 0 and |data_size| included.
339 // It is strictly less than |data_size| if |data_size| > 0. 339 // It is strictly less than |data_size| if |data_size| > 0.
340 // - |*start_code_size| is either 0, 3 or 4. 340 // - |*start_code_size| is either 0, 3 or 4.
341 static bool FindStartCode(const uint8* data, off_t data_size, 341 static bool FindStartCode(const uint8* data, off_t data_size,
342 off_t* offset, off_t* start_code_size); 342 off_t* offset, off_t* start_code_size);
343 343
344 // Wrapper for FindStartCode() that skips over start codes that
345 // may appear inside of |encrypted_ranges_|.
346 // Returns true if a start code was found. Otherwise returns false.
347 static bool FindStartCodeInClearRanges(const uint8* data, off_t data_size,
348 const Ranges<const uint8*>& ranges,
349 off_t* offset, off_t* start_code_size);
344 H264Parser(); 350 H264Parser();
345 ~H264Parser(); 351 ~H264Parser();
346 352
347 void Reset(); 353 void Reset();
348 // Set current stream pointer to |stream| of |stream_size| in bytes, 354 // Set current stream pointer to |stream| of |stream_size| in bytes,
349 // |stream| owned by caller. 355 // |stream| owned by caller.
350 // |subsamples| contains information about what parts of |stream| are 356 // |subsamples| contains information about what parts of |stream| are
351 // encrypted. 357 // encrypted.
352 void SetStream(const uint8* stream, off_t stream_size); 358 void SetStream(const uint8* stream, off_t stream_size);
353 void SetEncryptedStream(const uint8* stream, off_t stream_size, 359 void SetEncryptedStream(const uint8* stream, off_t stream_size,
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
399 private: 405 private:
400 // Move the stream pointer to the beginning of the next NALU, 406 // Move the stream pointer to the beginning of the next NALU,
401 // i.e. pointing at the next start code. 407 // i.e. pointing at the next start code.
402 // Return true if a NALU has been found. 408 // Return true if a NALU has been found.
403 // If a NALU is found: 409 // If a NALU is found:
404 // - its size in bytes is returned in |*nalu_size| and includes 410 // - its size in bytes is returned in |*nalu_size| and includes
405 // the start code as well as the trailing zero bits. 411 // the start code as well as the trailing zero bits.
406 // - the size in bytes of the start code is returned in |*start_code_size|. 412 // - the size in bytes of the start code is returned in |*start_code_size|.
407 bool LocateNALU(off_t* nalu_size, off_t* start_code_size); 413 bool LocateNALU(off_t* nalu_size, off_t* start_code_size);
408 414
409 // Wrapper for FindStartCode() that skips over start codes that
410 // may appear inside of |encrypted_ranges_|.
411 // Returns true if a start code was found. Otherwise returns false.
412 bool FindStartCodeInClearRanges(const uint8* data, off_t data_size,
413 off_t* offset, off_t* start_code_size);
414
415 // Exp-Golomb code parsing as specified in chapter 9.1 of the spec. 415 // Exp-Golomb code parsing as specified in chapter 9.1 of the spec.
416 // Read one unsigned exp-Golomb code from the stream and return in |*val|. 416 // Read one unsigned exp-Golomb code from the stream and return in |*val|.
417 Result ReadUE(int* val); 417 Result ReadUE(int* val);
418 418
419 // Read one signed exp-Golomb code from the stream and return in |*val|. 419 // Read one signed exp-Golomb code from the stream and return in |*val|.
420 Result ReadSE(int* val); 420 Result ReadSE(int* val);
421 421
422 // Parse scaling lists (see spec). 422 // Parse scaling lists (see spec).
423 Result ParseScalingList(int size, int* scaling_list, bool* use_default); 423 Result ParseScalingList(int size, int* scaling_list, bool* use_default);
424 Result ParseSPSScalingLists(H264SPS* sps); 424 Result ParseSPSScalingLists(H264SPS* sps);
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
464 // Ranges of encrypted bytes in the buffer passed to 464 // Ranges of encrypted bytes in the buffer passed to
465 // SetEncryptedStream(). 465 // SetEncryptedStream().
466 Ranges<const uint8*> encrypted_ranges_; 466 Ranges<const uint8*> encrypted_ranges_;
467 467
468 DISALLOW_COPY_AND_ASSIGN(H264Parser); 468 DISALLOW_COPY_AND_ASSIGN(H264Parser);
469 }; 469 };
470 470
471 } // namespace media 471 } // namespace media
472 472
473 #endif // MEDIA_FILTERS_H264_PARSER_H_ 473 #endif // MEDIA_FILTERS_H264_PARSER_H_
OLDNEW
« no previous file with comments | « media/filters/ffmpeg_h265_to_annex_b_bitstream_converter.cc ('k') | media/filters/h264_parser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698