OLD | NEW |
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 #include "media/filters/h264_parser.h" | 5 #include "media/filters/h264_parser.h" |
6 | 6 |
7 #include <limits> | 7 #include <limits> |
8 #include <memory> | 8 #include <memory> |
9 | 9 |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
298 *start_code_size = 0; | 298 *start_code_size = 0; |
299 start += std::min(*offset + 1, bytes_left); | 299 start += std::min(*offset + 1, bytes_left); |
300 } | 300 } |
301 } while (*start_code_size == 0); | 301 } while (*start_code_size == 0); |
302 | 302 |
303 // Update |*offset| to include the data we skipped over. | 303 // Update |*offset| to include the data we skipped over. |
304 *offset += start - data; | 304 *offset += start - data; |
305 return true; | 305 return true; |
306 } | 306 } |
307 | 307 |
| 308 VideoCodecProfile H264Parser::ProfileIDCToVideoCodecProfile(int profile_idc) { |
| 309 switch (profile_idc) { |
| 310 case H264SPS::kProfileIDCBaseline: |
| 311 return H264PROFILE_BASELINE; |
| 312 case H264SPS::kProfileIDCMain: |
| 313 return H264PROFILE_MAIN; |
| 314 case H264SPS::kProfileIDCHigh: |
| 315 return H264PROFILE_HIGH; |
| 316 case H264SPS::kProfileIDHigh10: |
| 317 return H264PROFILE_HIGH10PROFILE; |
| 318 case H264SPS::kProfileIDHigh422: |
| 319 return H264PROFILE_HIGH422PROFILE; |
| 320 case H264SPS::kProfileIDHigh444Predictive: |
| 321 return H264PROFILE_HIGH444PREDICTIVEPROFILE; |
| 322 case H264SPS::kProfileIDScalableBaseline: |
| 323 return H264PROFILE_SCALABLEBASELINE; |
| 324 case H264SPS::kProfileIDScalableHigh: |
| 325 return H264PROFILE_SCALABLEHIGH; |
| 326 case H264SPS::kProfileIDStereoHigh: |
| 327 return H264PROFILE_STEREOHIGH; |
| 328 case H264SPS::kProfileIDSMultiviewHigh: |
| 329 return H264PROFILE_MULTIVIEWHIGH; |
| 330 } |
| 331 NOTREACHED() << "unknown video profile: " << profile_idc; |
| 332 return VIDEO_CODEC_PROFILE_UNKNOWN; |
| 333 } |
| 334 |
308 H264Parser::Result H264Parser::ReadUE(int* val) { | 335 H264Parser::Result H264Parser::ReadUE(int* val) { |
309 int num_bits = -1; | 336 int num_bits = -1; |
310 int bit; | 337 int bit; |
311 int rest; | 338 int rest; |
312 | 339 |
313 // Count the number of contiguous zero bits. | 340 // Count the number of contiguous zero bits. |
314 do { | 341 do { |
315 READ_BITS_OR_RETURN(1, &bit); | 342 READ_BITS_OR_RETURN(1, &bit); |
316 num_bits++; | 343 num_bits++; |
317 } while (bit == 0); | 344 } while (bit == 0); |
(...skipping 1030 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1348 | 1375 |
1349 default: | 1376 default: |
1350 DVLOG(4) << "Unsupported SEI message"; | 1377 DVLOG(4) << "Unsupported SEI message"; |
1351 break; | 1378 break; |
1352 } | 1379 } |
1353 | 1380 |
1354 return kOk; | 1381 return kOk; |
1355 } | 1382 } |
1356 | 1383 |
1357 } // namespace media | 1384 } // namespace media |
OLD | NEW |