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_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 // Interface that defines how to retrieve "media sources" in DemuxerStream form | |
| 16 // (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 interface would be a good candidate for renaming, if | |
| 21 // ever Pipeline were to use this interface directly, instead of the Demuxer | |
| 22 // interface. | |
| 23 // | |
| 24 // The derived classes must return a non-null value for either of the getter | |
| 25 // methods, and return a null value for the other. | |
| 26 // Ex: A Demuxer should return the DemuxerStreams it supports, but return a | |
| 27 // empty URL. | |
| 14 class MEDIA_EXPORT DemuxerStreamProvider { | 28 class MEDIA_EXPORT DemuxerStreamProvider { |
| 15 public: | 29 public: |
| 30 enum Type { | |
| 31 STREAM, // Indicates GetStream() should be used | |
| 32 URL, // Indicated GetUrl() should be used | |
| 33 }; | |
| 34 | |
| 16 DemuxerStreamProvider(); | 35 DemuxerStreamProvider(); |
| 17 virtual ~DemuxerStreamProvider(); | 36 virtual ~DemuxerStreamProvider(); |
| 18 | 37 |
| 19 // Returns the first stream of the given stream type (which is not allowed | 38 // Returns the first stream of the given stream type (which is not allowed |
| 20 // to be DemuxerStream::TEXT), or NULL if that type of stream is not present. | 39 // to be DemuxerStream::TEXT), or NULL if that type of stream is not present. |
| 40 // Returns a null value if we are of Type::URL. | |
|
xhwang
2016/06/24 03:19:47
You can say that if type is not STREAM, this shoul
tguilbert
2016/06/24 21:18:42
Done.
| |
| 21 virtual DemuxerStream* GetStream(DemuxerStream::Type type) = 0; | 41 virtual DemuxerStream* GetStream(DemuxerStream::Type type) = 0; |
| 22 | 42 |
| 43 // Returns the URL of the media to play. To be used when DemuxerStreams are | |
| 44 // not relevant (e.g. in the MediaPlayerRender case). | |
| 45 // Returns an empty GURL if we are of Type::STREAM. | |
|
xhwang
2016/06/24 03:19:47
ditto
tguilbert
2016/06/24 21:18:43
Done.
| |
| 46 virtual GURL GetUrl() { return GURL(); }; | |
|
xhwang
2016/06/24 03:19:47
remote the trailing semicolon, ditto on l.50
DaleCurtis
2016/06/24 17:43:41
Virtual methods should never be inline per the sty
tguilbert
2016/06/24 21:18:43
Done.
tguilbert
2016/06/24 21:18:43
Done.
| |
| 47 | |
| 48 // Returns the type of the DemuxerStreamProvider. | |
| 49 // The type also indicates whether GetStream or GetUrl should be used. | |
| 50 virtual DemuxerStreamProvider::Type type() { return Type::STREAM; }; | |
|
xhwang
2016/06/24 03:19:47
nit:
Will this work?
Type type() { return STREA
tguilbert
2016/06/24 21:18:43
It does.
| |
| 51 | |
| 23 private: | 52 private: |
| 24 DISALLOW_COPY_AND_ASSIGN(DemuxerStreamProvider); | 53 DISALLOW_COPY_AND_ASSIGN(DemuxerStreamProvider); |
| 25 }; | 54 }; |
| 26 | 55 |
| 27 } // namespace media | 56 } // namespace media |
| 28 | 57 |
| 29 #endif // MEDIA_BASE_DEMUXER_STREAM_PROVIDER_H_ | 58 #endif // MEDIA_BASE_DEMUXER_STREAM_PROVIDER_H_ |
| OLD | NEW |