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

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

Issue 13419002: Media Source dispatches inband text tracks (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: rebase Created 7 years, 7 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
« no previous file with comments | « media/webm/webm_parser.h ('k') | media/webm/webm_stream_parser.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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>
9
8 #include "base/callback_forward.h" 10 #include "base/callback_forward.h"
9 #include "base/memory/ref_counted.h" 11 #include "base/memory/ref_counted.h"
10 #include "media/base/audio_decoder_config.h" 12 #include "media/base/audio_decoder_config.h"
11 #include "media/base/buffers.h" 13 #include "media/base/buffers.h"
12 #include "media/base/byte_queue.h" 14 #include "media/base/byte_queue.h"
13 #include "media/base/stream_parser.h" 15 #include "media/base/stream_parser.h"
14 #include "media/base/video_decoder_config.h" 16 #include "media/base/video_decoder_config.h"
15 17
16 namespace media { 18 namespace media {
17 19
18 class WebMClusterParser; 20 class WebMClusterParser;
19 21
20 class WebMStreamParser : public StreamParser { 22 class WebMStreamParser : public StreamParser {
21 public: 23 public:
22 WebMStreamParser(); 24 WebMStreamParser();
23 virtual ~WebMStreamParser(); 25 virtual ~WebMStreamParser();
24 26
25 // StreamParser implementation. 27 // StreamParser implementation.
26 virtual void Init(const InitCB& init_cb, const NewConfigCB& config_cb, 28 virtual void Init(const InitCB& init_cb, const NewConfigCB& config_cb,
27 const NewBuffersCB& audio_cb, 29 const NewBuffersCB& audio_cb,
28 const NewBuffersCB& video_cb, 30 const NewBuffersCB& video_cb,
31 const NewTextBuffersCB& text_cb,
29 const NeedKeyCB& need_key_cb, 32 const NeedKeyCB& need_key_cb,
33 const AddTextTrackCB& add_text_track_cb,
30 const NewMediaSegmentCB& new_segment_cb, 34 const NewMediaSegmentCB& new_segment_cb,
31 const base::Closure& end_of_segment_cb, 35 const base::Closure& end_of_segment_cb,
32 const LogCB& log_cb) OVERRIDE; 36 const LogCB& log_cb) OVERRIDE;
33 virtual void Flush() OVERRIDE; 37 virtual void Flush() OVERRIDE;
34 virtual bool Parse(const uint8* buf, int size) OVERRIDE; 38 virtual bool Parse(const uint8* buf, int size) OVERRIDE;
35 39
36 private: 40 private:
37 enum State { 41 enum State {
38 kWaitingForInit, 42 kWaitingForInit,
39 kParsingHeaders, 43 kParsingHeaders,
(...skipping 23 matching lines...) Expand all
63 int ParseCluster(const uint8* data, int size); 67 int ParseCluster(const uint8* data, int size);
64 68
65 // Fire needkey event through the |need_key_cb_|. 69 // Fire needkey event through the |need_key_cb_|.
66 void FireNeedKey(const std::string& key_id); 70 void FireNeedKey(const std::string& key_id);
67 71
68 State state_; 72 State state_;
69 InitCB init_cb_; 73 InitCB init_cb_;
70 NewConfigCB config_cb_; 74 NewConfigCB config_cb_;
71 NewBuffersCB audio_cb_; 75 NewBuffersCB audio_cb_;
72 NewBuffersCB video_cb_; 76 NewBuffersCB video_cb_;
77 NewTextBuffersCB text_cb_;
73 NeedKeyCB need_key_cb_; 78 NeedKeyCB need_key_cb_;
79 AddTextTrackCB add_text_track_cb_;
80
81 typedef std::map<int, TextTrack* > TextTrackMap;
82 TextTrackMap text_track_map_;
83
74 NewMediaSegmentCB new_segment_cb_; 84 NewMediaSegmentCB new_segment_cb_;
75 base::Closure end_of_segment_cb_; 85 base::Closure end_of_segment_cb_;
76 LogCB log_cb_; 86 LogCB log_cb_;
77 87
78 // True if a new cluster id has been seen, but no audio or video buffers have 88 // True if a new cluster id has been seen, but no audio or video buffers have
79 // been parsed yet. 89 // been parsed yet.
80 bool waiting_for_buffers_; 90 bool waiting_for_buffers_;
81 91
82 scoped_ptr<WebMClusterParser> cluster_parser_; 92 scoped_ptr<WebMClusterParser> cluster_parser_;
83 ByteQueue byte_queue_; 93 ByteQueue byte_queue_;
84 94
85 DISALLOW_COPY_AND_ASSIGN(WebMStreamParser); 95 DISALLOW_COPY_AND_ASSIGN(WebMStreamParser);
86 }; 96 };
87 97
88 } // namespace media 98 } // namespace media
89 99
90 #endif // MEDIA_WEBM_WEBM_STREAM_PARSER_H_ 100 #endif // MEDIA_WEBM_WEBM_STREAM_PARSER_H_
OLDNEW
« no previous file with comments | « media/webm/webm_parser.h ('k') | media/webm/webm_stream_parser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698