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

Unified Diff: services/media/framework/parts/reader.h

Issue 1577953002: Motown in-proc streaming framework used to implement media services. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Sync, updates based on feedback, some functions declared const. Created 4 years, 11 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: services/media/framework/parts/reader.h
diff --git a/services/media/framework/parts/reader.h b/services/media/framework/parts/reader.h
new file mode 100644
index 0000000000000000000000000000000000000000..991a6c700ef875c631683325c5bfad8ef8fe3d7b
--- /dev/null
+++ b/services/media/framework/parts/reader.h
@@ -0,0 +1,53 @@
+// Copyright 2016 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 SERVICES_MEDIA_FRAMEWORK_PARTS_READER_H_
+#define SERVICES_MEDIA_FRAMEWORK_PARTS_READER_H_
+
+#include <memory>
+
+#include "services/media/framework/result.h"
+#include "url/gurl.h"
+
+namespace mojo {
+namespace media {
+
+class Reader;
+
+typedef std::shared_ptr<Reader> ReaderPtr;
+
+// Abstract base class for objects that read raw data on behalf of demuxes.
+// This model is synchronous, because that's how ffmpeg works.
jeffbrown 2016/02/02 05:35:48 Is ffmpeg going to be the only client of this inte
dalesat 2016/02/02 21:46:40 I agree. There are comments to this effect elsewhe
+class Reader {
+ public:
+ // Creates a Reader object for a given url.
+ static Result Create(const GURL& gurl, ReaderPtr* reader_out);
+
+ virtual ~Reader() {}
+
+ // Initializes the reader.
+ virtual Result Init(const GURL& gurl) = 0;
+
+ // Reads the given number of bytes into the buffer and returns the number of
+ // bytes read. Returns -1 if the operation fails.
+ virtual int Read(uint8* buffer, int bytes_to_read) = 0;
jeffbrown 2016/02/02 05:35:48 Use size_t or ssize_t for buffer sizes, etc.
dalesat 2016/02/02 21:46:40 Done in another CL.
+
+ // Gets the current position or -1 if the operation fails.
+ virtual int64 GetPosition() const = 0;
jeffbrown 2016/02/02 05:35:48 Don't you mean int64_t?
dalesat 2016/02/02 21:46:40 Yes. Done.
+
+ // Seeks to the given position and returns it. Returns -1 if the operation
+ // fails.
+ virtual int64 SetPosition(int64 position) = 0;
+
+ // Returns the file size. Returns -1 if the operation fails.
+ virtual int64 GetSize() const = 0;
jeffbrown 2016/02/02 05:35:48 What if the size isn't known?
dalesat 2016/02/02 21:46:40 Added to comment.
+
+ // Returns true if this object supports seeking, false otherwise.
+ virtual bool CanSeek() const = 0;
+};
+
+} // namespace media
+} // namespace mojo
+
+#endif // MOJO_SERVICES_MEDIA_READER_H_

Powered by Google App Engine
This is Rietveld 408576698