| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef MEDIA_BASE_DEMUXER_STREAM_PROVIDER_H_ | 5 #ifndef MEDIA_BASE_MEDIA_RESOURCE_H_ |
| 6 #define MEDIA_BASE_DEMUXER_STREAM_PROVIDER_H_ | 6 #define MEDIA_BASE_MEDIA_RESOURCE_H_ |
| 7 |
| 8 #include <vector> |
| 7 | 9 |
| 8 #include "base/macros.h" | 10 #include "base/macros.h" |
| 9 #include "media/base/demuxer_stream.h" | 11 #include "media/base/demuxer_stream.h" |
| 10 #include "media/base/media_export.h" | 12 #include "media/base/media_export.h" |
| 11 #include "media/base/media_url_params.h" | 13 #include "media/base/media_url_params.h" |
| 12 #include "url/gurl.h" | 14 #include "url/gurl.h" |
| 13 | 15 |
| 14 namespace media { | 16 namespace media { |
| 15 | 17 |
| 16 // Abstract class that defines how to retrieve "media sources" in DemuxerStream | 18 // Abstract class that defines how to retrieve "media sources" in DemuxerStream |
| 17 // form (for most cases) or URL form (for the MediaPlayerRenderer case). | 19 // form (for most cases) or URL form (for the MediaPlayerRenderer case). |
| 18 // | 20 // |
| 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 | 21 // 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. | 22 // associated with their type, and return a null/empty value for other getters. |
| 28 class MEDIA_EXPORT DemuxerStreamProvider { | 23 class MEDIA_EXPORT MediaResource { |
| 29 public: | 24 public: |
| 30 enum Type { | 25 enum Type { |
| 31 STREAM, // Indicates GetStream() should be used | 26 STREAM, // Indicates GetStream() should be used |
| 32 URL, // Indicates GetUrl() should be used | 27 URL, // Indicates GetUrl() should be used |
| 33 }; | 28 }; |
| 34 | 29 |
| 35 DemuxerStreamProvider(); | 30 MediaResource(); |
| 36 virtual ~DemuxerStreamProvider(); | 31 virtual ~MediaResource(); |
| 37 | 32 |
| 38 // For Type::STREAM: | 33 // Returns a collection of available DemuxerStream objects. Note that some of |
| 39 // Returns the first stream of the given stream type (which is not allowed | 34 // those streams might be in disabled state (check DemuxerStream::enabled() ). |
| 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 | 35 // NOTE: Once a DemuxerStream pointer is returned from GetStream it is |
| 43 // guaranteed to stay valid for as long as the Demuxer/DemuxerStreamProvider | 36 // guaranteed to stay valid for as long as the Demuxer/MediaResource |
| 44 // is alive. But make no assumption that once GetStream returned a non-null | 37 // 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 | 38 // 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 | 39 // 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 | 40 // remove SourceBuffer from a MediaSource at any point and this will make |
| 48 // some previously existing streams inaccessible/unavailable. | 41 // some previously existing streams inaccessible/unavailable. |
| 49 // Other types: | 42 virtual std::vector<DemuxerStream*> GetStreams() = 0; |
| 50 // Should not be called. | |
| 51 virtual DemuxerStream* GetStream(DemuxerStream::Type type) = 0; | |
| 52 | 43 |
| 53 // For Type::URL: | 44 // For Type::URL: |
| 54 // Returns the URL parameters of the media to play. Empty URLs are legal, | 45 // Returns the URL parameters of the media to play. Empty URLs are legal, |
| 55 // and should be handled appropriately by the caller. | 46 // and should be handled appropriately by the caller. |
| 56 // Other types: | 47 // Other types: |
| 57 // Should not be called. | 48 // Should not be called. |
| 58 virtual MediaUrlParams GetMediaUrlParams() const; | 49 virtual MediaUrlParams GetMediaUrlParams() const; |
| 59 | 50 |
| 60 virtual DemuxerStreamProvider::Type GetType() const; | 51 virtual MediaResource::Type GetType() const; |
| 61 | 52 |
| 62 private: | 53 private: |
| 63 DISALLOW_COPY_AND_ASSIGN(DemuxerStreamProvider); | 54 DISALLOW_COPY_AND_ASSIGN(MediaResource); |
| 64 }; | 55 }; |
| 65 | 56 |
| 66 } // namespace media | 57 } // namespace media |
| 67 | 58 |
| 68 #endif // MEDIA_BASE_DEMUXER_STREAM_PROVIDER_H_ | 59 #endif // MEDIA_BASE_MEDIA_RESOURCE_H_ |
| OLD | NEW |