sbMediaInspector.h
Go to the documentation of this file.
1 /*
2  *=BEGIN SONGBIRD GPL
3  *
4  * This file is part of the Songbird web player.
5  *
6  * Copyright(c) 2005-2009 POTI, Inc.
7  * http://www.songbirdnest.com
8  *
9  * This file may be licensed under the terms of of the
10  * GNU General Public License Version 2 (the ``GPL'').
11  *
12  * Software distributed under the License is distributed
13  * on an ``AS IS'' basis, WITHOUT WARRANTY OF ANY KIND, either
14  * express or implied. See the GPL for the specific language
15  * governing rights and limitations.
16  *
17  * You should have received a copy of the GPL along with this
18  * program. If not, go to http://www.gnu.org/licenses/gpl.html
19  * or write to the Free Software Foundation, Inc.,
20  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21  *
22  *=END SONGBIRD GPL
23  */
24 
25 #ifndef SBMEDIACOREFORMATINSPECTOR_H_
26 #define SBMEDIACOREFORMATINSPECTOR_H_
27 
28 // Mozilla includes
29 #include <nsCOMArray.h>
30 #include <nsCOMPtr.h>
31 #include <nsIVariant.h>
32 #include <nsIWritablePropertyBag.h>
33 #include <nsStringAPI.h>
34 
35 // Songbird includes
36 #include <sbFraction.h>
37 #include <sbIMediaInspector.h>
38 #include <sbIMediaFormatMutable.h>
39 
40 #include <nsIWritablePropertyBag.h>
41 
43 {
44 public:
46  NS_DECL_SBIMEDIAFORMATCONTAINER
47  NS_DECL_SBIMEDIAFORMATCONTAINERMUTABLE
48 
49  sbMediaFormatContainer(nsAString const & aContainerType = nsString());
50 
51  nsresult AddProperty(nsAString const & aKey, nsIVariant * aValue)
52  {
53  return mProperties->SetProperty(aKey, aValue);
54  }
55 private:
56  ~sbMediaFormatContainer();
57 
58  nsString mContainerType;
59  nsCOMPtr<nsIWritablePropertyBag> mProperties;
60 };
61 
63 {
64 public:
66  NS_DECL_SBIMEDIAFORMATVIDEO
67  NS_DECL_SBIMEDIAFORMATVIDEOMUTABLE
68 
70 
71  void SetVideoDimensions(PRInt32 aWidth, PRInt32 aHeight)
72  {
73  mVideoWidth = aWidth;
74  mVideoHeight = aHeight;
75  }
76 
77  void SetVideoPAR(sbFraction const & aVideoPar)
78  {
79  mVideoPAR = aVideoPar;
80  }
81 
85  void SetVideoFrameRate(sbFraction const & aVideoFrameRate)
86  {
87  mVideoFrameRate = aVideoFrameRate;
88  }
89 
96  nsresult SetProperty(nsAString const & aKey, nsIVariant * aVar)
97  {
98  nsresult rv;
99 
100  rv = mProperties->SetProperty(aKey, aVar);
101  NS_ENSURE_SUCCESS(rv, rv);
102 
103  return NS_OK;
104  }
105 private:
106  ~sbMediaFormatVideo();
107 
108  nsString mVideoType;
109  PRInt32 mVideoWidth;
110  PRInt32 mVideoHeight;
111  sbFraction mVideoPAR;
112  sbFraction mVideoFrameRate;
113  PRInt32 mBitRate;
114  nsCOMPtr<nsIWritablePropertyBag> mProperties;
115 };
116 
118 {
119 public:
121  NS_DECL_SBIMEDIAFORMATAUDIO
122  NS_DECL_SBIMEDIAFORMATAUDIOMUTABLE
123 
125 
126 private:
127  ~sbMediaFormatAudio();
128 
129  nsString mAudioType;
130  PRInt32 mBitRate;
131  PRInt32 mSampleRate;
132  PRInt32 mChannels;
133  nsCOMPtr<nsIWritablePropertyBag> mProperties;
134 };
135 
137 {
138 public:
140  NS_DECL_SBIMEDIAFORMAT
141  NS_DECL_SBIMEDIAFORMATMUTABLE
142 
143  sbMediaFormat(sbIMediaFormatContainer * aContainer = nsnull,
144  sbIMediaFormatVideo * aVideoStream = nsnull);
145 
146 private:
147  ~sbMediaFormat();
148 
149  nsCOMPtr<sbIMediaFormatContainer> mContainer;
150  nsCOMPtr<sbIMediaFormatVideo> mVideoStream;
151  nsCOMPtr<sbIMediaFormatAudio> mAudioStream;
152 };
153 
154 #endif /* SBMEDIACOREFORMATINSPECTOR_H_ */
NS_DECL_ISUPPORTS NS_DECL_SBIMEDIAFORMAT NS_DECL_SBIMEDIAFORMATMUTABLE sbMediaFormat(sbIMediaFormatContainer *aContainer=nsnull, sbIMediaFormatVideo *aVideoStream=nsnull)
return NS_OK
onPageChanged aValue
Definition: FeedWriter.js:1395
void SetVideoFrameRate(sbFraction const &aVideoFrameRate)
restoreDimensions aWidth
void SetVideoDimensions(PRInt32 aWidth, PRInt32 aHeight)
NS_DECL_ISUPPORTS NS_DECL_SBIMEDIAFORMATCONTAINER NS_DECL_SBIMEDIAFORMATCONTAINERMUTABLE sbMediaFormatContainer(nsAString const &aContainerType=nsString())
nsresult SetProperty(nsAString const &aKey, nsIVariant *aVar)
NS_DECL_ISUPPORTS NS_DECL_SBIMEDIAFORMATVIDEO NS_DECL_SBIMEDIAFORMATVIDEOMUTABLE sbMediaFormatVideo()
restoreDimensions aHeight
NS_DECL_ISUPPORTS NS_DECL_SBIMEDIAFORMATAUDIO NS_DECL_SBIMEDIAFORMATAUDIOMUTABLE sbMediaFormatAudio()
void SetVideoPAR(sbFraction const &aVideoPar)
nsresult AddProperty(nsAString const &aKey, nsIVariant *aValue)