| OLD | NEW |
| (Empty) |
| 1 // Copyright 2014 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_BASE_DEMUXER_STREAM_PROVIDER_H_ | |
| 6 #define MEDIA_BASE_DEMUXER_STREAM_PROVIDER_H_ | |
| 7 | |
| 8 #include "base/macros.h" | |
| 9 #include "media/base/demuxer_stream.h" | |
| 10 #include "media/base/media_export.h" | |
| 11 #include "media/base/media_url_params.h" | |
| 12 #include "url/gurl.h" | |
| 13 | |
| 14 namespace media { | |
| 15 | |
| 16 // Abstract class that defines how to retrieve "media sources" in DemuxerStream | |
| 17 // form (for most cases) or URL form (for the MediaPlayerRenderer case). | |
| 18 // | |
| 19 // The sub-classes do not stricly provide demuxer streams, but because all | |
| 20 // sub-classes are for the moment Demuxers, this class has not been renamed to | |
| 21 // "MediaProvider". This class would be a good candidate for renaming, if | |
| 22 // ever Pipeline were to support this class directly, instead of the Demuxer | |
| 23 // interface. | |
| 24 // TODO(tguilbert): Rename this class. See crbug.com/658062. | |
| 25 // | |
| 26 // The derived classes must return a non-null value for the getter method | |
| 27 // associated with their type, and return a null/empty value for other getters. | |
| 28 class MEDIA_EXPORT DemuxerStreamProvider { | |
| 29 public: | |
| 30 enum Type { | |
| 31 STREAM, // Indicates GetStream() should be used | |
| 32 URL, // Indicates GetUrl() should be used | |
| 33 }; | |
| 34 | |
| 35 DemuxerStreamProvider(); | |
| 36 virtual ~DemuxerStreamProvider(); | |
| 37 | |
| 38 // For Type::STREAM: | |
| 39 // Returns the first stream of the given stream type (which is not allowed | |
| 40 // to be DemuxerStream::TEXT), or NULL if that type of stream is not | |
| 41 // present. | |
| 42 // NOTE: Once a DemuxerStream pointer is returned from GetStream it is | |
| 43 // guaranteed to stay valid for as long as the Demuxer/DemuxerStreamProvider | |
| 44 // is alive. But make no assumption that once GetStream returned a non-null | |
| 45 // pointer for some stream type then all subsequent calls will also return | |
| 46 // non-null pointer for the same stream type. In MSE Javascript code can | |
| 47 // remove SourceBuffer from a MediaSource at any point and this will make | |
| 48 // some previously existing streams inaccessible/unavailable. | |
| 49 // Other types: | |
| 50 // Should not be called. | |
| 51 virtual DemuxerStream* GetStream(DemuxerStream::Type type) = 0; | |
| 52 | |
| 53 // For Type::URL: | |
| 54 // Returns the URL parameters of the media to play. Empty URLs are legal, | |
| 55 // and should be handled appropriately by the caller. | |
| 56 // Other types: | |
| 57 // Should not be called. | |
| 58 virtual MediaUrlParams GetMediaUrlParams() const; | |
| 59 | |
| 60 virtual DemuxerStreamProvider::Type GetType() const; | |
| 61 | |
| 62 private: | |
| 63 DISALLOW_COPY_AND_ASSIGN(DemuxerStreamProvider); | |
| 64 }; | |
| 65 | |
| 66 } // namespace media | |
| 67 | |
| 68 #endif // MEDIA_BASE_DEMUXER_STREAM_PROVIDER_H_ | |
| OLD | NEW |