Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1177)

Side by Side Diff: media/mpeg2/mpeg2ts_pes.h

Issue 23566013: Mpeg2 TS stream parser for media source. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add basic unit tests + Cleanup Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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>
9
10 #include "base/basictypes.h"
11 #include "base/callback.h"
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(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
32 private:
33 // Emit a reassembled PES packet.
34 // Return true if successful.
35 // |emit_for_unknown_size| is used to force emission for PES packets
36 // whose size is unknown.
37 bool Emit(bool emit_for_unknown_size);
38
39 // Parse a PES packet, return true if successful.
40 bool ParseInternal(const uint8* raw_pes, int raw_pes_size);
41
42 void ResetState();
43
44 // Bytes of the current PES.
45 ByteQueue pes_byte_queue_;
46
47 // ES parser.
48 scoped_ptr<EsParser> es_parser_;
49
50 // Do not start parsing before getting a unit start indicator.
51 bool wait_for_pusi_;
52
53 // Used to unroll PTS and DTS.
54 bool previous_pts_valid_;
55 int64 previous_pts_;
56 bool previous_dts_valid_;
57 int64 previous_dts_;
58
59 DISALLOW_COPY_AND_ASSIGN(Mpeg2TsPesParser);
60 };
61
62 } // namespace mpeg2ts
63 } // namespace media
64
65 #endif
66
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698