netwerk/protocol/rtsp/controller/RtspMetaData.cpp

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

michael@0 1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
michael@0 2 /* vim: set sw=2 ts=8 et 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
michael@0 7 #include "RtspMetaData.h"
michael@0 8 #include "prlog.h"
michael@0 9
michael@0 10 using namespace mozilla;
michael@0 11
michael@0 12 namespace mozilla {
michael@0 13 namespace net {
michael@0 14
michael@0 15 NS_IMPL_ISUPPORTS(RtspMetaData, nsIStreamingProtocolMetaData)
michael@0 16
michael@0 17 RtspMetaData::RtspMetaData()
michael@0 18 : mIndex(0)
michael@0 19 , mWidth(0)
michael@0 20 , mHeight(0)
michael@0 21 , mDuration(0)
michael@0 22 , mSampleRate(0)
michael@0 23 , mCurrentTimeStamp(0)
michael@0 24 , mChannelCount(0)
michael@0 25 {
michael@0 26 mMimeType.AssignLiteral("NONE");
michael@0 27 }
michael@0 28
michael@0 29 RtspMetaData::~RtspMetaData()
michael@0 30 {
michael@0 31
michael@0 32 }
michael@0 33
michael@0 34 nsresult
michael@0 35 RtspMetaData::DeserializeRtspMetaData(const InfallibleTArray<RtspMetadataParam>& metaArray)
michael@0 36 {
michael@0 37 nsresult rv;
michael@0 38
michael@0 39 // Deserialize meta data.
michael@0 40 for (uint32_t i = 0; i < metaArray.Length(); i++) {
michael@0 41 const RtspMetaValue& value = metaArray[i].value();
michael@0 42 const nsCString& name = metaArray[i].name();
michael@0 43
michael@0 44 if (name.EqualsLiteral("FRAMETYPE")) {
michael@0 45 rv = SetFrameType(value);
michael@0 46 NS_ENSURE_SUCCESS(rv, NS_ERROR_FAILURE);
michael@0 47 } else if (name.EqualsLiteral("TIMESTAMP")) {
michael@0 48 rv = SetTimeStamp(value);
michael@0 49 NS_ENSURE_SUCCESS(rv, NS_ERROR_FAILURE);
michael@0 50 } else if (name.EqualsLiteral("TRACKS")) {
michael@0 51 rv = SetTotalTracks(value);
michael@0 52 NS_ENSURE_SUCCESS(rv, NS_ERROR_FAILURE);
michael@0 53 } else if(name.EqualsLiteral("MIMETYPE")) {
michael@0 54 rv = SetMimeType(value);
michael@0 55 NS_ENSURE_SUCCESS(rv, NS_ERROR_FAILURE);
michael@0 56 } else if (name.EqualsLiteral("WIDTH")) {
michael@0 57 rv = SetWidth(value);
michael@0 58 NS_ENSURE_SUCCESS(rv, NS_ERROR_FAILURE);
michael@0 59 } else if (name.EqualsLiteral("HEIGHT")) {
michael@0 60 rv = SetHeight(value);
michael@0 61 NS_ENSURE_SUCCESS(rv, NS_ERROR_FAILURE);
michael@0 62 } else if (name.EqualsLiteral("SAMPLERATE")) {
michael@0 63 rv = SetSampleRate(value);
michael@0 64 NS_ENSURE_SUCCESS(rv, NS_ERROR_FAILURE);
michael@0 65 } else if(name.EqualsLiteral("DURATION")) {
michael@0 66 rv = SetDuration(value);
michael@0 67 NS_ENSURE_SUCCESS(rv, NS_ERROR_FAILURE);
michael@0 68 } else if (name.EqualsLiteral("CHANNELCOUNT")) {
michael@0 69 rv = SetChannelCount(value);
michael@0 70 NS_ENSURE_SUCCESS(rv, NS_ERROR_FAILURE);
michael@0 71 } else if (name.EqualsLiteral("ESDS")) {
michael@0 72 rv = SetEsdsData(value);
michael@0 73 NS_ENSURE_SUCCESS(rv, NS_ERROR_FAILURE);
michael@0 74 } else if (name.EqualsLiteral("AVCC")) {
michael@0 75 rv = SetAvccData(value);
michael@0 76 NS_ENSURE_SUCCESS(rv, NS_ERROR_FAILURE);
michael@0 77 }
michael@0 78 }
michael@0 79
michael@0 80 return NS_OK;
michael@0 81 }
michael@0 82
michael@0 83 NS_IMETHODIMP
michael@0 84 RtspMetaData::GetFrameType(uint32_t *aFrameType)
michael@0 85 {
michael@0 86 NS_ENSURE_ARG_POINTER(aFrameType);
michael@0 87 *aFrameType = mFrameType;
michael@0 88 return NS_OK;
michael@0 89 }
michael@0 90
michael@0 91 NS_IMETHODIMP
michael@0 92 RtspMetaData::SetFrameType(uint32_t aFrameType)
michael@0 93 {
michael@0 94 mFrameType = aFrameType;
michael@0 95 return NS_OK;
michael@0 96 }
michael@0 97
michael@0 98 NS_IMETHODIMP
michael@0 99 RtspMetaData::GetTotalTracks(uint32_t *aTracks)
michael@0 100 {
michael@0 101 NS_ENSURE_ARG_POINTER(aTracks);
michael@0 102 *aTracks = mTotalTracks;
michael@0 103 return NS_OK;
michael@0 104 }
michael@0 105
michael@0 106 NS_IMETHODIMP
michael@0 107 RtspMetaData::SetTotalTracks(uint32_t aTracks)
michael@0 108 {
michael@0 109 mTotalTracks = aTracks;
michael@0 110 return NS_OK;
michael@0 111 }
michael@0 112
michael@0 113 NS_IMETHODIMP
michael@0 114 RtspMetaData::GetMimeType(nsACString & aMimeType)
michael@0 115 {
michael@0 116 aMimeType.Assign(mMimeType);
michael@0 117 return NS_OK;
michael@0 118 }
michael@0 119
michael@0 120 NS_IMETHODIMP
michael@0 121 RtspMetaData::SetMimeType(const nsACString & aMimeType)
michael@0 122 {
michael@0 123 mMimeType.Assign(aMimeType);
michael@0 124 return NS_OK;
michael@0 125 }
michael@0 126
michael@0 127 NS_IMETHODIMP
michael@0 128 RtspMetaData::GetWidth(uint32_t *aWidth)
michael@0 129 {
michael@0 130 NS_ENSURE_ARG_POINTER(aWidth);
michael@0 131 *aWidth = mWidth;
michael@0 132 return NS_OK;
michael@0 133 }
michael@0 134
michael@0 135 NS_IMETHODIMP
michael@0 136 RtspMetaData::SetWidth(uint32_t aWidth)
michael@0 137 {
michael@0 138 mWidth = aWidth;
michael@0 139 return NS_OK;
michael@0 140 }
michael@0 141
michael@0 142 /* attribute unsigned long height; */
michael@0 143 NS_IMETHODIMP
michael@0 144 RtspMetaData::GetHeight(uint32_t *aHeight)
michael@0 145 {
michael@0 146 NS_ENSURE_ARG_POINTER(aHeight);
michael@0 147 *aHeight = mHeight;
michael@0 148 return NS_OK;
michael@0 149 }
michael@0 150
michael@0 151 NS_IMETHODIMP
michael@0 152 RtspMetaData::SetHeight(uint32_t aHeight)
michael@0 153 {
michael@0 154 mHeight = aHeight;
michael@0 155 return NS_OK;
michael@0 156 }
michael@0 157
michael@0 158 /* attribute unsigned long long duration; */
michael@0 159 NS_IMETHODIMP
michael@0 160 RtspMetaData::GetDuration(uint64_t *aDuration)
michael@0 161 {
michael@0 162 NS_ENSURE_ARG_POINTER(aDuration);
michael@0 163 *aDuration = mDuration;
michael@0 164 return NS_OK;
michael@0 165 }
michael@0 166
michael@0 167 NS_IMETHODIMP
michael@0 168 RtspMetaData::SetDuration(uint64_t aDuration)
michael@0 169 {
michael@0 170 mDuration = aDuration;
michael@0 171 return NS_OK;
michael@0 172 }
michael@0 173
michael@0 174 /* attribute unsigned long sampleRate; */
michael@0 175 NS_IMETHODIMP
michael@0 176 RtspMetaData::GetSampleRate(uint32_t *aSampleRate)
michael@0 177 {
michael@0 178 NS_ENSURE_ARG_POINTER(aSampleRate);
michael@0 179 *aSampleRate = mSampleRate;
michael@0 180 return NS_OK;
michael@0 181 }
michael@0 182
michael@0 183 NS_IMETHODIMP
michael@0 184 RtspMetaData::SetSampleRate(uint32_t aSampleRate)
michael@0 185 {
michael@0 186 mSampleRate = aSampleRate;
michael@0 187 return NS_OK;
michael@0 188 }
michael@0 189
michael@0 190 NS_IMETHODIMP
michael@0 191 RtspMetaData::GetTimeStamp(uint64_t *aTimeStamp)
michael@0 192 {
michael@0 193 NS_ENSURE_ARG_POINTER(aTimeStamp);
michael@0 194 *aTimeStamp = mCurrentTimeStamp;
michael@0 195 return NS_OK;
michael@0 196 }
michael@0 197
michael@0 198 NS_IMETHODIMP
michael@0 199 RtspMetaData::SetTimeStamp(uint64_t aTimeStamp)
michael@0 200 {
michael@0 201 mCurrentTimeStamp = aTimeStamp;
michael@0 202 return NS_OK;
michael@0 203 }
michael@0 204
michael@0 205 NS_IMETHODIMP
michael@0 206 RtspMetaData::GetChannelCount(uint32_t *aChannelCount)
michael@0 207 {
michael@0 208 NS_ENSURE_ARG_POINTER(aChannelCount);
michael@0 209 *aChannelCount = mChannelCount;
michael@0 210 return NS_OK;
michael@0 211 }
michael@0 212
michael@0 213 NS_IMETHODIMP
michael@0 214 RtspMetaData::SetChannelCount(uint32_t aChannelCount)
michael@0 215 {
michael@0 216 mChannelCount = aChannelCount;
michael@0 217 return NS_OK;
michael@0 218 }
michael@0 219
michael@0 220 NS_IMETHODIMP
michael@0 221 RtspMetaData::GetEsdsData(nsACString & aESDS)
michael@0 222 {
michael@0 223 aESDS.Assign(mESDS);
michael@0 224 return NS_OK;
michael@0 225 }
michael@0 226
michael@0 227 NS_IMETHODIMP
michael@0 228 RtspMetaData::SetEsdsData(const nsACString & aESDS)
michael@0 229 {
michael@0 230 mESDS.Assign(aESDS);
michael@0 231 return NS_OK;
michael@0 232 }
michael@0 233
michael@0 234 NS_IMETHODIMP
michael@0 235 RtspMetaData::GetAvccData(nsACString & aAVCC)
michael@0 236 {
michael@0 237 aAVCC.Assign(mAVCC);
michael@0 238 return NS_OK;
michael@0 239 }
michael@0 240
michael@0 241 NS_IMETHODIMP
michael@0 242 RtspMetaData::SetAvccData(const nsACString & aAVCC)
michael@0 243 {
michael@0 244 mAVCC.Assign(aAVCC);
michael@0 245 return NS_OK;
michael@0 246 }
michael@0 247
michael@0 248 } // namespace mozilla::net
michael@0 249 } // namespace mozilla

mercurial