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.
5 #ifndef CONTENT_BROWSER_MEDIA_ANDROID_BROWSER_DEMUXER_ANDROID_H_
6 #define CONTENT_BROWSER_MEDIA_ANDROID_BROWSER_DEMUXER_ANDROID_H_
8 #include "base/id_map.h"
9 #include "content/public/browser/browser_message_filter.h"
10 #include "media/base/android/demuxer_android.h"
14 // Represents the browser process half of an IPC-based demuxer proxy.
15 // It vends out media::DemuxerAndroid instances that are registered with an
16 // end point in the renderer process.
18 // Refer to RendererDemuxerAndroid for the renderer process half.
19 class CONTENT_EXPORT BrowserDemuxerAndroid
: public BrowserMessageFilter
{
21 BrowserDemuxerAndroid();
23 // BrowserMessageFilter overrides.
24 void OverrideThreadForMessage(const IPC::Message
& message
,
25 BrowserThread::ID
* thread
) override
;
26 bool OnMessageReceived(const IPC::Message
& message
) override
;
28 // Returns an uninitialized demuxer implementation associated with
29 // |demuxer_client_id|, which can be used to communicate with the real demuxer
30 // in the renderer process.
31 scoped_ptr
<media::DemuxerAndroid
> CreateDemuxer(int demuxer_client_id
);
34 friend class base::RefCountedThreadSafe
<BrowserDemuxerAndroid
>;
35 ~BrowserDemuxerAndroid() override
;
40 // Called by internal demuxer implementations to add/remove a client
42 void AddDemuxerClient(int demuxer_client_id
,
43 media::DemuxerAndroidClient
* client
);
44 void RemoveDemuxerClient(int demuxer_client_id
);
46 // IPC message handlers.
47 void OnDemuxerReady(int demuxer_client_id
,
48 const media::DemuxerConfigs
& configs
);
49 void OnReadFromDemuxerAck(int demuxer_client_id
,
50 const media::DemuxerData
& data
);
51 void OnDemuxerSeekDone(int demuxer_client_id
,
52 const base::TimeDelta
& actual_browser_seek_time
);
53 void OnDurationChanged(int demuxer_client_id
,
54 const base::TimeDelta
& duration
);
56 IDMap
<media::DemuxerAndroidClient
> demuxer_clients_
;
58 DISALLOW_COPY_AND_ASSIGN(BrowserDemuxerAndroid
);
61 } // namespace content
63 #endif // CONTENT_BROWSER_MEDIA_ANDROID_BROWSER_DEMUXER_ANDROID_H_