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