cc: Added inline to Tile::IsReadyToDraw
[chromium-blink-merge.git] / media / webm / webm_tracks_parser.h
blob81588e4b51e433a7b024e1d1483bfb75e46da766
1 // Copyright (c) 2012 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_WEBM_WEBM_TRACKS_PARSER_H_
6 #define MEDIA_WEBM_WEBM_TRACKS_PARSER_H_
8 #include <map>
9 #include <set>
10 #include <string>
11 #include <vector>
13 #include "base/compiler_specific.h"
14 #include "base/memory/scoped_ptr.h"
15 #include "media/base/audio_decoder_config.h"
16 #include "media/base/media_log.h"
17 #include "media/base/text_track.h"
18 #include "media/base/video_decoder_config.h"
19 #include "media/webm/webm_audio_client.h"
20 #include "media/webm/webm_content_encodings_client.h"
21 #include "media/webm/webm_parser.h"
22 #include "media/webm/webm_video_client.h"
24 namespace media {
26 // Parser for WebM Tracks element.
27 class MEDIA_EXPORT WebMTracksParser : public WebMParserClient {
28 public:
29 explicit WebMTracksParser(const LogCB& log_cb, bool ignore_text_tracks);
30 virtual ~WebMTracksParser();
32 // Parses a WebM Tracks element in |buf|.
34 // Returns -1 if the parse fails.
35 // Returns 0 if more data is needed.
36 // Returns the number of bytes parsed on success.
37 int Parse(const uint8* buf, int size);
39 int64 audio_track_num() const { return audio_track_num_; }
40 int64 video_track_num() const { return video_track_num_; }
41 const std::set<int64>& ignored_tracks() const { return ignored_tracks_; }
43 const std::string& audio_encryption_key_id() const {
44 return audio_encryption_key_id_;
47 const AudioDecoderConfig& audio_decoder_config() {
48 return audio_decoder_config_;
51 const std::string& video_encryption_key_id() const {
52 return video_encryption_key_id_;
55 const VideoDecoderConfig& video_decoder_config() {
56 return video_decoder_config_;
59 struct TextTrackInfo {
60 TextKind kind;
61 std::string name;
62 std::string language;
65 typedef std::map<int64, TextTrackInfo> TextTracks;
67 const TextTracks& text_tracks() const {
68 return text_tracks_;
71 private:
72 // WebMParserClient implementation.
73 virtual WebMParserClient* OnListStart(int id) OVERRIDE;
74 virtual bool OnListEnd(int id) OVERRIDE;
75 virtual bool OnUInt(int id, int64 val) OVERRIDE;
76 virtual bool OnFloat(int id, double val) OVERRIDE;
77 virtual bool OnBinary(int id, const uint8* data, int size) OVERRIDE;
78 virtual bool OnString(int id, const std::string& str) OVERRIDE;
80 int64 track_type_;
81 int64 track_num_;
82 std::string track_name_;
83 std::string track_language_;
84 std::string codec_id_;
85 std::vector<uint8> codec_private_;
86 scoped_ptr<WebMContentEncodingsClient> track_content_encodings_client_;
88 int64 audio_track_num_;
89 int64 video_track_num_;
90 bool ignore_text_tracks_;
91 TextTracks text_tracks_;
92 std::set<int64> ignored_tracks_;
93 std::string audio_encryption_key_id_;
94 std::string video_encryption_key_id_;
95 LogCB log_cb_;
97 WebMAudioClient audio_client_;
98 AudioDecoderConfig audio_decoder_config_;
100 WebMVideoClient video_client_;
101 VideoDecoderConfig video_decoder_config_;
103 DISALLOW_COPY_AND_ASSIGN(WebMTracksParser);
106 } // namespace media
108 #endif // MEDIA_WEBM_WEBM_TRACKS_PARSER_H_