Line data Source code
1 : /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 : /* vim:set ts=2 sw=2 et tw=78: */
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 mozilla_dom_VideoTrackList_h
8 : #define mozilla_dom_VideoTrackList_h
9 :
10 : #include "MediaTrack.h"
11 : #include "MediaTrackList.h"
12 :
13 : namespace mozilla {
14 : namespace dom {
15 :
16 : class VideoTrack;
17 :
18 0 : class VideoTrackList : public MediaTrackList
19 : {
20 : public:
21 0 : VideoTrackList(nsPIDOMWindowInner* aOwnerWindow,
22 : HTMLMediaElement* aMediaElement)
23 0 : : MediaTrackList(aOwnerWindow, aMediaElement)
24 0 : , mSelectedIndex(-1)
25 0 : {}
26 :
27 : JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
28 :
29 : VideoTrack* operator[](uint32_t aIndex);
30 :
31 : void RemoveTrack(const RefPtr<MediaTrack>& aTrack) override;
32 :
33 : void EmptyTracks() override;
34 :
35 : VideoTrack* GetSelectedTrack();
36 :
37 : // WebIDL
38 0 : int32_t SelectedIndex() const
39 : {
40 0 : return mSelectedIndex;
41 : }
42 :
43 : VideoTrack* IndexedGetter(uint32_t aIndex, bool& aFound);
44 :
45 : VideoTrack* GetTrackById(const nsAString& aId);
46 :
47 : friend class VideoTrack;
48 :
49 : protected:
50 0 : VideoTrackList* AsVideoTrackList() override { return this; }
51 :
52 : private:
53 : int32_t mSelectedIndex;
54 : };
55 :
56 : } // namespace dom
57 : } // namespace mozilla
58 :
59 : #endif // mozilla_dom_VideoTrackList_h
|