OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_FORMATS_MP2T_MP2T_STREAM_PARSER_H_ | 5 #ifndef MEDIA_FORMATS_MP2T_MP2T_STREAM_PARSER_H_ |
6 #define MEDIA_FORMATS_MP2T_MP2T_STREAM_PARSER_H_ | 6 #define MEDIA_FORMATS_MP2T_MP2T_STREAM_PARSER_H_ |
7 | 7 |
8 #include <list> | 8 #include <list> |
9 #include <map> | 9 #include <map> |
10 | 10 |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 // Callback invoked by the ES stream parser | 85 // Callback invoked by the ES stream parser |
86 // to emit a new audio/video access unit. | 86 // to emit a new audio/video access unit. |
87 void OnEmitAudioBuffer( | 87 void OnEmitAudioBuffer( |
88 int pes_pid, | 88 int pes_pid, |
89 scoped_refptr<StreamParserBuffer> stream_parser_buffer); | 89 scoped_refptr<StreamParserBuffer> stream_parser_buffer); |
90 void OnEmitVideoBuffer( | 90 void OnEmitVideoBuffer( |
91 int pes_pid, | 91 int pes_pid, |
92 scoped_refptr<StreamParserBuffer> stream_parser_buffer); | 92 scoped_refptr<StreamParserBuffer> stream_parser_buffer); |
93 bool EmitRemainingBuffers(); | 93 bool EmitRemainingBuffers(); |
94 | 94 |
95 // At the beginning of a new segment, some video frames might be discarded. | |
96 // This function fills the hole by duplicating the first valid key frame | |
97 // given by |stream_parser_buffer|. | |
98 void FillVideoGap( | |
99 const scoped_refptr<StreamParserBuffer>& stream_parser_buffer); | |
100 | |
101 // List of callbacks. | 95 // List of callbacks. |
102 InitCB init_cb_; | 96 InitCB init_cb_; |
103 NewConfigCB config_cb_; | 97 NewConfigCB config_cb_; |
104 NewBuffersCB new_buffers_cb_; | 98 NewBuffersCB new_buffers_cb_; |
105 NeedKeyCB need_key_cb_; | 99 NeedKeyCB need_key_cb_; |
106 NewMediaSegmentCB new_segment_cb_; | 100 NewMediaSegmentCB new_segment_cb_; |
107 base::Closure end_of_segment_cb_; | 101 base::Closure end_of_segment_cb_; |
108 LogCB log_cb_; | 102 LogCB log_cb_; |
109 | 103 |
110 // True when AAC SBR extension is signalled in the mimetype | 104 // True when AAC SBR extension is signalled in the mimetype |
111 // (mp4a.40.5 in the codecs parameter). | 105 // (mp4a.40.5 in the codecs parameter). |
112 bool sbr_in_mimetype_; | 106 bool sbr_in_mimetype_; |
113 | 107 |
114 // Bytes of the TS stream. | 108 // Bytes of the TS stream. |
115 ByteQueue ts_byte_queue_; | 109 ByteQueue ts_byte_queue_; |
116 | 110 |
117 // List of PIDs and their state. | 111 // List of PIDs and their state. |
118 PidMap pids_; | 112 PidMap pids_; |
119 | 113 |
120 // Selected audio and video PIDs. | 114 // Selected audio and video PIDs. |
121 int selected_audio_pid_; | 115 int selected_audio_pid_; |
122 int selected_video_pid_; | 116 int selected_video_pid_; |
123 | 117 |
124 // DTS of discarded buffers. | |
125 // Min PTS of discarded buffers. | |
126 std::list<base::TimeDelta> discarded_frames_dts_; | |
127 base::TimeDelta discarded_frames_min_pts_; | |
128 | |
129 // Pending audio & video buffers. | 118 // Pending audio & video buffers. |
130 std::list<BufferQueueWithConfig> buffer_queue_chain_; | 119 std::list<BufferQueueWithConfig> buffer_queue_chain_; |
131 | 120 |
132 // Whether |init_cb_| has been invoked. | 121 // Whether |init_cb_| has been invoked. |
133 bool is_initialized_; | 122 bool is_initialized_; |
134 | 123 |
135 // Indicate whether a segment was started. | 124 // Indicate whether a segment was started. |
136 bool segment_started_; | 125 bool segment_started_; |
137 bool first_video_frame_in_segment_; | |
138 base::TimeDelta time_offset_; | 126 base::TimeDelta time_offset_; |
139 | 127 |
140 DISALLOW_COPY_AND_ASSIGN(Mp2tStreamParser); | 128 DISALLOW_COPY_AND_ASSIGN(Mp2tStreamParser); |
141 }; | 129 }; |
142 | 130 |
143 } // namespace mp2t | 131 } // namespace mp2t |
144 } // namespace media | 132 } // namespace media |
145 | 133 |
146 #endif | 134 #endif |
147 | 135 |
OLD | NEW |