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

Unified Diff: media/filters/chunk_demuxer_factory.h

Issue 7203002: Adding ChunkDemuxer implementation. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Unit tests and bug fixes Created 9 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: media/filters/chunk_demuxer_factory.h
diff --git a/media/filters/chunk_demuxer_factory.h b/media/filters/chunk_demuxer_factory.h
new file mode 100644
index 0000000000000000000000000000000000000000..df6f7420e2cdf00ccca2852a7fbb2daa9c00a862
--- /dev/null
+++ b/media/filters/chunk_demuxer_factory.h
@@ -0,0 +1,71 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef MEDIA_FILTERS_CHUNK_DEMUXER_FACTORY_H_
+#define MEDIA_FILTERS_CHUNK_DEMUXER_FACTORY_H_
+
+#include "base/scoped_ptr.h"
+#include "media/base/filter_factories.h"
+
+namespace media {
+
+class ChunkDemuxer;
+
+// Class used by an external object to send media data to the
+// Demuxer. This object is created by the DemuxerFactory and
+// contains the Demuxer that will be returned in the next Build()
+// call on the factory. The external object tells the factory
+// to create one of these objects before it starts the Pipeline.
+// It does this because the external object may need to make AddData()
+// calls before the pipeline has completely initialized. This class
+// allows data from these calls to be queued until initialization
+// completes. It represents the minimal operations needed by
+// the external object to talk to the Demuxer. It also allows
+// the external object to have a longer lifetime than the pipeline.
+class MediaDataSink {
+ public:
+ MediaDataSink(const scoped_refptr<ChunkDemuxer>& demuxer);
+ ~MediaDataSink();
+
+ // Flush all data passed via AddData().
+ void Flush();
+
+ // Sends media data to the demuxer. Returns true if the data is valid.
+ bool AddData(const uint8* data, unsigned length);
+
+ // Signals that playback is shutting down and further AddData() calls
+ // should fail. This also cancels pending Read()s on DemuxerStreams.
+ void Shutdown();
+
+ private:
+ scoped_refptr<ChunkDemuxer> demuxer_;
+ DISALLOW_IMPLICIT_CONSTRUCTORS(MediaDataSink);
+};
+
+class ChunkDemuxerFactory : public DemuxerFactory {
+ public:
+ // Takes a reference to |demuxer_factory|.
+ ChunkDemuxerFactory(DataSourceFactory* data_source_factory);
+ virtual ~ChunkDemuxerFactory();
+
+ bool IsUrlSupported(const std::string& url) const;
+ MediaDataSink* CreateMediaDataSink();
+
+ // DemuxerFactory methods.
+ virtual void Build(const std::string& url, BuildCallback* cb);
+ virtual DemuxerFactory* Clone() const;
+
+ private:
+ static const char kURLPrefix[];
+ class BuildState;
+
+ scoped_ptr<DataSourceFactory> data_source_factory_;
+ scoped_refptr<ChunkDemuxer> demuxer_;
+
+ DISALLOW_IMPLICIT_CONSTRUCTORS(ChunkDemuxerFactory);
+};
+
+} // namespace media
+
+#endif // MEDIA_FILTERS_CHUNK_DEMUXER_FACTORY_H_

Powered by Google App Engine
This is Rietveld 408576698