blob: 50a5b0dcb89f4f7a3b35391c08600dec6094efa8 (
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
|
// Copyright 2014 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_VIDEO_CLIENT_H_
#define MEDIA_FORMATS_WEBM_WEBM_VIDEO_CLIENT_H_
#include <stdint.h>
#include <string>
#include <vector>
#include "base/memory/raw_ptr.h"
#include "media/base/encryption_scheme.h"
#include "media/base/media_export.h"
#include "media/base/media_log.h"
#include "media/formats/webm/webm_colour_parser.h"
#include "media/formats/webm/webm_parser.h"
#include "media/formats/webm/webm_projection_parser.h"
namespace media {
class VideoDecoderConfig;
// Helper class used to parse a Video element inside a TrackEntry element.
class MEDIA_EXPORT WebMVideoClient : public WebMParserClient {
public:
explicit WebMVideoClient(MediaLog* media_log);
WebMVideoClient(const WebMVideoClient&) = delete;
WebMVideoClient& operator=(const WebMVideoClient&) = delete;
~WebMVideoClient() override;
// Reset this object's state so it can process a new video track element.
void Reset();
// Initialize |config| with the data in |codec_id|, |codec_private|,
// |encryption_scheme| and the fields parsed from the last video track element
// this object was used to parse.
// Returns true if |config| was successfully initialized.
// Returns false if there was unexpected values in the provided parameters or
// video track element fields. The contents of |config| are undefined in this
// case and should not be relied upon.
bool InitializeConfig(const std::string& codec_id,
const std::vector<uint8_t>& codec_private,
EncryptionScheme encryption_scheme,
VideoDecoderConfig* config);
private:
friend class WebMVideoClientTest;
friend class WebMProjectionParserTest;
// WebMParserClient implementation.
WebMParserClient* OnListStart(int id) override;
bool OnListEnd(int id) override;
bool OnUInt(int id, int64_t val) override;
bool OnBinary(int id, const uint8_t* data, int size) override;
bool OnFloat(int id, double val) override;
raw_ptr<MediaLog> media_log_;
int64_t pixel_width_;
int64_t pixel_height_;
int64_t crop_bottom_;
int64_t crop_top_;
int64_t crop_left_;
int64_t crop_right_;
int64_t display_width_;
int64_t display_height_;
int64_t display_unit_;
int64_t alpha_mode_;
int64_t stereo_mode_;
WebMColourParser colour_parser_;
bool colour_parsed_ = false;
WebMProjectionParser projection_parser_;
bool projection_parsed_ = false;
};
} // namespace media
#endif // MEDIA_FORMATS_WEBM_WEBM_VIDEO_CLIENT_H_
|