OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef MEDIA_MPEG2_MPEG2TS_PES_PARSER_H_ | |
6 #define MEDIA_MPEG2_MPEG2TS_PES_PARSER_H_ | |
7 | |
8 #include <vector> | |
damienv1
2013/09/10 04:57:01
Not needed anymore.
damienv1
2013/09/10 21:03:48
Done.
| |
9 | |
10 #include "base/basictypes.h" | |
11 #include "base/callback.h" | |
damienv1
2013/09/10 04:57:01
callback.h not needed.
damienv1
2013/09/10 21:03:48
Done.
| |
12 #include "base/compiler_specific.h" | |
13 #include "base/memory/scoped_ptr.h" | |
14 #include "media/base/byte_queue.h" | |
15 #include "media/mpeg2/mpeg2ts_section_parser.h" | |
16 | |
17 namespace media { | |
18 namespace mpeg2ts { | |
19 | |
20 class EsParser; | |
21 | |
22 class Mpeg2TsPesParser : public Mpeg2TsSectionParser { | |
23 public: | |
24 explicit Mpeg2TsPesParser(scoped_ptr<EsParser> es_parser); | |
25 virtual ~Mpeg2TsPesParser(); | |
26 | |
27 // Mpeg2TsSectionParser implementation. | |
28 virtual bool Parse(bool payload_unit_start_indicator, | |
29 const uint8* buf, int size) OVERRIDE; | |
30 virtual void Flush() OVERRIDE; | |
31 virtual void Reset() OVERRIDE; | |
32 | |
33 private: | |
34 // Emit a reassembled PES packet. | |
35 // Return true if successful. | |
36 // |emit_for_unknown_size| is used to force emission for PES packets | |
37 // whose size is unknown. | |
38 bool Emit(bool emit_for_unknown_size); | |
39 | |
40 // Parse a PES packet, return true if successful. | |
41 bool ParseInternal(const uint8* raw_pes, int raw_pes_size); | |
42 | |
43 void ResetPesState(); | |
44 | |
45 // Bytes of the current PES. | |
46 ByteQueue pes_byte_queue_; | |
47 | |
48 // ES parser. | |
49 scoped_ptr<EsParser> es_parser_; | |
50 | |
51 // Do not start parsing before getting a unit start indicator. | |
52 bool wait_for_pusi_; | |
53 | |
54 // Used to unroll PTS and DTS. | |
55 bool previous_pts_valid_; | |
56 int64 previous_pts_; | |
57 bool previous_dts_valid_; | |
58 int64 previous_dts_; | |
59 | |
60 DISALLOW_COPY_AND_ASSIGN(Mpeg2TsPesParser); | |
61 }; | |
62 | |
63 } // namespace mpeg2ts | |
64 } // namespace media | |
65 | |
66 #endif | |
67 | |
OLD | NEW |