Index: media/filters/h264_parser.cc |
diff --git a/media/filters/h264_parser.cc b/media/filters/h264_parser.cc |
index 991599e2accd577a09e05c85edb52b596e599ffb..9247078d45e1215aecff0ca2538cefa55a840f95 100644 |
--- a/media/filters/h264_parser.cc |
+++ b/media/filters/h264_parser.cc |
@@ -122,6 +122,24 @@ base::Optional<gfx::Rect> H264SPS::GetVisibleRect() const { |
coded_size->height() - crop_top - crop_bottom); |
} |
+gfx::ColorSpace H264SPS::GetColorSpace() const { |
sandersd (OOO until July 31)
2016/09/16 18:50:26
Nit: Comment where in the spec this comes from (E.
hubbe
2016/09/21 22:04:25
Done.
|
+ if (colour_description_present_flag) { |
+ return gfx::ColorSpace( |
+ static_cast<gfx::ColorSpace::PrimaryID>(colour_primaries), |
sandersd (OOO until July 31)
2016/09/16 18:50:26
This is either unspecified (C++<17) or undefined (
sandersd (OOO until July 31)
2016/09/16 19:31:47
I'll retract that since all of these enums specify
hubbe
2016/09/21 22:04:25
Done.
|
+ static_cast<gfx::ColorSpace::TransferID>(transfer_characteristics), |
+ static_cast<gfx::ColorSpace::MatrixID>(matrix_coefficients), |
+ video_full_range_flag ? gfx::ColorSpace::RangeID::FULL |
+ : gfx::ColorSpace::RangeID::LIMITED); |
+ } else { |
+ return gfx::ColorSpace(gfx::ColorSpace::PrimaryID::UNSPECIFIED, |
+ gfx::ColorSpace::TransferID::UNSPECIFIED, |
+ gfx::ColorSpace::MatrixID::UNSPECIFIED, |
+ video_full_range_flag |
+ ? gfx::ColorSpace::RangeID::FULL |
+ : gfx::ColorSpace::RangeID::LIMITED); |
+ } |
+} |
+ |
H264PPS::H264PPS() { |
memset(this, 0, sizeof(*this)); |
} |
@@ -816,13 +834,17 @@ H264Parser::Result H264Parser::ParseVUIParameters(H264SPS* sps) { |
if (data) |
READ_BOOL_OR_RETURN(&data); // overscan_appropriate_flag |
- READ_BOOL_OR_RETURN(&data); // video_signal_type_present_flag |
- if (data) { |
- READ_BITS_OR_RETURN(3, &data); // video_format |
- READ_BOOL_OR_RETURN(&data); // video_full_range_flag |
- READ_BOOL_OR_RETURN(&data); // colour_description_present_flag |
- if (data) |
- READ_BITS_OR_RETURN(24, &data); // color description syntax elements |
+ READ_BOOL_OR_RETURN(&sps->video_signal_type_present_flag); |
+ if (sps->video_signal_type_present_flag) { |
+ READ_BITS_OR_RETURN(3, &sps->video_format); |
+ READ_BOOL_OR_RETURN(&sps->video_full_range_flag); |
+ READ_BOOL_OR_RETURN(&sps->colour_description_present_flag); |
+ if (sps->colour_description_present_flag) { |
+ // color description syntax elements |
+ READ_BITS_OR_RETURN(8, &sps->colour_primaries); |
+ READ_BITS_OR_RETURN(8, &sps->transfer_characteristics); |
+ READ_BITS_OR_RETURN(8, &sps->matrix_coefficients); |
+ } |
} |
READ_BOOL_OR_RETURN(&data); // chroma_loc_info_present_flag |