content/media/MediaInfo.h

branch
TOR_BUG_9701
changeset 15
b8a032363ba2
equal deleted inserted replaced
-1:000000000000 0:ba2c1db750c6
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
8
9 #include "nsSize.h"
10 #include "nsRect.h"
11 #include "ImageTypes.h"
12
13 namespace mozilla {
14
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 {}
23
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;
27
28 // Indicates the frame layout for single track stereo videos.
29 StereoMode mStereoMode;
30
31 // True if we have an active video bitstream.
32 bool mHasVideo;
33 };
34
35 class AudioInfo {
36 public:
37 AudioInfo()
38 : mRate(44100)
39 , mChannels(2)
40 , mHasAudio(false)
41 {}
42
43 // Sample rate.
44 uint32_t mRate;
45
46 // Number of audio channels.
47 uint32_t mChannels;
48
49 // True if we have an active audio bitstream.
50 bool mHasAudio;
51 };
52
53 class MediaInfo {
54 public:
55 bool HasVideo() const
56 {
57 return mVideo.mHasVideo;
58 }
59
60 bool HasAudio() const
61 {
62 return mAudio.mHasAudio;
63 }
64
65 bool HasValidMedia() const
66 {
67 return HasVideo() || HasAudio();
68 }
69
70 VideoInfo mVideo;
71 AudioInfo mAudio;
72 };
73
74 } // namespace mozilla
75
76 #endif // MediaInfo_h

mercurial