Chromium Code Reviews| Index: media/webm/webm_cluster_parser.h |
| diff --git a/media/webm/webm_cluster_parser.h b/media/webm/webm_cluster_parser.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..2808d7efdd7a63061e59ff39cb881fa7ea2ded9e |
| --- /dev/null |
| +++ b/media/webm/webm_cluster_parser.h |
| @@ -0,0 +1,67 @@ |
| +// Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef MEDIA_WEBM_WEBM_CLUSTER_PARSER_H_ |
| +#define MEDIA_WEBM_WEBM_CLUSTER_PARSER_H_ |
| + |
| +#include <deque> |
| + |
| +#include "base/scoped_ptr.h" |
| +#include "media/base/buffers.h" |
| +#include "media/webm/webm_parser.h" |
| + |
| +namespace media { |
| + |
| +class WebMClusterParser : private WebMParserClient { |
|
scherkus (not reviewing)
2011/06/24 18:27:37
nit: use public
http://google-styleguide.googlecod
acolwell GONE FROM CHROMIUM
2011/06/27 23:48:25
Done.
|
| + |
|
scherkus (not reviewing)
2011/06/24 18:27:37
nit: blank line
acolwell GONE FROM CHROMIUM
2011/06/27 23:48:25
Done.
|
| + public: |
| + typedef std::deque<scoped_refptr<Buffer> > BufferQueue; |
| + |
| + WebMClusterParser(int64 timecode_scale, |
| + int audio_track_num, |
| + base::TimeDelta audio_default_duration, |
| + int video_track_num, |
| + base::TimeDelta video_default_duration); |
| + virtual ~WebMClusterParser(); |
| + |
| + // Resets the state of the class so Parse() can be called again. |
| + void Reset(); |
|
scherkus (not reviewing)
2011/06/24 18:27:37
these methods can certainly be dangerous (i.e., fo
acolwell GONE FROM CHROMIUM
2011/06/27 23:48:25
Decided to remove Reset(). Parse resets the object
|
| + |
| + // Parses a WebM cluster element in |buf|. |
| + // |
| + // Returns the number of bytes parsed on success. Returns -1 |
| + // if a parse error occurs. |
| + int Parse(const uint8* buf, int size); |
| + |
| + const BufferQueue& audio_buffers() const; |
| + const BufferQueue& video_buffers() const; |
| + |
| + private: |
| + // WebMParserClient methods. |
| + virtual bool OnListStart(int id); |
| + virtual bool OnListEnd(int id); |
| + virtual bool OnUInt(int id, int64 val); |
| + virtual bool OnFloat(int id, double val); |
| + virtual bool OnBinary(int id, const uint8* data, int size); |
| + virtual bool OnString(int id, const std::string& str); |
| + virtual bool OnSimpleBlock(int track_num, int timecode, int flags, |
| + const uint8* data, int size); |
| + |
| + Buffer* CreateBuffer(const uint8* data, size_t size) const; |
| + |
| + double timecode_multiplier_; // Multiplier used to convert timecodes into |
| + // microseconds. |
| + int audio_track_num_; |
| + base::TimeDelta audio_default_duration_; |
| + int video_track_num_; |
| + base::TimeDelta video_default_duration_; |
| + |
| + int64 cluster_timecode_; |
| + BufferQueue audio_buffers_; |
| + BufferQueue video_buffers_; |
| +}; |
|
scherkus (not reviewing)
2011/06/24 18:27:37
DISALLOW etc
acolwell GONE FROM CHROMIUM
2011/06/27 23:48:25
Done.
|
| + |
| +} // namespace media |
| + |
| +#endif // MEDIA_WEBM_WEBM_CLUSTER_PARSER_H_ |