Index: media/formats/mp2t/es_parser.h |
diff --git a/media/formats/mp2t/es_parser.h b/media/formats/mp2t/es_parser.h |
index a1959c20a341ca6c7752c796e62faf561b5bce27..61a67d523046116599b474ec7eb69313023f4721 100644 |
--- a/media/formats/mp2t/es_parser.h |
+++ b/media/formats/mp2t/es_parser.h |
@@ -5,6 +5,8 @@ |
#ifndef MEDIA_FORMATS_MP2T_ES_PARSER_H_ |
#define MEDIA_FORMATS_MP2T_ES_PARSER_H_ |
+#include <list> |
+ |
#include "base/basictypes.h" |
#include "base/callback.h" |
#include "base/memory/ref_counted.h" |
@@ -14,6 +16,7 @@ |
namespace media { |
+class OffsetByteQueue; |
class StreamParserBuffer; |
namespace mp2t { |
@@ -22,20 +25,50 @@ class MEDIA_EXPORT EsParser { |
public: |
typedef base::Callback<void(scoped_refptr<StreamParserBuffer>)> EmitBufferCB; |
- EsParser() {} |
- virtual ~EsParser() {} |
+ EsParser(); |
+ virtual ~EsParser(); |
// ES parsing. |
// Should use kNoTimestamp when a timestamp is not valid. |
- virtual bool Parse(const uint8* buf, int size, |
- base::TimeDelta pts, |
- DecodeTimestamp dts) = 0; |
+ bool Parse(const uint8* buf, int size, |
+ base::TimeDelta pts, |
+ DecodeTimestamp dts); |
// Flush any pending buffer. |
virtual void Flush() = 0; |
// Reset the state of the ES parser. |
- virtual void Reset() = 0; |
+ virtual void Reset(); |
+ |
+ protected: |
+ struct TimingDesc { |
+ TimingDesc(); |
+ TimingDesc(DecodeTimestamp dts, base::TimeDelta pts); |
+ |
+ DecodeTimestamp dts; |
+ base::TimeDelta pts; |
+ }; |
+ |
+ // Parse ES data from |es_queue_|. |
+ // Return true when successful. |
+ virtual bool ParseFromEsQueue() = 0; |
+ |
+ // Get the timing descriptor that applies to position |es_byte_count| inside |
wolenetz
2014/08/26 23:01:44
nit: Can there be a position in |es_queue_| for wh
damienv1
2014/08/27 16:23:43
There is not necessarily a timing descriptor assoc
|
+ // the ES byte queue. This timing descriptor and all the ones that come before |
+ // (in stream order) are removed from list |timing_desc_list_|. |
+ // If no timing descriptor is found, then the default TimingDesc is returned. |
+ TimingDesc GetTimingDescriptor(int64 es_byte_count); |
+ |
+ // Bytes of the ES stream that have not been emitted yet. |
+ scoped_ptr<media::OffsetByteQueue> es_queue_; |
+ |
+ private: |
+ // Anchor some timing information into the ES queue. |
+ // A timing descriptor associated with a given ES position applies to the |
+ // first access unit that comes at or after this ES position in the queue. |
+ std::list<std::pair<int64, TimingDesc> > timing_desc_list_; |
wolenetz
2014/08/26 23:01:44
lint nit: add #include for pair<>
damienv1
2014/08/27 16:23:43
Done.
|
+ |
+ DISALLOW_COPY_AND_ASSIGN(EsParser); |
}; |
} // namespace mp2t |