OLD | NEW |
---|---|
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_BASE_STREAM_PARSER_H_ | 5 #ifndef MEDIA_BASE_STREAM_PARSER_H_ |
6 #define MEDIA_BASE_STREAM_PARSER_H_ | 6 #define MEDIA_BASE_STREAM_PARSER_H_ |
7 | 7 |
8 #include <deque> | 8 #include <deque> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 25 matching lines...) Expand all Loading... | |
36 // occurred. | 36 // occurred. |
37 // Second parameter - Indicates the stream duration. Only contains a valid | 37 // Second parameter - Indicates the stream duration. Only contains a valid |
38 // value if the first parameter is true. | 38 // value if the first parameter is true. |
39 typedef base::Callback<void(bool, base::TimeDelta)> InitCB; | 39 typedef base::Callback<void(bool, base::TimeDelta)> InitCB; |
40 | 40 |
41 // Indicates when new stream configurations have been parsed. | 41 // Indicates when new stream configurations have been parsed. |
42 // First parameter - The new audio configuration. If the config is not valid | 42 // First parameter - The new audio configuration. If the config is not valid |
43 // then it means that there isn't an audio stream. | 43 // then it means that there isn't an audio stream. |
44 // Second parameter - The new video configuration. If the config is not valid | 44 // Second parameter - The new video configuration. If the config is not valid |
45 // then it means that there isn't an audio stream. | 45 // then it means that there isn't an audio stream. |
46 // Third parameter - The new text tracks configuration. If the map is empty, | |
47 // then no text tracks were parsed from the stream. | |
46 // Return value - True if the new configurations are accepted. | 48 // Return value - True if the new configurations are accepted. |
47 // False if the new configurations are not supported | 49 // False if the new configurations are not supported |
48 // and indicates that a parsing error should be signalled. | 50 // and indicates that a parsing error should be signalled. |
49 typedef base::Callback<bool(const AudioDecoderConfig&, | 51 typedef base::Callback<bool(const AudioDecoderConfig&, |
50 const VideoDecoderConfig&)> NewConfigCB; | 52 const VideoDecoderConfig&, |
53 const TextTrackConfigMap&)> NewConfigCB; | |
51 | 54 |
52 // New stream buffers have been parsed. | 55 // New stream buffers have been parsed. |
53 // First parameter - A queue of newly parsed audio buffers. | 56 // First parameter - A queue of newly parsed audio buffers. |
54 // Second parameter - A queue of newly parsed video buffers. | 57 // Second parameter - A queue of newly parsed video buffers. |
55 // Return value - True indicates that the buffers are accepted. | 58 // Return value - True indicates that the buffers are accepted. |
56 // False if something was wrong with the buffers and a parsing | 59 // False if something was wrong with the buffers and a parsing |
57 // error should be signalled. | 60 // error should be signalled. |
58 typedef base::Callback<bool(const BufferQueue&, | 61 typedef base::Callback<bool(const BufferQueue&, |
59 const BufferQueue&)> NewBuffersCB; | 62 const BufferQueue&)> NewBuffersCB; |
60 | 63 |
61 // New stream buffers of inband text have been parsed. | 64 // New stream buffers of inband text have been parsed. |
62 // First parameter - The text track to which these cues will be added. | 65 // First parameter - The (number of the) text track to which these cues will |
acolwell GONE FROM CHROMIUM
2013/10/21 20:10:40
nit: s/number/id & drop the parenthesis.
Matthew Heaney (Chromium)
2013/10/23 05:09:01
Done.
| |
66 // be added. | |
63 // Second parameter - A queue of newly parsed buffers. | 67 // Second parameter - A queue of newly parsed buffers. |
64 // Return value - True indicates that the buffers are accepted. | 68 // Return value - True indicates that the buffers are accepted. |
65 // False if something was wrong with the buffers and a parsing | 69 // False if something was wrong with the buffers and a parsing |
66 // error should be signalled. | 70 // error should be signalled. |
67 typedef base::Callback<bool(TextTrack*, const BufferQueue&)> NewTextBuffersCB; | 71 typedef base::Callback<bool(int track_number, |
acolwell GONE FROM CHROMIUM
2013/10/21 20:10:40
nit: remove name here
Matthew Heaney (Chromium)
2013/10/23 05:09:01
Done.
| |
72 const BufferQueue&)> NewTextBuffersCB; | |
68 | 73 |
69 // Signals the beginning of a new media segment. | 74 // Signals the beginning of a new media segment. |
70 typedef base::Callback<void()> NewMediaSegmentCB; | 75 typedef base::Callback<void()> NewMediaSegmentCB; |
71 | 76 |
72 // A new potentially encrypted stream has been parsed. | 77 // A new potentially encrypted stream has been parsed. |
73 // First parameter - The type of the initialization data associated with the | 78 // First parameter - The type of the initialization data associated with the |
74 // stream. | 79 // stream. |
75 // Second parameter - The initialization data associated with the stream. | 80 // Second parameter - The initialization data associated with the stream. |
76 typedef base::Callback<void(const std::string&, | 81 typedef base::Callback<void(const std::string&, |
77 const std::vector<uint8>&)> NeedKeyCB; | 82 const std::vector<uint8>&)> NeedKeyCB; |
78 | 83 |
79 // Initialize the parser with necessary callbacks. Must be called before any | 84 // Initialize the parser with necessary callbacks. Must be called before any |
80 // data is passed to Parse(). |init_cb| will be called once enough data has | 85 // data is passed to Parse(). |init_cb| will be called once enough data has |
81 // been parsed to determine the initial stream configurations, presentation | 86 // been parsed to determine the initial stream configurations, presentation |
82 // start time, and duration. | 87 // start time, and duration. |
83 virtual void Init(const InitCB& init_cb, | 88 virtual void Init(const InitCB& init_cb, |
84 const NewConfigCB& config_cb, | 89 const NewConfigCB& config_cb, |
85 const NewBuffersCB& new_buffers_cb, | 90 const NewBuffersCB& new_buffers_cb, |
86 const NewTextBuffersCB& text_cb, | 91 const NewTextBuffersCB& text_cb, |
87 const NeedKeyCB& need_key_cb, | 92 const NeedKeyCB& need_key_cb, |
88 const AddTextTrackCB& add_text_track_cb, | 93 bool enable_text_tracks, |
89 const NewMediaSegmentCB& new_segment_cb, | 94 const NewMediaSegmentCB& new_segment_cb, |
90 const base::Closure& end_of_segment_cb, | 95 const base::Closure& end_of_segment_cb, |
91 const LogCB& log_cb) = 0; | 96 const LogCB& log_cb) = 0; |
92 | 97 |
93 // Called when a seek occurs. This flushes the current parser state | 98 // Called when a seek occurs. This flushes the current parser state |
94 // and puts the parser in a state where it can receive data for the new seek | 99 // and puts the parser in a state where it can receive data for the new seek |
95 // point. | 100 // point. |
96 virtual void Flush() = 0; | 101 virtual void Flush() = 0; |
97 | 102 |
98 // Called when there is new data to parse. | 103 // Called when there is new data to parse. |
99 // | 104 // |
100 // Returns true if the parse succeeds. | 105 // Returns true if the parse succeeds. |
101 virtual bool Parse(const uint8* buf, int size) = 0; | 106 virtual bool Parse(const uint8* buf, int size) = 0; |
102 | 107 |
103 private: | 108 private: |
104 DISALLOW_COPY_AND_ASSIGN(StreamParser); | 109 DISALLOW_COPY_AND_ASSIGN(StreamParser); |
105 }; | 110 }; |
106 | 111 |
107 } // namespace media | 112 } // namespace media |
108 | 113 |
109 #endif // MEDIA_BASE_STREAM_PARSER_H_ | 114 #endif // MEDIA_BASE_STREAM_PARSER_H_ |
OLD | NEW |