AudioTrackList.cpp (1182B)
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 2 /* This Source Code Form is subject to the terms of the Mozilla Public 3 * License, v. 2.0. If a copy of the MPL was not distributed with this 4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 5 6 #include "mozilla/dom/AudioTrackList.h" 7 8 #include "mozilla/dom/AudioTrack.h" 9 #include "mozilla/dom/AudioTrackListBinding.h" 10 11 namespace mozilla::dom { 12 13 JSObject* AudioTrackList::WrapObject(JSContext* aCx, 14 JS::Handle<JSObject*> aGivenProto) { 15 return AudioTrackList_Binding::Wrap(aCx, this, aGivenProto); 16 } 17 18 AudioTrack* AudioTrackList::operator[](uint32_t aIndex) { 19 MediaTrack* track = MediaTrackList::operator[](aIndex); 20 return track->AsAudioTrack(); 21 } 22 23 AudioTrack* AudioTrackList::IndexedGetter(uint32_t aIndex, bool& aFound) { 24 MediaTrack* track = MediaTrackList::IndexedGetter(aIndex, aFound); 25 return track ? track->AsAudioTrack() : nullptr; 26 } 27 28 AudioTrack* AudioTrackList::GetTrackById(const nsAString& aId) { 29 MediaTrack* track = MediaTrackList::GetTrackById(aId); 30 return track ? track->AsAudioTrack() : nullptr; 31 } 32 33 } // namespace mozilla::dom