OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 Google Inc. All rights reserved. |
3 * Copyright (C) 2011 Ericsson AB. All rights reserved. | 3 * Copyright (C) 2011 Ericsson AB. All rights reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 21 matching lines...) Expand all Loading... | |
32 #include "EventTarget.h" | 32 #include "EventTarget.h" |
33 #include "MediaStreamDescriptor.h" | 33 #include "MediaStreamDescriptor.h" |
34 #include "MediaStreamSource.h" | 34 #include "MediaStreamSource.h" |
35 #include <wtf/RefCounted.h> | 35 #include <wtf/RefCounted.h> |
36 #include <wtf/RefPtr.h> | 36 #include <wtf/RefPtr.h> |
37 #include <wtf/Vector.h> | 37 #include <wtf/Vector.h> |
38 #include <wtf/text/WTFString.h> | 38 #include <wtf/text/WTFString.h> |
39 | 39 |
40 namespace WebCore { | 40 namespace WebCore { |
41 | 41 |
42 class MediaStream; | |
42 class MediaStreamComponent; | 43 class MediaStreamComponent; |
43 | 44 |
44 class MediaStreamTrack : public RefCounted<MediaStreamTrack>, public ActiveDOMOb ject, public EventTarget, public MediaStreamSource::Observer { | 45 class MediaStreamTrack : public RefCounted<MediaStreamTrack>, public ActiveDOMOb ject, public EventTarget, public MediaStreamSource::Observer { |
45 public: | 46 public: |
46 static PassRefPtr<MediaStreamTrack> create(ScriptExecutionContext*, MediaStr eamComponent*); | 47 static PassRefPtr<MediaStreamTrack> create(ScriptExecutionContext*, MediaStr eamComponent*, MediaStream*); |
47 virtual ~MediaStreamTrack(); | 48 virtual ~MediaStreamTrack(); |
48 | 49 |
49 String kind() const; | 50 String kind() const; |
50 String id() const; | 51 String id() const; |
51 String label() const; | 52 String label() const; |
52 | 53 |
53 bool enabled() const; | 54 bool enabled() const; |
54 void setEnabled(bool); | 55 void setEnabled(bool); |
55 | 56 |
57 void setStream(MediaStream* stream) { m_stream = stream; } | |
abarth-chromium
2013/04/08 16:58:41
I'd probably have used "clearStream" here rather t
| |
58 | |
56 String readyState() const; | 59 String readyState() const; |
57 | 60 |
58 DEFINE_ATTRIBUTE_EVENT_LISTENER(mute); | 61 DEFINE_ATTRIBUTE_EVENT_LISTENER(mute); |
59 DEFINE_ATTRIBUTE_EVENT_LISTENER(unmute); | 62 DEFINE_ATTRIBUTE_EVENT_LISTENER(unmute); |
60 DEFINE_ATTRIBUTE_EVENT_LISTENER(ended); | 63 DEFINE_ATTRIBUTE_EVENT_LISTENER(ended); |
61 | 64 |
62 MediaStreamComponent* component(); | 65 MediaStreamComponent* component(); |
63 bool ended() const; | 66 bool ended() const; |
64 | 67 |
65 // EventTarget | 68 // EventTarget |
66 virtual const AtomicString& interfaceName() const OVERRIDE; | 69 virtual const AtomicString& interfaceName() const OVERRIDE; |
67 virtual ScriptExecutionContext* scriptExecutionContext() const OVERRIDE; | 70 virtual ScriptExecutionContext* scriptExecutionContext() const OVERRIDE; |
68 | 71 |
69 // ActiveDOMObject | 72 // ActiveDOMObject |
70 virtual void stop() OVERRIDE; | 73 virtual void stop() OVERRIDE; |
71 | 74 |
72 using RefCounted<MediaStreamTrack>::ref; | 75 using RefCounted<MediaStreamTrack>::ref; |
73 using RefCounted<MediaStreamTrack>::deref; | 76 using RefCounted<MediaStreamTrack>::deref; |
74 | 77 |
75 private: | 78 private: |
76 MediaStreamTrack(ScriptExecutionContext*, MediaStreamComponent*); | 79 MediaStreamTrack(ScriptExecutionContext*, MediaStreamComponent*, MediaStream *); |
77 | 80 |
78 // EventTarget | 81 // EventTarget |
79 virtual EventTargetData* eventTargetData() OVERRIDE; | 82 virtual EventTargetData* eventTargetData() OVERRIDE; |
80 virtual EventTargetData* ensureEventTargetData() OVERRIDE; | 83 virtual EventTargetData* ensureEventTargetData() OVERRIDE; |
81 virtual void refEventTarget() OVERRIDE { ref(); } | 84 virtual void refEventTarget() OVERRIDE { ref(); } |
82 virtual void derefEventTarget() OVERRIDE { deref(); } | 85 virtual void derefEventTarget() OVERRIDE { deref(); } |
83 EventTargetData m_eventTargetData; | 86 EventTargetData m_eventTargetData; |
84 | 87 |
85 // MediaStreamSourceObserver | 88 // MediaStreamSourceObserver |
86 virtual void sourceChangedState() OVERRIDE; | 89 virtual void sourceChangedState() OVERRIDE; |
87 | 90 |
88 bool m_stopped; | 91 bool m_stopped; |
89 RefPtr<MediaStreamComponent> m_component; | 92 RefPtr<MediaStreamComponent> m_component; |
93 MediaStream* m_stream; | |
90 }; | 94 }; |
91 | 95 |
92 typedef Vector<RefPtr<MediaStreamTrack> > MediaStreamTrackVector; | 96 typedef Vector<RefPtr<MediaStreamTrack> > MediaStreamTrackVector; |
93 | 97 |
94 } // namespace WebCore | 98 } // namespace WebCore |
95 | 99 |
96 #endif // ENABLE(MEDIA_STREAM) | 100 #endif // ENABLE(MEDIA_STREAM) |
97 | 101 |
98 #endif // MediaStreamTrack_h | 102 #endif // MediaStreamTrack_h |
OLD | NEW |