OLD | NEW |
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 #include "content/common/gpu/media/h264_bit_reader.h" | 5 #include "content/common/gpu/media/h264_bit_reader.h" |
6 | 6 |
7 namespace content { | 7 namespace content { |
8 | 8 |
9 H264BitReader::H264BitReader() { | 9 H264BitReader::H264BitReader() { |
10 } | 10 } |
(...skipping 24 matching lines...) Expand all Loading... |
35 | 35 |
36 // Check if this is the end of RBSP data. | 36 // Check if this is the end of RBSP data. |
37 if (bytes_left_ == 0) { | 37 if (bytes_left_ == 0) { |
38 while (num_remaining_bits_in_curr_byte_ != 0 && !(curr_byte_ & 0x1)) { | 38 while (num_remaining_bits_in_curr_byte_ != 0 && !(curr_byte_ & 0x1)) { |
39 --num_remaining_bits_in_curr_byte_; | 39 --num_remaining_bits_in_curr_byte_; |
40 curr_byte_ >>= 1; | 40 curr_byte_ >>= 1; |
41 } | 41 } |
42 } | 42 } |
43 } | 43 } |
44 | 44 |
| 45 bool H264BitReader::HasMoreRBSPData() { |
| 46 // Make sure we have more bits, if we are at 0 bits in current byte |
| 47 // and updating current byte fails, we don't have more data anyway. |
| 48 if (num_remaining_bits_in_curr_byte_ == 0) { |
| 49 UpdateCurrByte(); |
| 50 if (num_remaining_bits_in_curr_byte_ == 0) |
| 51 return false; |
| 52 } |
| 53 |
| 54 // Not on last byte? |
| 55 if (bytes_left_) |
| 56 return true; |
| 57 |
| 58 // Last byte, look for stop bit; |
| 59 // We have more RBSP data if the last non-zero bit we find is not the |
| 60 // first available bit. |
| 61 return (curr_byte_ & |
| 62 ((1 << (num_remaining_bits_in_curr_byte_ - 1)) - 1)) != 0; |
| 63 } |
| 64 |
45 } // namespace content | 65 } // namespace content |
OLD | NEW |