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_MP4_MP4_STREAM_PARSER_H_ | 5 #ifndef MEDIA_MP4_MP4_STREAM_PARSER_H_ |
6 #define MEDIA_MP4_MP4_STREAM_PARSER_H_ | 6 #define MEDIA_MP4_MP4_STREAM_PARSER_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/callback.h" | 9 #include "base/callback.h" |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 class BoxReader; | 21 class BoxReader; |
22 | 22 |
23 class MEDIA_EXPORT MP4StreamParser : public StreamParser { | 23 class MEDIA_EXPORT MP4StreamParser : public StreamParser { |
24 public: | 24 public: |
25 MP4StreamParser(); | 25 MP4StreamParser(); |
26 virtual ~MP4StreamParser(); | 26 virtual ~MP4StreamParser(); |
27 | 27 |
28 virtual void Init(const InitCB& init_cb, const NewConfigCB& config_cb, | 28 virtual void Init(const InitCB& init_cb, const NewConfigCB& config_cb, |
29 const NewBuffersCB& audio_cb, | 29 const NewBuffersCB& audio_cb, |
30 const NewBuffersCB& video_cb, | 30 const NewBuffersCB& video_cb, |
31 const KeyNeededCB& key_needed_cb, | 31 const NeedKeyCB& need_key_cb, |
32 const NewMediaSegmentCB& new_segment_cb) OVERRIDE; | 32 const NewMediaSegmentCB& new_segment_cb) OVERRIDE; |
33 virtual void Flush() OVERRIDE; | 33 virtual void Flush() OVERRIDE; |
34 virtual bool Parse(const uint8* buf, int size) OVERRIDE; | 34 virtual bool Parse(const uint8* buf, int size) OVERRIDE; |
35 | 35 |
36 private: | 36 private: |
37 enum State { | 37 enum State { |
38 kWaitingForInit, | 38 kWaitingForInit, |
39 kParsingBoxes, | 39 kParsingBoxes, |
40 kEmittingSamples, | 40 kEmittingSamples, |
41 kError | 41 kError |
(...skipping 10 matching lines...) Expand all Loading... |
52 bool EmitConfigs(); | 52 bool EmitConfigs(); |
53 bool EnqueueSample(BufferQueue* audio_buffers, | 53 bool EnqueueSample(BufferQueue* audio_buffers, |
54 BufferQueue* video_buffers, | 54 BufferQueue* video_buffers, |
55 bool* err); | 55 bool* err); |
56 | 56 |
57 State state_; | 57 State state_; |
58 InitCB init_cb_; | 58 InitCB init_cb_; |
59 NewConfigCB config_cb_; | 59 NewConfigCB config_cb_; |
60 NewBuffersCB audio_cb_; | 60 NewBuffersCB audio_cb_; |
61 NewBuffersCB video_cb_; | 61 NewBuffersCB video_cb_; |
62 KeyNeededCB key_needed_cb_; | 62 NeedKeyCB need_key_cb_; |
63 NewMediaSegmentCB new_segment_cb_; | 63 NewMediaSegmentCB new_segment_cb_; |
64 | 64 |
65 OffsetByteQueue queue_; | 65 OffsetByteQueue queue_; |
66 | 66 |
67 // These two parameters are only valid in the |kEmittingSegments| state. | 67 // These two parameters are only valid in the |kEmittingSegments| state. |
68 // | 68 // |
69 // |moof_head_| is the offset of the start of the most recently parsed moof | 69 // |moof_head_| is the offset of the start of the most recently parsed moof |
70 // block. All byte offsets in sample information are relative to this offset, | 70 // block. All byte offsets in sample information are relative to this offset, |
71 // as mandated by the Media Source spec. | 71 // as mandated by the Media Source spec. |
72 int64 moof_head_; | 72 int64 moof_head_; |
(...skipping 15 matching lines...) Expand all Loading... |
88 // every frame. | 88 // every frame. |
89 uint8 size_of_nalu_length_; | 89 uint8 size_of_nalu_length_; |
90 | 90 |
91 DISALLOW_COPY_AND_ASSIGN(MP4StreamParser); | 91 DISALLOW_COPY_AND_ASSIGN(MP4StreamParser); |
92 }; | 92 }; |
93 | 93 |
94 } // namespace mp4 | 94 } // namespace mp4 |
95 } // namespace media | 95 } // namespace media |
96 | 96 |
97 #endif // MEDIA_MP4_MP4_STREAM_PARSER_H_ | 97 #endif // MEDIA_MP4_MP4_STREAM_PARSER_H_ |
OLD | NEW |