LCOV - code coverage report
Current view: top level - dom/media - MediaTrack.h (source / functions) Hit Total Coverage
Test: output.info Lines: 0 19 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 11 0.0 %
Legend: Lines: hit not hit

          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_MediaTrack_h
       8             : #define mozilla_dom_MediaTrack_h
       9             : 
      10             : #include "mozilla/DOMEventTargetHelper.h"
      11             : 
      12             : namespace mozilla {
      13             : namespace dom {
      14             : 
      15             : class MediaTrackList;
      16             : class VideoTrack;
      17             : class AudioTrack;
      18             : 
      19             : /**
      20             :  * Base class of AudioTrack and VideoTrack. The AudioTrack and VideoTrack
      21             :  * objects represent specific tracks of a media resource. Each track has aspects
      22             :  * of an identifier, category, label, and language, even if a track is removed
      23             :  * from its corresponding track list, those aspects do not change.
      24             :  *
      25             :  * When fetching the media resource, an audio/video track is created if the
      26             :  * media resource is found to have an audio/video track. When the UA has learned
      27             :  * that an audio/video track has ended, this audio/video track will be removed
      28             :  * from its corresponding track list.
      29             :  *
      30             :  * Although AudioTrack and VideoTrack are not EventTargets, TextTrack is, and
      31             :  * TextTrack inherits from MediaTrack as well (or is going to).
      32             :  */
      33             : class MediaTrack : public DOMEventTargetHelper
      34             : {
      35             : public:
      36             :   MediaTrack(const nsAString& aId,
      37             :              const nsAString& aKind,
      38             :              const nsAString& aLabel,
      39             :              const nsAString& aLanguage);
      40             : 
      41             :   NS_DECL_ISUPPORTS_INHERITED
      42           0 :   NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(MediaTrack, DOMEventTargetHelper)
      43             : 
      44             :   enum {
      45             :     DEFAULT = 0,
      46             :     FIRE_NO_EVENTS = 1 << 0,
      47             :   };
      48             :   // The default behavior of enabling an audio track or selecting a video track
      49             :   // fires a change event and notifies its media resource about the changes.
      50             :   // It should not fire any events when fetching media resource.
      51             :   virtual void SetEnabledInternal(bool aEnabled, int aFlags) = 0;
      52             : 
      53           0 :   virtual AudioTrack* AsAudioTrack()
      54             :   {
      55           0 :     return nullptr;
      56             :   }
      57             : 
      58           0 :   virtual VideoTrack* AsVideoTrack()
      59             :   {
      60           0 :     return nullptr;
      61             :   }
      62             : 
      63           0 :   const nsString& GetId() const
      64             :   {
      65           0 :     return mId;
      66             :   }
      67             : 
      68             :   // WebIDL
      69           0 :   void GetId(nsAString& aId) const
      70             :   {
      71           0 :     aId = mId;
      72           0 :   }
      73           0 :   void GetKind(nsAString& aKind) const
      74             :   {
      75           0 :     aKind = mKind;
      76           0 :   }
      77           0 :   void GetLabel(nsAString& aLabel) const
      78             :   {
      79           0 :     aLabel = mLabel;
      80           0 :   }
      81           0 :   void GetLanguage(nsAString& aLanguage) const
      82             :   {
      83           0 :     aLanguage = mLanguage;
      84           0 :   }
      85             : 
      86             :   friend class MediaTrackList;
      87             : 
      88             : protected:
      89             :   virtual ~MediaTrack();
      90             : 
      91             :   void SetTrackList(MediaTrackList* aList);
      92             :   void Init(nsPIDOMWindowInner* aOwnerWindow);
      93             : 
      94             :   RefPtr<MediaTrackList> mList;
      95             :   nsString mId;
      96             :   nsString mKind;
      97             :   nsString mLabel;
      98             :   nsString mLanguage;
      99             : };
     100             : 
     101             : } // namespace dom
     102             : } // namespace mozilla
     103             : 
     104             : #endif // mozilla_dom_MediaTrack_h

Generated by: LCOV version 1.13