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

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

Issue 23566013: Mpeg2 TS stream parser for media source. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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_ES_PARSER_ADTS_H_
6 #define MEDIA_MPEG2_ES_PARSER_ADTS_H_
7
8 #include <list>
9 #include <vector>
acolwell GONE FROM CHROMIUM 2013/09/05 18:29:10 Add #include <utility> for std::pair
damienv1 2013/09/09 23:29:45 Done.
10
11 #include "base/basictypes.h"
12 #include "base/callback.h"
13 #include "base/compiler_specific.h"
14 #include "base/memory/ref_counted.h"
15 #include "base/time/time.h"
16 #include "media/base/byte_queue.h"
17 #include "media/mpeg2/es_parser.h"
18
19 namespace media {
20 class BitReader;
21 class AudioDecoderConfig;
22 class StreamParserBuffer;
23 }
24
25 namespace media {
26 namespace mpeg2ts {
27
28 class EsParserAdts : public EsParser {
29 public:
30 typedef base::Callback<void(const AudioDecoderConfig&)> NewAudioConfigCB;
31 typedef base::Callback<void(scoped_refptr<StreamParserBuffer>)> EmitBufferCB;
32
33 EsParserAdts(NewAudioConfigCB new_audio_config_cb,
34 EmitBufferCB emit_buffer_cb);
35 virtual ~EsParserAdts();
36
37 // EsParser implementation.
38 virtual void Parse(const uint8* buf, int size,
39 base::TimeDelta pts,
40 base::TimeDelta dts) OVERRIDE;
41 virtual void Flush() OVERRIDE;
42
43 private:
44 // Used to link a PTS with a byte position in the ES stream.
45 typedef std::pair<int, base::TimeDelta> EsPts;
46 typedef std::list<EsPts> EsPtsList;
47
48 // Signal any audio configuration change (if any).
49 void UpdateAudioConfiguration(const uint8* adts_header);
50
51 // Discard some bytes from the ES stream.
52 void DiscardEs(int nbytes);
53
54 // Callbacks:
55 // - to signal a new audio configuration,
56 // - to send ES buffers.
57 NewAudioConfigCB new_audio_config_cb_;
58 EmitBufferCB emit_buffer_cb_;
59
60 // Bytes of the ES stream that have not been emitted yet.
61 ByteQueue es_byte_queue_;
62
63 // List of PTS associated with a position in the ES stream.
64 EsPtsList pts_list_;
65
66 // Interpolated PTS for frames that don't have one.
67 base::TimeDelta estimated_pts_;
68
69 bool first_frame_;
70 base::TimeDelta last_frame_pts_;
71
72 // Last audio config.
73 bool is_audio_config_known_;
74 int sampling_frequency_;
75 int channel_configuration_;
76
77 DISALLOW_COPY_AND_ASSIGN(EsParserAdts);
78 };
79
80 } // namespace mpeg2ts
81 } // namespace media
82
83 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698