Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(377)

Side by Side Diff: media/base/media_resource.h

Issue 2643743002: Mojify demuxers and allow running {Chunk/FFmpeg}Demuxer in a Utility Process (Closed)
Patch Set: Rebase and make sure to unbind mojom::DemuxerPtr on the bound thread during termination Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « media/base/ipc/media_param_traits_macros.h ('k') | media/base/media_resource.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_MEDIA_RESOURCE_H_ 5 #ifndef MEDIA_BASE_MEDIA_RESOURCE_H_
6 #define MEDIA_BASE_MEDIA_RESOURCE_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 resources" in 16 // Abstract class that defines how to retrieve "media resources" in
17 // DemuxerStream form (for most cases) or URL form (for the MediaPlayerRenderer 17 // DemuxerStream form (for most cases) or URL form (for the MediaPlayerRenderer
18 // case). 18 // case).
19 // 19 //
20 // 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
21 // 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.
22 class MEDIA_EXPORT MediaResource { 22 class MEDIA_EXPORT MediaResource {
23 public: 23 public:
24 enum Type { 24 enum Type {
25 REMOTE, // Indicates GetRemoteId() should be used
25 STREAM, // Indicates GetStreams() should be used 26 STREAM, // Indicates GetStreams() should be used
26 URL, // Indicates GetUrl() should be used 27 URL, // Indicates GetUrl() should be used
27 }; 28 };
28 29
30 static const int kInvalidRemoteId;
31
29 MediaResource(); 32 MediaResource();
30 virtual ~MediaResource(); 33 virtual ~MediaResource();
31 34
32 // For Type::STREAM: 35 // For Type::STREAM:
33 // Returns the first stream of the given stream type (which is not allowed 36 // Returns the first stream of the given stream type (which is not allowed
34 // to be DemuxerStream::TEXT), or NULL if that type of stream is not 37 // to be DemuxerStream::TEXT), or NULL if that type of stream is not
35 // present. 38 // present.
36 // NOTE: Once a DemuxerStream pointer is returned from GetStream it is 39 // NOTE: Once a DemuxerStream pointer is returned from GetStream it is
37 // guaranteed to stay valid for as long as the Demuxer/MediaResource 40 // guaranteed to stay valid for as long as the Demuxer/MediaResource
38 // is alive. But make no assumption that once GetStream returned a non-null 41 // is alive. But make no assumption that once GetStream returned a non-null
39 // pointer for some stream type then all subsequent calls will also return 42 // pointer for some stream type then all subsequent calls will also return
40 // non-null pointer for the same stream type. In MSE Javascript code can 43 // non-null pointer for the same stream type. In MSE Javascript code can
41 // remove SourceBuffer from a MediaSource at any point and this will make 44 // remove SourceBuffer from a MediaSource at any point and this will make
42 // some previously existing streams inaccessible/unavailable. 45 // some previously existing streams inaccessible/unavailable.
43 // Other types: 46 // Other types:
44 // Should not be called. 47 // Should not be called.
45 virtual DemuxerStream* GetStream(DemuxerStream::Type type) = 0; 48 virtual DemuxerStream* GetStream(DemuxerStream::Type type) = 0;
46 49
47 // For Type::URL: 50 // For Type::URL:
48 // Returns the URL parameters of the media to play. Empty URLs are legal, 51 // Returns the URL parameters of the media to play. Empty URLs are legal,
49 // and should be handled appropriately by the caller. 52 // and should be handled appropriately by the caller.
50 // Other types: 53 // Other types:
51 // Should not be called. 54 // Should not be called.
52 virtual MediaUrlParams GetMediaUrlParams() const; 55 virtual MediaUrlParams GetMediaUrlParams() const;
53 56
54 virtual MediaResource::Type GetType() const; 57 virtual MediaResource::Type GetType() const;
55 58
59 virtual int32_t GetRemoteId() const;
60
61 protected:
62 int32_t remote_id_;
63
56 private: 64 private:
57 DISALLOW_COPY_AND_ASSIGN(MediaResource); 65 DISALLOW_COPY_AND_ASSIGN(MediaResource);
58 }; 66 };
59 67
60 } // namespace media 68 } // namespace media
61 69
62 #endif // MEDIA_BASE_MEDIA_RESOURCE_H_ 70 #endif // MEDIA_BASE_MEDIA_RESOURCE_H_
OLDNEW
« no previous file with comments | « media/base/ipc/media_param_traits_macros.h ('k') | media/base/media_resource.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698