Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(241)

Side by Side Diff: media/webm/webm_stream_parser.h

Issue 20123002: Add Chromium-side support for SourceBuffer.appendWindowStart and SourceBuffer.appendWindowEnd. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef MEDIA_WEBM_WEBM_STREAM_PARSER_H_ 5 #ifndef MEDIA_WEBM_WEBM_STREAM_PARSER_H_
6 #define MEDIA_WEBM_WEBM_STREAM_PARSER_H_ 6 #define MEDIA_WEBM_WEBM_STREAM_PARSER_H_
7 7
8 #include <map> 8 #include <map>
9 9
10 #include "base/callback_forward.h" 10 #include "base/callback_forward.h"
11 #include "base/memory/ref_counted.h" 11 #include "base/memory/ref_counted.h"
12 #include "media/base/audio_decoder_config.h" 12 #include "media/base/audio_decoder_config.h"
13 #include "media/base/buffers.h" 13 #include "media/base/buffers.h"
14 #include "media/base/byte_queue.h" 14 #include "media/base/byte_queue.h"
15 #include "media/base/stream_parser.h" 15 #include "media/base/stream_parser.h"
16 #include "media/base/video_decoder_config.h" 16 #include "media/base/video_decoder_config.h"
17 17
18 namespace media { 18 namespace media {
19 19
20 class WebMClusterParser; 20 class WebMClusterParser;
21 21
22 class WebMStreamParser : public StreamParser { 22 class WebMStreamParser : public StreamParser {
23 public: 23 public:
24 WebMStreamParser(); 24 WebMStreamParser();
25 virtual ~WebMStreamParser(); 25 virtual ~WebMStreamParser();
26 26
27 // StreamParser implementation. 27 // StreamParser implementation.
28 virtual void Init(const InitCB& init_cb, const NewConfigCB& config_cb, 28 virtual void Init(const InitCB& init_cb, const NewConfigCB& config_cb,
29 const NewBuffersCB& audio_cb, 29 const NewBuffersCB& new_buffers_cb,
30 const NewBuffersCB& video_cb,
31 const NewTextBuffersCB& text_cb, 30 const NewTextBuffersCB& text_cb,
32 const NeedKeyCB& need_key_cb, 31 const NeedKeyCB& need_key_cb,
33 const AddTextTrackCB& add_text_track_cb, 32 const AddTextTrackCB& add_text_track_cb,
34 const NewMediaSegmentCB& new_segment_cb, 33 const NewMediaSegmentCB& new_segment_cb,
35 const base::Closure& end_of_segment_cb, 34 const base::Closure& end_of_segment_cb,
36 const LogCB& log_cb) OVERRIDE; 35 const LogCB& log_cb) OVERRIDE;
37 virtual void Flush() OVERRIDE; 36 virtual void Flush() OVERRIDE;
38 virtual bool Parse(const uint8* buf, int size) OVERRIDE; 37 virtual bool Parse(const uint8* buf, int size) OVERRIDE;
39 38
40 private: 39 private:
(...skipping 24 matching lines...) Expand all
65 // Returns 0 if more data is needed. 64 // Returns 0 if more data is needed.
66 // Returning > 0 indicates success & the number of bytes parsed. 65 // Returning > 0 indicates success & the number of bytes parsed.
67 int ParseCluster(const uint8* data, int size); 66 int ParseCluster(const uint8* data, int size);
68 67
69 // Fire needkey event through the |need_key_cb_|. 68 // Fire needkey event through the |need_key_cb_|.
70 void FireNeedKey(const std::string& key_id); 69 void FireNeedKey(const std::string& key_id);
71 70
72 State state_; 71 State state_;
73 InitCB init_cb_; 72 InitCB init_cb_;
74 NewConfigCB config_cb_; 73 NewConfigCB config_cb_;
75 NewBuffersCB audio_cb_; 74 NewBuffersCB new_buffers_cb_;
76 NewBuffersCB video_cb_;
77 NewTextBuffersCB text_cb_; 75 NewTextBuffersCB text_cb_;
78 NeedKeyCB need_key_cb_; 76 NeedKeyCB need_key_cb_;
79 AddTextTrackCB add_text_track_cb_; 77 AddTextTrackCB add_text_track_cb_;
80 78
81 typedef std::map<int, TextTrack* > TextTrackMap; 79 typedef std::map<int, TextTrack* > TextTrackMap;
82 TextTrackMap text_track_map_; 80 TextTrackMap text_track_map_;
83 81
84 NewMediaSegmentCB new_segment_cb_; 82 NewMediaSegmentCB new_segment_cb_;
85 base::Closure end_of_segment_cb_; 83 base::Closure end_of_segment_cb_;
86 LogCB log_cb_; 84 LogCB log_cb_;
87 85
88 // True if a new cluster id has been seen, but no audio or video buffers have 86 // True if a new cluster id has been seen, but no audio or video buffers have
89 // been parsed yet. 87 // been parsed yet.
90 bool waiting_for_buffers_; 88 bool waiting_for_buffers_;
91 89
92 scoped_ptr<WebMClusterParser> cluster_parser_; 90 scoped_ptr<WebMClusterParser> cluster_parser_;
93 ByteQueue byte_queue_; 91 ByteQueue byte_queue_;
94 92
95 DISALLOW_COPY_AND_ASSIGN(WebMStreamParser); 93 DISALLOW_COPY_AND_ASSIGN(WebMStreamParser);
96 }; 94 };
97 95
98 } // namespace media 96 } // namespace media
99 97
100 #endif // MEDIA_WEBM_WEBM_STREAM_PARSER_H_ 98 #endif // MEDIA_WEBM_WEBM_STREAM_PARSER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698