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_colour_parser.h" |
16 #include "media/formats/webm/webm_parser.h" | 16 #include "media/formats/webm/webm_parser.h" |
17 | 17 |
18 namespace media { | 18 namespace media { |
19 class EncryptionScheme; | 19 class EncryptionScheme; |
20 class VideoDecoderConfig; | 20 class VideoDecoderConfig; |
21 | 21 |
22 // 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. |
23 class WebMVideoClient : public WebMParserClient { | 23 class WebMVideoClient : public WebMParserClient { |
24 public: | 24 public: |
25 explicit WebMVideoClient(const scoped_refptr<MediaLog>& media_log); | 25 explicit WebMVideoClient(MediaLog* media_log); |
26 ~WebMVideoClient() override; | 26 ~WebMVideoClient() override; |
27 | 27 |
28 // 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. |
29 void Reset(); | 29 void Reset(); |
30 | 30 |
31 // Initialize |config| with the data in |codec_id|, |codec_private|, | 31 // Initialize |config| with the data in |codec_id|, |codec_private|, |
32 // |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 |
33 // this object was used to parse. | 33 // this object was used to parse. |
34 // Returns true if |config| was successfully initialized. | 34 // Returns true if |config| was successfully initialized. |
35 // 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 |
36 // 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 |
37 // case and should not be relied upon. | 37 // case and should not be relied upon. |
38 bool InitializeConfig(const std::string& codec_id, | 38 bool InitializeConfig(const std::string& codec_id, |
39 const std::vector<uint8_t>& codec_private, | 39 const std::vector<uint8_t>& codec_private, |
40 const EncryptionScheme& encryption_scheme, | 40 const EncryptionScheme& encryption_scheme, |
41 VideoDecoderConfig* config); | 41 VideoDecoderConfig* config); |
42 | 42 |
43 private: | 43 private: |
44 // WebMParserClient implementation. | 44 // WebMParserClient implementation. |
45 WebMParserClient* OnListStart(int id) override; | 45 WebMParserClient* OnListStart(int id) override; |
46 bool OnListEnd(int id) override; | 46 bool OnListEnd(int id) override; |
47 bool OnUInt(int id, int64_t val) override; | 47 bool OnUInt(int id, int64_t val) override; |
48 bool OnBinary(int id, const uint8_t* data, int size) override; | 48 bool OnBinary(int id, const uint8_t* data, int size) override; |
49 bool OnFloat(int id, double val) override; | 49 bool OnFloat(int id, double val) override; |
50 | 50 |
51 scoped_refptr<MediaLog> media_log_; | 51 MediaLog* media_log_; |
52 int64_t pixel_width_; | 52 int64_t pixel_width_; |
53 int64_t pixel_height_; | 53 int64_t pixel_height_; |
54 int64_t crop_bottom_; | 54 int64_t crop_bottom_; |
55 int64_t crop_top_; | 55 int64_t crop_top_; |
56 int64_t crop_left_; | 56 int64_t crop_left_; |
57 int64_t crop_right_; | 57 int64_t crop_right_; |
58 int64_t display_width_; | 58 int64_t display_width_; |
59 int64_t display_height_; | 59 int64_t display_height_; |
60 int64_t display_unit_; | 60 int64_t display_unit_; |
61 int64_t alpha_mode_; | 61 int64_t alpha_mode_; |
62 | 62 |
63 WebMColourParser colour_parser_; | 63 WebMColourParser colour_parser_; |
64 bool colour_parsed_ = false; | 64 bool colour_parsed_ = false; |
65 | 65 |
66 DISALLOW_COPY_AND_ASSIGN(WebMVideoClient); | 66 DISALLOW_COPY_AND_ASSIGN(WebMVideoClient); |
67 }; | 67 }; |
68 | 68 |
69 } // namespace media | 69 } // namespace media |
70 | 70 |
71 #endif // MEDIA_FORMATS_WEBM_WEBM_VIDEO_CLIENT_H_ | 71 #endif // MEDIA_FORMATS_WEBM_WEBM_VIDEO_CLIENT_H_ |
OLD | NEW |