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