29 #include <nsComponentManagerUtils.h>
30 #include <nsISimpleEnumerator.h>
31 #include <nsIWritablePropertyBag2.h>
36 #define SB_PROPERTYBAG_CONTRACTID "@songbirdnest.com/moz/xpcom/sbpropertybag;1"
44 mContainerType(aContainerType)
49 sbMediaFormatContainer::~sbMediaFormatContainer()
55 sbMediaFormatContainer::GetContainerType(nsAString & aContainerType)
57 aContainerType = mContainerType;
63 sbMediaFormatContainer::GetProperties(nsIPropertyBag * *aProperties)
65 NS_ENSURE_STATE(mProperties);
72 sbMediaFormatContainer::SetContainerType(
const nsAString & aContainerType)
74 mContainerType = aContainerType;
84 nsresult rv = CallQueryInterface<nsIPropertyBag, nsIWritablePropertyBag>
85 (aProperties, getter_AddRefs(mProperties));
86 NS_ENSURE_SUCCESS(rv, rv);
102 sbMediaFormatVideo::~sbMediaFormatVideo()
109 sbMediaFormatVideo::GetVideoType(nsAString & aVideoType)
111 aVideoType = mVideoType;
118 sbMediaFormatVideo::GetVideoWidth(PRInt32 *aVideoWidth)
120 NS_ENSURE_ARG_POINTER(aVideoWidth);
122 *aVideoWidth = mVideoWidth;
129 sbMediaFormatVideo::GetVideoHeight(PRInt32 *aVideoHeight)
131 NS_ENSURE_ARG_POINTER(aVideoHeight);
133 *aVideoHeight = mVideoHeight;
140 sbMediaFormatVideo::GetVideoPAR(PRUint32 *aNumerator, PRUint32 *aDenominator)
142 NS_ENSURE_ARG_POINTER(aNumerator);
143 NS_ENSURE_ARG_POINTER(aDenominator);
152 sbMediaFormatVideo::GetVideoFrameRate(PRUint32 *aNumerator, PRUint32 *aDenominator)
154 NS_ENSURE_ARG_POINTER(aNumerator);
155 NS_ENSURE_ARG_POINTER(aDenominator);
157 *aNumerator = mVideoFrameRate.
Numerator();
164 sbMediaFormatVideo::GetBitRate(PRInt32 *aBitRate)
166 NS_ENSURE_ARG_POINTER(aBitRate);
168 *aBitRate = mBitRate;
175 sbMediaFormatVideo::GetProperties(nsIPropertyBag * *aProperties)
177 NS_ENSURE_STATE(mProperties);
184 sbMediaFormatVideo::SetVideoType(
const nsAString & aVideoType)
186 mVideoType = aVideoType;
192 sbMediaFormatVideo::SetVideoWidth(PRInt32 aVideoWidth)
194 mVideoWidth = aVideoWidth;
200 sbMediaFormatVideo::SetVideoHeight(PRInt32 aVideoHeight)
202 mVideoHeight = aVideoHeight;
210 mVideoPAR =
sbFraction(aNumerator, aDenominator);
218 mVideoFrameRate =
sbFraction(aNumerator, aDenominator);
224 sbMediaFormatVideo::SetBitRate(PRInt32 aBitRate)
236 nsresult rv = CallQueryInterface<nsIPropertyBag, nsIWritablePropertyBag>
237 (aProperties, getter_AddRefs(mProperties));
238 NS_ENSURE_SUCCESS(rv, rv);
254 sbMediaFormatAudio::~sbMediaFormatAudio()
261 sbMediaFormatAudio::GetAudioType(nsAString & aAudioType)
263 aAudioType = mAudioType;
270 sbMediaFormatAudio::GetBitRate(PRInt32 *aBitRate)
272 NS_ENSURE_ARG_POINTER(aBitRate);
274 *aBitRate = mBitRate;
281 sbMediaFormatAudio::GetSampleRate(PRInt32 *aSampleRate)
283 NS_ENSURE_ARG_POINTER(aSampleRate);
285 *aSampleRate = mSampleRate;
292 sbMediaFormatAudio::GetChannels(PRInt32 *aChannels)
294 NS_ENSURE_ARG_POINTER(aChannels);
296 *aChannels = mChannels;
303 sbMediaFormatAudio::GetProperties(nsIPropertyBag * *aProperties)
305 NS_ENSURE_ARG_POINTER(aProperties);
312 sbMediaFormatAudio::SetAudioType(
const nsAString & aAudioType)
314 mAudioType = aAudioType;
320 sbMediaFormatAudio::SetBitRate(PRInt32 aBitRate)
328 sbMediaFormatAudio::SetSampleRate(PRInt32 aSampleRate)
330 mSampleRate = aSampleRate;
336 sbMediaFormatAudio::SetChannels(PRInt32 aChannels)
338 mChannels = aChannels;
347 nsresult rv = CallQueryInterface<nsIPropertyBag, nsIWritablePropertyBag>
348 (aProperties, getter_AddRefs(mProperties));
349 NS_ENSURE_SUCCESS(rv, rv);
359 mContainer(aContainer),
360 mVideoStream(aVideoStream)
365 sbMediaFormat::~sbMediaFormat()
374 NS_ENSURE_STATE(mContainer);
397 mContainer = aContainer;
405 mVideoStream = aFormat;
413 mAudioStream = aFormat;
nsresult sbReturnCOMPtr(COMPtr &aPtr, ReturnType **aReturn)
nsCOMPtr< nsIArray > mProperties
PRUint32 Numerator() const
PRUint32 Denominator() const
nsresult SetProperties(nsIArray *aProperties)