Chromium Code Reviews| 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 | 7 |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "media/base/demuxer_stream.h" | 9 #include "media/base/demuxer_stream.h" |
| 10 #include "media/base/media_export.h" | 10 #include "media/base/media_export.h" |
| 11 #include "media/base/media_url_params.h" | 11 #include "media/base/media_url_params.h" |
| 12 #include "url/gurl.h" | 12 #include "url/gurl.h" |
| 13 | 13 |
| 14 namespace media { | 14 namespace media { |
| 15 | 15 |
| 16 // Abstract class that defines how to retrieve "media sources" in DemuxerStream | 16 // Abstract class that defines how to retrieve "media resources" in |
| 17 // form (for most cases) or URL form (for the MediaPlayerRenderer case). | 17 // DemuxerStream form (for most cases) or URL form (for the MediaPlayerRenderer |
| 18 // | 18 // case). |
| 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 // | 19 // |
| 26 // The derived classes must return a non-null value for the getter method | 20 // 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. | 21 // associated with their type, and return a null/empty value for other getters. |
| 28 class MEDIA_EXPORT DemuxerStreamProvider { | 22 class MEDIA_EXPORT MediaResource { |
| 29 public: | 23 public: |
| 30 enum Type { | 24 enum Type { |
| 31 STREAM, // Indicates GetStream() should be used | 25 STREAM, // Indicates GetStreams() should be used |
|
xhwang
2017/02/02 03:35:35
nit: GetStream(), but this will change soon so fee
| |
| 32 URL, // Indicates GetUrl() should be used | 26 URL, // Indicates GetUrl() should be used |
| 33 }; | 27 }; |
| 34 | 28 |
| 35 DemuxerStreamProvider(); | 29 MediaResource(); |
| 36 virtual ~DemuxerStreamProvider(); | 30 virtual ~MediaResource(); |
| 37 | 31 |
| 38 // For Type::STREAM: | 32 // For Type::STREAM: |
| 39 // Returns the first stream of the given stream type (which is not allowed | 33 // 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 | 34 // to be DemuxerStream::TEXT), or NULL if that type of stream is not |
| 41 // present. | 35 // present. |
| 42 // NOTE: Once a DemuxerStream pointer is returned from GetStream it is | 36 // NOTE: Once a DemuxerStream pointer is returned from GetStream it is |
| 43 // guaranteed to stay valid for as long as the Demuxer/DemuxerStreamProvider | 37 // 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 | 38 // 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 | 39 // 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 | 40 // 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 | 41 // remove SourceBuffer from a MediaSource at any point and this will make |
| 48 // some previously existing streams inaccessible/unavailable. | 42 // some previously existing streams inaccessible/unavailable. |
| 49 // Other types: | 43 // Other types: |
| 50 // Should not be called. | 44 // Should not be called. |
| 51 virtual DemuxerStream* GetStream(DemuxerStream::Type type) = 0; | 45 virtual DemuxerStream* GetStream(DemuxerStream::Type type) = 0; |
| 52 | 46 |
| 53 // For Type::URL: | 47 // For Type::URL: |
| 54 // Returns the URL parameters of the media to play. Empty URLs are legal, | 48 // Returns the URL parameters of the media to play. Empty URLs are legal, |
| 55 // and should be handled appropriately by the caller. | 49 // and should be handled appropriately by the caller. |
| 56 // Other types: | 50 // Other types: |
| 57 // Should not be called. | 51 // Should not be called. |
| 58 virtual MediaUrlParams GetMediaUrlParams() const; | 52 virtual MediaUrlParams GetMediaUrlParams() const; |
| 59 | 53 |
| 60 virtual DemuxerStreamProvider::Type GetType() const; | 54 virtual MediaResource::Type GetType() const; |
| 61 | 55 |
| 62 private: | 56 private: |
| 63 DISALLOW_COPY_AND_ASSIGN(DemuxerStreamProvider); | 57 DISALLOW_COPY_AND_ASSIGN(MediaResource); |
| 64 }; | 58 }; |
| 65 | 59 |
| 66 } // namespace media | 60 } // namespace media |
| 67 | 61 |
| 68 #endif // MEDIA_BASE_DEMUXER_STREAM_PROVIDER_H_ | 62 #endif // MEDIA_BASE_MEDIA_RESOURCE_H_ |
| OLD | NEW |