content/media/MediaInfo.h

Fri, 16 Jan 2015 04:50:19 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Fri, 16 Jan 2015 04:50:19 +0100
branch
TOR_BUG_9701
changeset 13
44a2da4a2ab2
permissions
-rw-r--r--

Replace accessor implementation with direct member state manipulation, by
request https://trac.torproject.org/projects/tor/ticket/9701#comment:32

michael@0 1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
michael@0 2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
michael@0 3 /* This Source Code Form is subject to the terms of the Mozilla Public
michael@0 4 * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 6 #if !defined(MediaInfo_h)
michael@0 7 #define MediaInfo_h
michael@0 8
michael@0 9 #include "nsSize.h"
michael@0 10 #include "nsRect.h"
michael@0 11 #include "ImageTypes.h"
michael@0 12
michael@0 13 namespace mozilla {
michael@0 14
michael@0 15 // Stores info relevant to presenting media frames.
michael@0 16 class VideoInfo {
michael@0 17 public:
michael@0 18 VideoInfo()
michael@0 19 : mDisplay(0,0)
michael@0 20 , mStereoMode(StereoMode::MONO)
michael@0 21 , mHasVideo(false)
michael@0 22 {}
michael@0 23
michael@0 24 // Size in pixels at which the video is rendered. This is after it has
michael@0 25 // been scaled by its aspect ratio.
michael@0 26 nsIntSize mDisplay;
michael@0 27
michael@0 28 // Indicates the frame layout for single track stereo videos.
michael@0 29 StereoMode mStereoMode;
michael@0 30
michael@0 31 // True if we have an active video bitstream.
michael@0 32 bool mHasVideo;
michael@0 33 };
michael@0 34
michael@0 35 class AudioInfo {
michael@0 36 public:
michael@0 37 AudioInfo()
michael@0 38 : mRate(44100)
michael@0 39 , mChannels(2)
michael@0 40 , mHasAudio(false)
michael@0 41 {}
michael@0 42
michael@0 43 // Sample rate.
michael@0 44 uint32_t mRate;
michael@0 45
michael@0 46 // Number of audio channels.
michael@0 47 uint32_t mChannels;
michael@0 48
michael@0 49 // True if we have an active audio bitstream.
michael@0 50 bool mHasAudio;
michael@0 51 };
michael@0 52
michael@0 53 class MediaInfo {
michael@0 54 public:
michael@0 55 bool HasVideo() const
michael@0 56 {
michael@0 57 return mVideo.mHasVideo;
michael@0 58 }
michael@0 59
michael@0 60 bool HasAudio() const
michael@0 61 {
michael@0 62 return mAudio.mHasAudio;
michael@0 63 }
michael@0 64
michael@0 65 bool HasValidMedia() const
michael@0 66 {
michael@0 67 return HasVideo() || HasAudio();
michael@0 68 }
michael@0 69
michael@0 70 VideoInfo mVideo;
michael@0 71 AudioInfo mAudio;
michael@0 72 };
michael@0 73
michael@0 74 } // namespace mozilla
michael@0 75
michael@0 76 #endif // MediaInfo_h

mercurial