netwerk/protocol/rtsp/RtspChannelChild.h

branch
TOR_BUG_9701
changeset 9
a63d609f5ebe
equal deleted inserted replaced
-1:000000000000 0:1d9cefbf237f
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set sw=2 ts=8 et tw=80 : */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6
7 #ifndef RtspChannelChild_h
8 #define RtspChannelChild_h
9
10 #include "mozilla/net/PRtspChannelChild.h"
11 #include "mozilla/net/NeckoChild.h"
12 #include "nsBaseChannel.h"
13 #include "nsIChildChannel.h"
14 #include "nsIStreamingProtocolController.h"
15 #include "nsIStreamingProtocolService.h"
16
17 namespace mozilla {
18 namespace net {
19
20 //-----------------------------------------------------------------------------
21 // RtspChannelChild is a dummy channel used to aid MediaResource creation in
22 // HTMLMediaElement. Network control and data flows are managed by an
23 // RtspController object, which is created by us and manipulated by
24 // RtspMediaResource. This object is also responsible for inter-process
25 // communication with the parent process.
26 // When RtspChannelChild::AsyncOpen is called, it should create an
27 // RtspController object, dispatch an OnStartRequest and immediately return.
28 // We expect an RtspMediaResource object will be created in the calling context
29 // and it will use the RtpController we create.
30
31 class RtspChannelChild : public PRtspChannelChild
32 , public nsBaseChannel
33 , public nsIChildChannel
34 {
35 public:
36 NS_DECL_ISUPPORTS
37 NS_DECL_NSICHILDCHANNEL
38
39 RtspChannelChild(nsIURI *aUri);
40 ~RtspChannelChild();
41
42 // nsBaseChannel::nsIChannel
43 NS_IMETHOD GetContentType(nsACString & aContentType) MOZ_OVERRIDE MOZ_FINAL;
44 NS_IMETHOD AsyncOpen(nsIStreamListener *listener, nsISupports *aContext)
45 MOZ_OVERRIDE MOZ_FINAL;
46
47 // nsBaseChannel::nsIStreamListener::nsIRequestObserver
48 NS_IMETHOD OnStartRequest(nsIRequest *aRequest, nsISupports *aContext)
49 MOZ_OVERRIDE MOZ_FINAL;
50 NS_IMETHOD OnStopRequest(nsIRequest *aRequest,
51 nsISupports *aContext,
52 nsresult aStatusCode) MOZ_OVERRIDE MOZ_FINAL;
53
54 // nsBaseChannel::nsIStreamListener
55 NS_IMETHOD OnDataAvailable(nsIRequest *aRequest,
56 nsISupports *aContext,
57 nsIInputStream *aInputStream,
58 uint64_t aOffset,
59 uint32_t aCount) MOZ_OVERRIDE MOZ_FINAL;
60
61 // nsBaseChannel::nsIChannel::nsIRequest
62 NS_IMETHOD Cancel(nsresult status) MOZ_OVERRIDE MOZ_FINAL;
63 NS_IMETHOD Suspend() MOZ_OVERRIDE MOZ_FINAL;
64 NS_IMETHOD Resume() MOZ_OVERRIDE MOZ_FINAL;
65
66 // nsBaseChannel
67 NS_IMETHOD OpenContentStream(bool aAsync,
68 nsIInputStream **aStream,
69 nsIChannel **aChannel) MOZ_OVERRIDE MOZ_FINAL;
70
71 // IPDL
72 void AddIPDLReference();
73 void ReleaseIPDLReference();
74
75 // RtspChannelChild
76 nsIStreamingProtocolController* GetController();
77 void ReleaseController();
78
79 private:
80 bool mIPCOpen;
81 bool mCanceled;
82 nsCOMPtr<nsIStreamingProtocolController> mMediaStreamController;
83 };
84
85 } // namespace net
86 } // namespace mozilla
87
88 #endif // RtspChannelChild_h

mercurial