Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
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 #if !defined(MediaInfo_h)
7 #define MediaInfo_h
9 #include "nsSize.h"
10 #include "nsRect.h"
11 #include "ImageTypes.h"
13 namespace mozilla {
15 // Stores info relevant to presenting media frames.
16 class VideoInfo {
17 public:
18 VideoInfo()
19 : mDisplay(0,0)
20 , mStereoMode(StereoMode::MONO)
21 , mHasVideo(false)
22 {}
24 // Size in pixels at which the video is rendered. This is after it has
25 // been scaled by its aspect ratio.
26 nsIntSize mDisplay;
28 // Indicates the frame layout for single track stereo videos.
29 StereoMode mStereoMode;
31 // True if we have an active video bitstream.
32 bool mHasVideo;
33 };
35 class AudioInfo {
36 public:
37 AudioInfo()
38 : mRate(44100)
39 , mChannels(2)
40 , mHasAudio(false)
41 {}
43 // Sample rate.
44 uint32_t mRate;
46 // Number of audio channels.
47 uint32_t mChannels;
49 // True if we have an active audio bitstream.
50 bool mHasAudio;
51 };
53 class MediaInfo {
54 public:
55 bool HasVideo() const
56 {
57 return mVideo.mHasVideo;
58 }
60 bool HasAudio() const
61 {
62 return mAudio.mHasAudio;
63 }
65 bool HasValidMedia() const
66 {
67 return HasVideo() || HasAudio();
68 }
70 VideoInfo mVideo;
71 AudioInfo mAudio;
72 };
74 } // namespace mozilla
76 #endif // MediaInfo_h