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