Coverage Report

Created: 2018-09-25 14:53

/work/obj-fuzz/dist/include/mozilla/dom/VideoTrack.h
Line
Count
Source (jump to first uncovered line)
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_VideoTrack_h
8
#define mozilla_dom_VideoTrack_h
9
10
#include "MediaTrack.h"
11
12
namespace mozilla {
13
namespace dom {
14
15
class VideoTrackList;
16
class VideoStreamTrack;
17
18
class VideoTrack : public MediaTrack
19
{
20
public:
21
  VideoTrack(nsIGlobalObject* aOwnerGlobal,
22
             const nsAString& aId,
23
             const nsAString& aKind,
24
             const nsAString& aLabel,
25
             const nsAString& aLanguage,
26
             VideoStreamTrack* aStreamTarck = nullptr);
27
28
  NS_DECL_ISUPPORTS_INHERITED
29
  NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(VideoTrack, MediaTrack)
30
31
  JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
32
33
  VideoTrack* AsVideoTrack() override
34
0
  {
35
0
    return this;
36
0
  }
37
38
  // When fetching media resource, if no video track is selected by the media
39
  // resource, then the first VideoTrack object in the list is set selected as
40
  // default. If multiple video tracks are selected by its media resource at
41
  // fetching phase, then the first enabled video track is set selected.
42
  // aFlags contains FIRE_NO_EVENTS because no events are fired in such cases.
43
  void SetEnabledInternal(bool aEnabled, int aFlags) override;
44
45
  // Get associated video stream track when the video track comes from
46
  // MediaStream. This might be nullptr when the src of owning HTMLMediaElement
47
  // is not MediaStream.
48
0
  VideoStreamTrack* GetVideoStreamTrack() { return mVideoStreamTrack; }
49
50
  // WebIDL
51
  bool Selected() const
52
0
  {
53
0
    return mSelected;
54
0
  }
55
56
  // Either zero or one video track is selected in a list; If the selected track
57
  // is in a VideoTrackList, then all the other VideoTrack objects in that list
58
  // must be unselected.
59
  void SetSelected(bool aSelected);
60
61
private:
62
  virtual ~VideoTrack();
63
64
  bool mSelected;
65
  RefPtr<VideoStreamTrack> mVideoStreamTrack;
66
};
67
68
} // namespace dom
69
} // namespace mozilla
70
71
#endif // mozilla_dom_VideoTrack_h