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 #ifndef MEDIA_FORMATS_WEBM_WEBM_VIDEO_CLIENT_H_ | 5 #ifndef MEDIA_FORMATS_WEBM_WEBM_VIDEO_CLIENT_H_ |
6 #define MEDIA_FORMATS_WEBM_WEBM_VIDEO_CLIENT_H_ | 6 #define MEDIA_FORMATS_WEBM_WEBM_VIDEO_CLIENT_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <string> | 10 #include <string> |
11 #include <vector> | 11 #include <vector> |
12 | 12 |
13 #include "base/macros.h" | 13 #include "base/macros.h" |
14 #include "media/base/media_log.h" | 14 #include "media/base/media_log.h" |
| 15 #include "media/formats/webm/webm_colour_parser.h" |
15 #include "media/formats/webm/webm_parser.h" | 16 #include "media/formats/webm/webm_parser.h" |
16 | 17 |
17 namespace media { | 18 namespace media { |
18 class EncryptionScheme; | 19 class EncryptionScheme; |
19 class VideoDecoderConfig; | 20 class VideoDecoderConfig; |
20 | 21 |
21 // Helper class used to parse a Video element inside a TrackEntry element. | 22 // Helper class used to parse a Video element inside a TrackEntry element. |
22 class WebMVideoClient : public WebMParserClient { | 23 class WebMVideoClient : public WebMParserClient { |
23 public: | 24 public: |
24 explicit WebMVideoClient(const scoped_refptr<MediaLog>& media_log); | 25 explicit WebMVideoClient(const scoped_refptr<MediaLog>& media_log); |
25 ~WebMVideoClient() override; | 26 ~WebMVideoClient() override; |
26 | 27 |
27 // Reset this object's state so it can process a new video track element. | 28 // Reset this object's state so it can process a new video track element. |
28 void Reset(); | 29 void Reset(); |
29 | 30 |
30 // Initialize |config| with the data in |codec_id|, |codec_private|, | 31 // Initialize |config| with the data in |codec_id|, |codec_private|, |
31 // |encryption_scheme| and the fields parsed from the last video track element | 32 // |encryption_scheme| and the fields parsed from the last video track element |
32 // this object was used to parse. | 33 // this object was used to parse. |
33 // Returns true if |config| was successfully initialized. | 34 // Returns true if |config| was successfully initialized. |
34 // Returns false if there was unexpected values in the provided parameters or | 35 // Returns false if there was unexpected values in the provided parameters or |
35 // video track element fields. The contents of |config| are undefined in this | 36 // video track element fields. The contents of |config| are undefined in this |
36 // case and should not be relied upon. | 37 // case and should not be relied upon. |
37 bool InitializeConfig(const std::string& codec_id, | 38 bool InitializeConfig(const std::string& codec_id, |
38 const std::vector<uint8_t>& codec_private, | 39 const std::vector<uint8_t>& codec_private, |
39 const EncryptionScheme& encryption_scheme, | 40 const EncryptionScheme& encryption_scheme, |
40 VideoDecoderConfig* config); | 41 VideoDecoderConfig* config); |
41 | 42 |
42 private: | 43 private: |
43 // WebMParserClient implementation. | 44 // WebMParserClient implementation. |
| 45 WebMParserClient* OnListStart(int id) override; |
| 46 bool OnListEnd(int id) override; |
44 bool OnUInt(int id, int64_t val) override; | 47 bool OnUInt(int id, int64_t val) override; |
45 bool OnBinary(int id, const uint8_t* data, int size) override; | 48 bool OnBinary(int id, const uint8_t* data, int size) override; |
46 bool OnFloat(int id, double val) override; | 49 bool OnFloat(int id, double val) override; |
47 | 50 |
48 scoped_refptr<MediaLog> media_log_; | 51 scoped_refptr<MediaLog> media_log_; |
49 int64_t pixel_width_; | 52 int64_t pixel_width_; |
50 int64_t pixel_height_; | 53 int64_t pixel_height_; |
51 int64_t crop_bottom_; | 54 int64_t crop_bottom_; |
52 int64_t crop_top_; | 55 int64_t crop_top_; |
53 int64_t crop_left_; | 56 int64_t crop_left_; |
54 int64_t crop_right_; | 57 int64_t crop_right_; |
55 int64_t display_width_; | 58 int64_t display_width_; |
56 int64_t display_height_; | 59 int64_t display_height_; |
57 int64_t display_unit_; | 60 int64_t display_unit_; |
58 int64_t alpha_mode_; | 61 int64_t alpha_mode_; |
59 | 62 |
| 63 WebMColourParser colour_parser_; |
| 64 bool colour_parsed_ = false; |
| 65 |
60 DISALLOW_COPY_AND_ASSIGN(WebMVideoClient); | 66 DISALLOW_COPY_AND_ASSIGN(WebMVideoClient); |
61 }; | 67 }; |
62 | 68 |
63 } // namespace media | 69 } // namespace media |
64 | 70 |
65 #endif // MEDIA_FORMATS_WEBM_WEBM_VIDEO_CLIENT_H_ | 71 #endif // MEDIA_FORMATS_WEBM_WEBM_VIDEO_CLIENT_H_ |
OLD | NEW |