summaryrefslogtreecommitdiff
path: root/chromium/media/formats/webm/webm_projection_parser.h
blob: 52568fee33b141a4873b72c4251b378ea8382bce (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef MEDIA_FORMATS_WEBM_WEBM_PROJECTION_PARSER_H_
#define MEDIA_FORMATS_WEBM_WEBM_PROJECTION_PARSER_H_

#include "base/memory/raw_ptr.h"
#include "media/base/media_log.h"
#include "media/formats/webm/webm_parser.h"

namespace media {

// Parser for WebM Projection element:
class MEDIA_EXPORT WebMProjectionParser : public WebMParserClient {
 public:
  explicit WebMProjectionParser(MediaLog* media_log);

  WebMProjectionParser(const WebMProjectionParser&) = delete;
  WebMProjectionParser& operator=(const WebMProjectionParser&) = delete;

  ~WebMProjectionParser() override;

  void Reset();
  bool Validate() const;

 private:
  friend class WebMProjectionParserTest;

  // WebMParserClient implementation.
  bool OnUInt(int id, int64_t val) override;
  bool OnFloat(int id, double val) override;

  // private data
  raw_ptr<MediaLog> media_log_;
  int64_t projection_type_;
  double pose_yaw_;    // value must be [-180, 180]
  double pose_pitch_;  // value must be [-90, 90]
  double pose_roll_;   // value must be [-180, 180]
};

}  // namespace media

#endif  // MEDIA_FORMATS_WEBM_WEBM_PROJECTION_PARSER_H_