| 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_DEMUXER_STREAM_PROVIDER_H_ |
| 6 #define MEDIA_BASE_DEMUXER_STREAM_PROVIDER_H_ | 6 #define MEDIA_BASE_DEMUXER_STREAM_PROVIDER_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 "url/gurl.h" |
| 11 | 12 |
| 12 namespace media { | 13 namespace media { |
| 13 | 14 |
| 15 // Abstract class that defines how to retrieve "media sources" in DemuxerStream |
| 16 // form (for most cases) or URL form (for the MediaPlayerRenderer case). |
| 17 // |
| 18 // The sub-classes do not stricly provide demuxer streams, but because all |
| 19 // sub-classes are for the moment Demuxers, this class has not been renamed to |
| 20 // "MediaProvider". This class would be a good candidate for renaming, if |
| 21 // ever Pipeline were to support this class directly, instead of the Demuxer |
| 22 // interface. |
| 23 // |
| 24 // The derived classes must return a non-null value for the getter method |
| 25 // associated with their type, and return a null/empty value for other getters. |
| 14 class MEDIA_EXPORT DemuxerStreamProvider { | 26 class MEDIA_EXPORT DemuxerStreamProvider { |
| 15 public: | 27 public: |
| 28 enum Type { |
| 29 STREAM, // Indicates GetStream() should be used |
| 30 URL, // Indicates GetUrl() should be used |
| 31 }; |
| 32 |
| 16 DemuxerStreamProvider(); | 33 DemuxerStreamProvider(); |
| 17 virtual ~DemuxerStreamProvider(); | 34 virtual ~DemuxerStreamProvider(); |
| 18 | 35 |
| 19 // Returns the first stream of the given stream type (which is not allowed | 36 // For Type::STREAM: |
| 20 // to be DemuxerStream::TEXT), or NULL if that type of stream is not present. | 37 // Returns the first stream of the given stream type (which is not allowed |
| 38 // to be DemuxerStream::TEXT), or NULL if that type of stream is not |
| 39 // present. |
| 40 // Other types: |
| 41 // Should not be called. |
| 21 virtual DemuxerStream* GetStream(DemuxerStream::Type type) = 0; | 42 virtual DemuxerStream* GetStream(DemuxerStream::Type type) = 0; |
| 22 | 43 |
| 44 // For Type::URL: |
| 45 // Returns the URL of the media to play. This might be an empty URL, and |
| 46 // should be handled appropriately by the caller. |
| 47 // Other types: |
| 48 // Should not be called. |
| 49 virtual GURL GetUrl() const; |
| 50 |
| 51 virtual DemuxerStreamProvider::Type GetType() const; |
| 52 |
| 23 private: | 53 private: |
| 24 DISALLOW_COPY_AND_ASSIGN(DemuxerStreamProvider); | 54 DISALLOW_COPY_AND_ASSIGN(DemuxerStreamProvider); |
| 25 }; | 55 }; |
| 26 | 56 |
| 27 } // namespace media | 57 } // namespace media |
| 28 | 58 |
| 29 #endif // MEDIA_BASE_DEMUXER_STREAM_PROVIDER_H_ | 59 #endif // MEDIA_BASE_DEMUXER_STREAM_PROVIDER_H_ |
| OLD | NEW |