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 <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <list> | 10 #include <list> |
(...skipping 28 matching lines...) Expand all Loading... |
39 const NewBuffersCB& new_buffers_cb, | 39 const NewBuffersCB& new_buffers_cb, |
40 bool ignore_text_tracks, | 40 bool ignore_text_tracks, |
41 const EncryptedMediaInitDataCB& encrypted_media_init_data_cb, | 41 const EncryptedMediaInitDataCB& encrypted_media_init_data_cb, |
42 const NewMediaSegmentCB& new_segment_cb, | 42 const NewMediaSegmentCB& new_segment_cb, |
43 const EndMediaSegmentCB& end_of_segment_cb, | 43 const EndMediaSegmentCB& end_of_segment_cb, |
44 const scoped_refptr<MediaLog>& media_log) override; | 44 const scoped_refptr<MediaLog>& media_log) override; |
45 void Flush() override; | 45 void Flush() override; |
46 bool Parse(const uint8_t* buf, int size) override; | 46 bool Parse(const uint8_t* buf, int size) override; |
47 | 47 |
48 private: | 48 private: |
49 typedef std::map<int, PidState*> PidMap; | |
50 | |
51 struct BufferQueueWithConfig { | 49 struct BufferQueueWithConfig { |
52 BufferQueueWithConfig(bool is_cfg_sent, | 50 BufferQueueWithConfig(bool is_cfg_sent, |
53 const AudioDecoderConfig& audio_cfg, | 51 const AudioDecoderConfig& audio_cfg, |
54 const VideoDecoderConfig& video_cfg); | 52 const VideoDecoderConfig& video_cfg); |
55 BufferQueueWithConfig(const BufferQueueWithConfig& other); | 53 BufferQueueWithConfig(const BufferQueueWithConfig& other); |
56 ~BufferQueueWithConfig(); | 54 ~BufferQueueWithConfig(); |
57 | 55 |
58 bool is_config_sent; | 56 bool is_config_sent; |
59 AudioDecoderConfig audio_config; | 57 AudioDecoderConfig audio_config; |
60 StreamParser::BufferQueue audio_queue; | 58 StreamParser::BufferQueue audio_queue; |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 scoped_refptr<MediaLog> media_log_; | 105 scoped_refptr<MediaLog> media_log_; |
108 | 106 |
109 // True when AAC SBR extension is signalled in the mimetype | 107 // True when AAC SBR extension is signalled in the mimetype |
110 // (mp4a.40.5 in the codecs parameter). | 108 // (mp4a.40.5 in the codecs parameter). |
111 bool sbr_in_mimetype_; | 109 bool sbr_in_mimetype_; |
112 | 110 |
113 // Bytes of the TS stream. | 111 // Bytes of the TS stream. |
114 ByteQueue ts_byte_queue_; | 112 ByteQueue ts_byte_queue_; |
115 | 113 |
116 // List of PIDs and their state. | 114 // List of PIDs and their state. |
117 PidMap pids_; | 115 std::map<int, std::unique_ptr<PidState>> pids_; |
118 | 116 |
119 // Selected audio and video PIDs. | 117 // Selected audio and video PIDs. |
120 int selected_audio_pid_; | 118 int selected_audio_pid_; |
121 int selected_video_pid_; | 119 int selected_video_pid_; |
122 | 120 |
123 // Pending audio & video buffers. | 121 // Pending audio & video buffers. |
124 std::list<BufferQueueWithConfig> buffer_queue_chain_; | 122 std::list<BufferQueueWithConfig> buffer_queue_chain_; |
125 | 123 |
126 // Whether |init_cb_| has been invoked. | 124 // Whether |init_cb_| has been invoked. |
127 bool is_initialized_; | 125 bool is_initialized_; |
128 | 126 |
129 // Indicate whether a segment was started. | 127 // Indicate whether a segment was started. |
130 bool segment_started_; | 128 bool segment_started_; |
131 | 129 |
132 // Timestamp unroller. | 130 // Timestamp unroller. |
133 // Timestamps in PES packets must be unrolled using the same offset. | 131 // Timestamps in PES packets must be unrolled using the same offset. |
134 // So the unroller is global between PES pids. | 132 // So the unroller is global between PES pids. |
135 TimestampUnroller timestamp_unroller_; | 133 TimestampUnroller timestamp_unroller_; |
136 | 134 |
137 DISALLOW_COPY_AND_ASSIGN(Mp2tStreamParser); | 135 DISALLOW_COPY_AND_ASSIGN(Mp2tStreamParser); |
138 }; | 136 }; |
139 | 137 |
140 } // namespace mp2t | 138 } // namespace mp2t |
141 } // namespace media | 139 } // namespace media |
142 | 140 |
143 #endif // MEDIA_FORMATS_MP2T_MP2T_STREAM_PARSER_H_ | 141 #endif // MEDIA_FORMATS_MP2T_MP2T_STREAM_PARSER_H_ |
OLD | NEW |