| 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 | 10 |
| 10 #include "base/callback_forward.h" | 11 #include "base/callback_forward.h" |
| 11 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
| 12 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
| 13 #include "base/time.h" | 14 #include "base/time.h" |
| 14 #include "media/base/media_export.h" | 15 #include "media/base/media_export.h" |
| 15 | 16 |
| 16 namespace media { | 17 namespace media { |
| 17 | 18 |
| 18 class AudioDecoderConfig; | 19 class AudioDecoderConfig; |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 // Return value - True indicates that the buffers are accepted. | 52 // Return value - True indicates that the buffers are accepted. |
| 52 // False if something was wrong with the buffers and a parsing | 53 // False if something was wrong with the buffers and a parsing |
| 53 // error should be signalled. | 54 // error should be signalled. |
| 54 typedef base::Callback<bool(const BufferQueue&)> NewBuffersCB; | 55 typedef base::Callback<bool(const BufferQueue&)> NewBuffersCB; |
| 55 | 56 |
| 56 // Signals the beginning of a new media segment. | 57 // Signals the beginning of a new media segment. |
| 57 // First parameter - The earliest timestamp of all the streams in the segment. | 58 // First parameter - The earliest timestamp of all the streams in the segment. |
| 58 typedef base::Callback<void(base::TimeDelta)> NewMediaSegmentCB; | 59 typedef base::Callback<void(base::TimeDelta)> NewMediaSegmentCB; |
| 59 | 60 |
| 60 // A new potentially encrypted stream has been parsed. | 61 // A new potentially encrypted stream has been parsed. |
| 61 // First parameter - The initialization data associated with the stream. | 62 // First parameter - The type of the initialization data associated with the |
| 62 // Second parameter - Number of bytes of the initialization data. | 63 // stream. |
| 64 // Second parameter - The initialization data associated with the stream. |
| 65 // Third parameter - Number of bytes of the initialization data. |
| 63 // Return value - True indicates that the initialization data is accepted. | 66 // Return value - True indicates that the initialization data is accepted. |
| 64 // False if something was wrong with the initialization data | 67 // False if something was wrong with the initialization data |
| 65 // and a parsing error should be signalled. | 68 // and a parsing error should be signalled. |
| 66 typedef base::Callback<bool(scoped_array<uint8>, int)> NeedKeyCB; | 69 typedef base::Callback<bool(const std::string&, |
| 70 scoped_array<uint8>, int)> NeedKeyCB; |
| 67 | 71 |
| 68 // Initialize the parser with necessary callbacks. Must be called before any | 72 // 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 | 73 // data is passed to Parse(). |init_cb| will be called once enough data has |
| 70 // been parsed to determine the initial stream configurations, presentation | 74 // been parsed to determine the initial stream configurations, presentation |
| 71 // start time, and duration. | 75 // start time, and duration. |
| 72 virtual void Init(const InitCB& init_cb, | 76 virtual void Init(const InitCB& init_cb, |
| 73 const NewConfigCB& config_cb, | 77 const NewConfigCB& config_cb, |
| 74 const NewBuffersCB& audio_cb, | 78 const NewBuffersCB& audio_cb, |
| 75 const NewBuffersCB& video_cb, | 79 const NewBuffersCB& video_cb, |
| 76 const NeedKeyCB& need_key_cb, | 80 const NeedKeyCB& need_key_cb, |
| (...skipping 10 matching lines...) Expand all Loading... |
| 87 // Returns true if the parse succeeds. | 91 // Returns true if the parse succeeds. |
| 88 virtual bool Parse(const uint8* buf, int size) = 0; | 92 virtual bool Parse(const uint8* buf, int size) = 0; |
| 89 | 93 |
| 90 private: | 94 private: |
| 91 DISALLOW_COPY_AND_ASSIGN(StreamParser); | 95 DISALLOW_COPY_AND_ASSIGN(StreamParser); |
| 92 }; | 96 }; |
| 93 | 97 |
| 94 } // namespace media | 98 } // namespace media |
| 95 | 99 |
| 96 #endif // MEDIA_BASE_STREAM_PARSER_H_ | 100 #endif // MEDIA_BASE_STREAM_PARSER_H_ |
| OLD | NEW |