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
3 // found in the LICENSE file.
5 #ifndef MEDIA_FORMATS_WEBM_WEBM_VIDEO_CLIENT_H_
6 #define MEDIA_FORMATS_WEBM_WEBM_VIDEO_CLIENT_H_
11 #include "media/base/media_log.h"
12 #include "media/formats/webm/webm_parser.h"
15 class VideoDecoderConfig
;
17 // Helper class used to parse a Video element inside a TrackEntry element.
18 class WebMVideoClient
: public WebMParserClient
{
20 explicit WebMVideoClient(const scoped_refptr
<MediaLog
>& media_log
);
21 ~WebMVideoClient() override
;
23 // Reset this object's state so it can process a new video track element.
26 // Initialize |config| with the data in |codec_id|, |codec_private|,
27 // |is_encrypted| and the fields parsed from the last video track element this
28 // object was used to parse.
29 // Returns true if |config| was successfully initialized.
30 // Returns false if there was unexpected values in the provided parameters or
31 // video track element fields. The contents of |config| are undefined in this
32 // case and should not be relied upon.
33 bool InitializeConfig(const std::string
& codec_id
,
34 const std::vector
<uint8
>& codec_private
,
36 VideoDecoderConfig
* config
);
39 // WebMParserClient implementation.
40 bool OnUInt(int id
, int64 val
) override
;
41 bool OnBinary(int id
, const uint8
* data
, int size
) override
;
42 bool OnFloat(int id
, double val
) override
;
44 scoped_refptr
<MediaLog
> media_log_
;
52 int64 display_height_
;
56 DISALLOW_COPY_AND_ASSIGN(WebMVideoClient
);
61 #endif // MEDIA_FORMATS_WEBM_WEBM_VIDEO_CLIENT_H_