OLD | NEW |
| (Empty) |
1 // Copyright 2013 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 MEDIA_BASE_ANDROID_DEMUXER_ANDROID_H_ | |
6 #define MEDIA_BASE_ANDROID_DEMUXER_ANDROID_H_ | |
7 | |
8 #include "base/time/time.h" | |
9 #include "media/base/demuxer_stream.h" | |
10 #include "media/base/media_export.h" | |
11 | |
12 namespace media { | |
13 | |
14 class DemuxerAndroidClient; | |
15 struct DemuxerConfigs; | |
16 struct DemuxerData; | |
17 | |
18 // Defines a demuxer with asynchronous operations. | |
19 class MEDIA_EXPORT DemuxerAndroid { | |
20 public: | |
21 virtual ~DemuxerAndroid() {} | |
22 | |
23 // Initializes this demuxer with |client| as the callback handler. | |
24 // Must be called prior to calling any other methods. | |
25 virtual void Initialize(DemuxerAndroidClient* client) = 0; | |
26 | |
27 // Called to request additional data from the demuxer. | |
28 virtual void RequestDemuxerData(media::DemuxerStream::Type type) = 0; | |
29 | |
30 // Called to request the demuxer to seek to a particular media time. | |
31 // |is_browser_seek| is true if the renderer is not previously expecting this | |
32 // seek and must coordinate with other regular seeks. Browser seek existence | |
33 // should be hidden as much as possible from the renderer player and web apps. | |
34 // TODO(wolenetz): Instead of doing browser seek, replay cached data since | |
35 // last keyframe. See http://crbug.com/304234. | |
36 virtual void RequestDemuxerSeek(const base::TimeDelta& time_to_seek, | |
37 bool is_browser_seek) = 0; | |
38 }; | |
39 | |
40 // Defines the client callback interface. | |
41 class MEDIA_EXPORT DemuxerAndroidClient { | |
42 public: | |
43 // Called when the demuxer has initialized. | |
44 virtual void OnDemuxerConfigsAvailable(const DemuxerConfigs& params) = 0; | |
45 | |
46 // Called in response to RequestDemuxerData(). | |
47 virtual void OnDemuxerDataAvailable(const DemuxerData& params) = 0; | |
48 | |
49 // Called in response to RequestDemuxerSeek(). | |
50 // If this is in response to a request with |is_browser_seek| set to true, | |
51 // then |actual_browser_seek_time| may differ from the requested | |
52 // |time_to_seek|, and reflects the actual time seeked to by the demuxer. | |
53 // For regular demuxer seeks, |actual_browser_seek_time| is kNoTimestamp and | |
54 // should be ignored by browser player. | |
55 virtual void OnDemuxerSeekDone( | |
56 base::TimeDelta actual_browser_seek_time) = 0; | |
57 | |
58 // Called whenever the demuxer has detected a duration change. | |
59 virtual void OnDemuxerDurationChanged(base::TimeDelta duration) = 0; | |
60 | |
61 protected: | |
62 virtual ~DemuxerAndroidClient() {} | |
63 }; | |
64 | |
65 } // namespace media | |
66 | |
67 #endif // MEDIA_BASE_ANDROID_DEMUXER_ANDROID_H_ | |
OLD | NEW |