OLD | NEW |
| (Empty) |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef WEBKIT_GLUE_MEDIA_WEB_DATA_SOURCE_H_ | |
6 #define WEBKIT_GLUE_MEDIA_WEB_DATA_SOURCE_H_ | |
7 | |
8 #include "base/callback.h" | |
9 #include "media/base/filters.h" | |
10 #include "media/base/pipeline_status.h" | |
11 | |
12 namespace webkit_glue { | |
13 | |
14 // An interface that allows WebMediaPlayerImpl::Proxy to communicate with the | |
15 // DataSource in the pipeline. | |
16 class WebDataSource : public media::DataSource { | |
17 public: | |
18 WebDataSource(); | |
19 virtual ~WebDataSource(); | |
20 | |
21 // Initialize this object using |url|. This object calls |callback| when | |
22 // initialization has completed. | |
23 virtual void Initialize(const std::string& url, | |
24 const media::PipelineStatusCB& callback) = 0; | |
25 | |
26 // Called to cancel initialization. The callback passed in Initialize() will | |
27 // be destroyed and will not be called after this method returns. Once this | |
28 // method returns, the object will be in an uninitialized state and | |
29 // Initialize() cannot be called again. The caller is expected to release | |
30 // its handle to this object and never call it again. | |
31 virtual void CancelInitialize() = 0; | |
32 | |
33 // Returns true if the media resource has a single origin, false otherwise. | |
34 // | |
35 // Method called on the render thread. | |
36 virtual bool HasSingleOrigin() = 0; | |
37 | |
38 // This method is used to unblock any read calls that would cause the | |
39 // media pipeline to stall. | |
40 // | |
41 // Method called on the render thread. | |
42 virtual void Abort() = 0; | |
43 | |
44 private: | |
45 DISALLOW_COPY_AND_ASSIGN(WebDataSource); | |
46 }; | |
47 | |
48 // Temporary hack to allow WebMediaPlayerImpl::Proxy::AddDataSource() to | |
49 // be called when WebDataSource objects are created. This can be removed | |
50 // once WebMediaPlayerImpl::Proxy is fixed so it doesn't have to track | |
51 // WebDataSources. Proxy only has to track WebDataSources so it can call Abort() | |
52 // on them at shutdown. Once cancellation is added to DataSource and pause | |
53 // support in Demuxers cancel pending reads, Proxy shouldn't have to keep | |
54 // a WebDataSource list or call Abort(). | |
55 typedef base::Callback<void(WebDataSource*)> WebDataSourceBuildObserverHack; | |
56 | |
57 } // namespace webkit_glue | |
58 | |
59 #endif // WEBKIT_GLUE_MEDIA_WEB_DATA_SOURCE_H_ | |
OLD | NEW |