OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 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 #include "base/logging.h" |
| 6 #include "services/media/framework/parts/file_reader.h" |
| 7 #include "services/media/framework/parts/reader.h" |
| 8 #include "url/gurl.h" |
| 9 |
| 10 namespace mojo { |
| 11 namespace media { |
| 12 |
| 13 Result Reader::Create(const GURL& gurl, ReaderPtr* reader_out) { |
| 14 if (!gurl.is_valid()) { |
| 15 return Result::kInvalidArgument; |
| 16 } |
| 17 |
| 18 ReaderPtr reader = nullptr; |
| 19 if (gurl.SchemeIsFile()) { |
| 20 reader = FileReader::Create(); |
| 21 } |
| 22 // TODO(dalesat): More schemes. |
| 23 |
| 24 if (reader == nullptr) { |
| 25 return Result::kUnsupportedOperation; |
| 26 } |
| 27 |
| 28 Result result = reader->Init(gurl); |
| 29 if (result == Result::kOk) { |
| 30 *reader_out = reader; |
| 31 } |
| 32 |
| 33 return result; |
| 34 } |
| 35 |
| 36 } // namespace media |
| 37 } // namespace mojo |
OLD | NEW |