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 | 9 |
10 #include "base/callback_forward.h" | 10 #include "base/callback_forward.h" |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 // Signals the beginning of a new media segment. | 56 // Signals the beginning of a new media segment. |
57 // First parameter - The earliest timestamp of all the streams in the segment. | 57 // First parameter - The earliest timestamp of all the streams in the segment. |
58 typedef base::Callback<void(base::TimeDelta)> NewMediaSegmentCB; | 58 typedef base::Callback<void(base::TimeDelta)> NewMediaSegmentCB; |
59 | 59 |
60 // A new potentially encrypted stream has been parsed. | 60 // A new potentially encrypted stream has been parsed. |
61 // First parameter - The initialization data associated with the stream. | 61 // First parameter - The initialization data associated with the stream. |
62 // Second parameter - Number of bytes of the initialization data. | 62 // Second parameter - Number of bytes of the initialization data. |
63 // Return value - True indicates that the initialization data is accepted. | 63 // Return value - True indicates that the initialization data is accepted. |
64 // False if something was wrong with the initialization data | 64 // False if something was wrong with the initialization data |
65 // and a parsing error should be signalled. | 65 // and a parsing error should be signalled. |
66 typedef base::Callback<bool(scoped_array<uint8>, int)> KeyNeededCB; | 66 typedef base::Callback<bool(scoped_array<uint8>, int)> NeedKeyCB; |
67 | 67 |
68 // Initialize the parser with necessary callbacks. Must be called before any | 68 // Initialize the parser with necessary callbacks. Must be called before any |
69 // data is passed to Parse(). |init_cb| will be called once enough data has | 69 // data is passed to Parse(). |init_cb| will be called once enough data has |
70 // been parsed to determine the initial stream configurations, presentation | 70 // been parsed to determine the initial stream configurations, presentation |
71 // start time, and duration. | 71 // start time, and duration. |
72 virtual void Init(const InitCB& init_cb, | 72 virtual void Init(const InitCB& init_cb, |
73 const NewConfigCB& config_cb, | 73 const NewConfigCB& config_cb, |
74 const NewBuffersCB& audio_cb, | 74 const NewBuffersCB& audio_cb, |
75 const NewBuffersCB& video_cb, | 75 const NewBuffersCB& video_cb, |
76 const KeyNeededCB& key_needed_cb, | 76 const NeedKeyCB& need_key_cb, |
77 const NewMediaSegmentCB& new_segment_cb) = 0; | 77 const NewMediaSegmentCB& new_segment_cb) = 0; |
78 | 78 |
79 // Called when a seek occurs. This flushes the current parser state | 79 // Called when a seek occurs. This flushes the current parser state |
80 // and puts the parser in a state where it can receive data for the new seek | 80 // and puts the parser in a state where it can receive data for the new seek |
81 // point. | 81 // point. |
82 virtual void Flush() = 0; | 82 virtual void Flush() = 0; |
83 | 83 |
84 // Called when there is new data to parse. | 84 // Called when there is new data to parse. |
85 // | 85 // |
86 // Returns true if the parse succeeds. | 86 // Returns true if the parse succeeds. |
87 virtual bool Parse(const uint8* buf, int size) = 0; | 87 virtual bool Parse(const uint8* buf, int size) = 0; |
88 | 88 |
89 private: | 89 private: |
90 DISALLOW_COPY_AND_ASSIGN(StreamParser); | 90 DISALLOW_COPY_AND_ASSIGN(StreamParser); |
91 }; | 91 }; |
92 | 92 |
93 } // namespace media | 93 } // namespace media |
94 | 94 |
95 #endif // MEDIA_BASE_STREAM_PARSER_H_ | 95 #endif // MEDIA_BASE_STREAM_PARSER_H_ |
OLD | NEW |