[Protocol-dev] CR-Client: Adding Helix-Adaptation header support
Aaron Colwell acolwell at real.comSynopsis: Add Helix-Adaptation header support
Overview: Here are the changes needed to support the Helix-Adaptation header.
- Updated SDP parser so that it handles the Helix-Adaptation-Support
header.
- Moved code in C3gpAdaptationHeader to CHXAdaptationHeader. This
was done to allow sharing of common code between the 3gp adaptation
header code and the Helix adaptation header code.
- Made C3gpAdaptationHeader derive from CHXAdaptationHeader and
supply the 2 virtual functions that tell the base class what
are the valid integer and string parameters for this header
- Created CHelixAdaptationHeader. This class derives from
CHXAdaptationHeader and provides an expanded set of valid
parameters.
- Removed the Copy() function from the C3gpAdaptationHeader code
since it wasn't used and would cause diffuculties now that this
code would have been part of a base class. The test cases for the
copy function were also removed from the unit test.
- Fixed a bug in RTSPClientProtocol where the rate adaptation headers
would not be generated for SDP initiated playback. This was caused
by the rate adaptation handling objects not being instantiated
early enough InitExt(). The creation of these objects were moved
closer to the top of the function.
- CHXRateAdaptationInfo was modified to look for the Helix header
as well as the 3GPP header.
- The License headers were updated to match other files in this
directory.
Files Modified:
protocol/sdp/sdpmdparse.cpp
protocol/rtsp/3gpadapthdr.cpp
protocol/rtsp/Umakefil
protocol/rtsp/rateadaptinfo.cpp
protocol/rtsp/rateadaptinfo.h
protocol/rtsp/rtspclnt.cpp
protocol/rtsp/pub/3gpadapthdr.h
protocol/rtsp/test/3gpadapthdr_test.cpp
protocol/rtsp/test/3gpadapthdr_test.h
protocol/rtsp/test/t3gpadapthdr.in
Files Added:
protocol/rtsp/adapthdr.cpp
protocol/rtsp/helixadapthdr.cpp
protocol/rtsp/pub/adapthdr.h
protocol/rtsp/pub/helixadapthdr.h
Image Size and Heap Use impact:
Platforms and Profiles affected: all
Distribution Libraries affected: none
Distribution library impact and planned action: none
Platforms and Profiles Build Verified: win32
Platforms and Profiles Functionality verified: win32
Branch: HEAD
QA Instructions: none
Index: sdpmdparse.cpp
===================================================================
RCS file: /cvsroot/protocol/sdp/sdpmdparse.cpp,v
retrieving revision 1.23
diff -u -r1.23 sdpmdparse.cpp
--- sdpmdparse.cpp 10 Aug 2004 18:59:06 -0000 1.23
+++ sdpmdparse.cpp 12 Oct 2004 00:18:40 -0000
@@ -1271,6 +1271,13 @@
strtoul(pFieldValue, 0, 10));
res = HXR_OK;
}
+ else if (!strcasecmp("Helix-Adaptation-Support", pFieldName))
+ {
+ // a=Helix-Adaptation-Support:3
+ AddULONG32(pHdr, "Helix-Adaptation-Support",
+ strtoul(pFieldValue, 0, 10));
+ res = HXR_OK;
+ }
else if (!strcasecmp("alt-default-id", pFieldName))
{
// 3GPP 26.234 Rel6 field
Index: 3gpadapthdr.cpp
===================================================================
RCS file: /cvsroot/protocol/rtsp/3gpadapthdr.cpp,v
retrieving revision 1.1
diff -u -r1.1 3gpadapthdr.cpp
--- 3gpadapthdr.cpp 7 May 2004 17:35:50 -0000 1.1
+++ 3gpadapthdr.cpp 12 Oct 2004 00:16:59 -0000
@@ -1,30 +1,44 @@
/* ***** BEGIN LICENSE BLOCK *****
- * Version: RCSL 1.0/RPSL 1.0
+ * Source last modified: $Id:$
*
- * Portions Copyright (c) 1995-2002 RealNetworks, Inc. All Rights Reserved.
+ * Portions Copyright (c) 1995-2004 RealNetworks, Inc. All Rights Reserved.
*
- * The contents of this file, and the files included with this file, are
- * subject to the current version of the RealNetworks Public Source License
- * Version 1.0 (the "RPSL") available at
+ * The contents of this file, and the files included with this file,
+ * are subject to the current version of the RealNetworks Public
+ * Source License (the "RPSL") available at
* http://www.helixcommunity.org/content/rpsl unless you have licensed
- * the file under the RealNetworks Community Source License Version 1.0
- * (the "RCSL") available at http://www.helixcommunity.org/content/rcsl,
- * in which case the RCSL will apply. You may also obtain the license terms
- * directly from RealNetworks. You may not use this file except in
- * compliance with the RPSL or, if you have a valid RCSL with RealNetworks
- * applicable to this file, the RCSL. Please see the applicable RPSL or
- * RCSL for the rights, obligations and limitations governing use of the
+ * the file under the current version of the RealNetworks Community
+ * Source License (the "RCSL") available at
+ * http://www.helixcommunity.org/content/rcsl, in which case the RCSL
+ * will apply. You may also obtain the license terms directly from
+ * RealNetworks. You may not use this file except in compliance with
+ * the RPSL or, if you have a valid RCSL with RealNetworks applicable
+ * to this file, the RCSL. Please see the applicable RPSL or RCSL for
+ * the rights, obligations and limitations governing use of the
* contents of the file.
*
+ * Alternatively, the contents of this file may be used under the
+ * terms of the GNU General Public License Version 2 or later (the
+ * "GPL") in which case the provisions of the GPL are applicable
+ * instead of those above. If you wish to allow use of your version of
+ * this file only under the terms of the GPL, and not to allow others
+ * to use your version of this file under the terms of either the RPSL
+ * or RCSL, indicate your decision by deleting the provisions above
+ * and replace them with the notice and other provisions required by
+ * the GPL. If you do not delete the provisions above, a recipient may
+ * use your version of this file under the terms of any one of the
+ * RPSL, the RCSL or the GPL.
+ *
* This file is part of the Helix DNA Technology. RealNetworks is the
- * developer of the Original Code and owns the copyrights in the portions
- * it created.
+ * developer of the Original Code and owns the copyrights in the
+ * portions it created.
*
- * This file, and the files included with this file, is distributed and made
- * available on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
- * EXPRESS OR IMPLIED, AND REALNETWORKS HEREBY DISCLAIMS ALL SUCH WARRANTIES,
- * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, FITNESS
- * FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * This file, and the files included with this file, is distributed
+ * and made available on an 'AS IS' basis, WITHOUT WARRANTY OF ANY
+ * KIND, EITHER EXPRESS OR IMPLIED, AND REALNETWORKS HEREBY DISCLAIMS
+ * ALL SUCH WARRANTIES, INCLUDING WITHOUT LIMITATION, ANY WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, QUIET
+ * ENJOYMENT OR NON-INFRINGEMENT.
*
* Technology Compatibility Kit Test Suite(s) Location:
* http://www.helixcommunity.org/content/tck
@@ -34,673 +48,27 @@
* ***** END LICENSE BLOCK ***** */
#include "3gpadapthdr.h"
-#include "hlxclib/string.h"
-#include "pckunpck.h"
-
const char* C3gpAdaptationHeader::zm_pIntParams[] = {"size",
- "target-time"};
+ "target-time",
+ NULL};
-const char* C3gpAdaptationHeader::zm_pStringParams[] = {"url"};
+const char* C3gpAdaptationHeader::zm_pStringParams[] = {"url",
+ NULL};
-C3gpAdaptationHeader::C3gpAdaptationHeader() :
- m_pCCF(NULL),
- m_pValues(NULL)
+C3gpAdaptationHeader::C3gpAdaptationHeader()
{}
C3gpAdaptationHeader::~C3gpAdaptationHeader()
-{
- HX_RELEASE(m_pCCF);
- HX_RELEASE(m_pValues);
-}
-
-bool C3gpAdaptationHeader::operator==(const C3gpAdaptationHeader& rhs)
-{
- return (CompareIHXValues(m_pValues, rhs.m_pValues) &&
- CompareIHXValues(rhs.m_pValues, m_pValues));
-}
-
-HX_RESULT C3gpAdaptationHeader::Init(IUnknown* pContext)
-{
- HX_RESULT res = HXR_INVALID_PARAMETER;
-
- HX_RELEASE(m_pCCF);
-
- if (pContext)
- {
- res = pContext->QueryInterface(IID_IHXCommonClassFactory,
- (void**)&m_pCCF);
- }
-
- return res;
-}
-
-HX_RESULT
-C3gpAdaptationHeader::Parse(const char* pBuf, UINT32 ulSize)
-{
- HX_RESULT res = HXR_INVALID_PARAMETER;
-
- if (!pBuf) // minimum valid string is url=""
- {
- res = HXR_INVALID_PARAMETER;
- }
- else if (!m_pCCF)
- {
- res = HXR_UNEXPECTED;
- }
- else
- {
- const char* pEnd = pBuf + ulSize;
-
- HX_RELEASE(m_pValues);
-
- res = GetURL(pBuf, pEnd);
-
- if (HXR_OK == res)
- {
- while((HXR_OK == res) && (pBuf != pEnd))
- {
- res = GetAdaptParam(pBuf, pEnd);
- }
- }
-
- if ((HXR_OK == res) && !AreValuesValid(m_pValues))
- {
- res = HXR_INVALID_PARAMETER;
- }
-
- if (HXR_OK != res)
- {
- HX_RELEASE(m_pValues);
- }
- }
-
- return res;
-}
-
-HX_RESULT
-C3gpAdaptationHeader::GetValues(REF(IHXValues*) pValues)
-{
- HX_RESULT res = HXR_FAILED;
-
- if (m_pValues)
- {
- pValues = m_pValues;
- pValues->AddRef();
- res = HXR_OK;
- }
-
- return res;
-}
-
-HX_RESULT C3gpAdaptationHeader::SetValues(IHXValues* pValues)
-{
- HX_RESULT res = HXR_INVALID_PARAMETER;
-
- if (pValues && AreValuesValid(pValues))
- {
- HX_RELEASE(m_pValues);
- m_pValues = pValues;
- m_pValues->AddRef();
-
- res = HXR_OK;
- }
-
- return res;
-}
-
-HX_RESULT C3gpAdaptationHeader::GetString(REF(IHXBuffer*) pBuf)
-{
- HX_RESULT res = HXR_UNEXPECTED;
-
- if (m_pCCF && m_pValues)
- {
- res = CreateBufferCCF(pBuf, m_pCCF);
-
- IHXBuffer* pURL = NULL;
- res = m_pValues->GetPropertyCString("url", pURL);
-
- if (HXR_OK == res)
- {
- res = AddURL(pBuf, pURL);
- }
- HX_RELEASE(pURL);
-
- if (HXR_OK == res)
- {
- // Add ULONG32 properties
- const char* pKey = NULL;
- ULONG32 ulValue;
- HX_RESULT tmpRes = m_pValues->GetFirstPropertyULONG32(pKey,
- ulValue);
-
- while((HXR_OK == res) && (HXR_OK == tmpRes))
- {
- res = AddULONG32Param(pBuf, pKey, ulValue);
-
- tmpRes = m_pValues->GetNextPropertyULONG32(pKey, ulValue);
- }
- }
-
- if (HXR_OK == res)
- {
- // Add CString properties
- const char* pKey = NULL;
- IHXBuffer* pValue = NULL;
- HX_RESULT tmpRes = m_pValues->GetFirstPropertyCString(pKey,
- pValue);
-
- while((HXR_OK == res) && (HXR_OK == tmpRes))
- {
- if (strcasecmp(pKey, "url"))
- {
- // Add all strings except for the url property
- // since it was added earlier
- res = AddStringParam(pBuf, pKey, pValue);
- }
-
- HX_RELEASE(pValue);
- tmpRes = m_pValues->GetNextPropertyCString(pKey, pValue);
- }
-
- HX_RELEASE(pValue);
- }
-
- if (HXR_OK != res)
- {
- HX_RELEASE(pBuf);
- }
- }
-
- return res;
-}
-
-HX_RESULT C3gpAdaptationHeader::Copy(const C3gpAdaptationHeader& rhs)
-{
- HX_RESULT res = HXR_OK;
-
- if (&rhs != this)
- {
- HX_RELEASE(m_pValues);
- HX_RELEASE(m_pCCF);
-
- if (rhs.m_pCCF)
- {
- m_pCCF = rhs.m_pCCF;
- m_pCCF->AddRef();
- }
-
- res = CopyIHXValues(rhs.m_pValues);
-
- }
-
- return res;
-}
-
-HX_RESULT
-C3gpAdaptationHeader::GetURL(REF(const char*) pCur, const char* pEnd)
-{
- HX_RESULT res = HXR_INVALID_PARAMETER;
-
- if (pCur && (pCur < pEnd) && !strncmp("url=\"", pCur, 5))
- {
- pCur += 5; // skip url="
-
- const char* pURLStart = pCur;
-
- // Search for the end quote
- for(;(pCur < pEnd) && *pCur && (*pCur != '\"'); pCur++)
- ;
-
- if (*pCur == '\"')
- {
- // We found the end quote
- UINT32 uURLSize = pCur - pURLStart;
-
- if ((uURLSize > 0) &&
- (HXR_OK == m_pCCF->CreateInstance(CLSID_IHXValues,
- (void**)&m_pValues)))
- {
- res = SetCStringPropertyCCFWithNullTerm(m_pValues,
- "url",
- (BYTE*)pURLStart,
- uURLSize,
- m_pCCF);
- }
-
- if (HXR_OK != res)
- {
- HX_RELEASE(m_pValues);
- }
-
- pCur++; // skip '\"'
- }
- }
-
- return res;
-}
-
-HX_RESULT
-C3gpAdaptationHeader::GetAdaptParam(REF(const char*) pCur, const char* pEnd)
-{
- HX_RESULT res = HXR_INVALID_PARAMETER;
-
- if (pCur && (pCur < pEnd) && (*pCur == ';'))
- {
- pCur++; // skip ';'
-
- const char* pNameStart = pCur;
-
- // Search for the '='
- for(;(pCur < pEnd) && *pCur && (*pCur != '='); pCur++)
- ;
-
- if (*pCur == '=')
- {
- // We found the '='
- UINT32 uNameSize = pCur - pNameStart;
- char* pName = new char[1 + uNameSize];
-
- if (pName)
- {
- // Copy name
- memcpy(pName, pNameStart, uNameSize);
-
- // null terminate
- pName[uNameSize] = '\0';
-
- pCur++; // skip '='
-
- if (IsIntParam(pName))
- {
- res = GetIntParam(pName, pCur, pEnd);
- }
- else
- {
- res = GetStringParam(pName, pCur, pEnd);
- }
-
- HX_VECTOR_DELETE(pName);
- }
- else
- {
- res = HXR_OUTOFMEMORY;
- }
- }
- }
-
- return res;
-}
-
-HX_RESULT C3gpAdaptationHeader::GetIntParam(const char* pName,
- REF(const char*) pCur,
- const char* pEnd)
-{
- HX_RESULT res = HXR_INVALID_PARAMETER;
-
- if (pName && pCur && (pCur < pEnd) && (*pCur >= '0') && (*pCur <= '9'))
- {
- const char* pIntStart = pCur;
-
- // Search for the end of the string or a ';' and make
- // sure that all the characters are digits
- for (;(pCur < pEnd) && *pCur && (*pCur != ';') &&
- (*pCur >= '0') && (*pCur <= '9'); pCur++)
- ;
-
- if (!*pCur || (*pCur == ';'))
- {
- UINT32 uDigitCount = pCur - pIntStart;
-
- if (uDigitCount <= 9)
- {
- char* pEnd = NULL;
- ULONG32 uTmp = strtoul(pIntStart, &pEnd, 10);
-
- if ((pEnd == pCur) && m_pValues)
- {
- res = m_pValues->SetPropertyULONG32(pName, uTmp);
- }
- }
- }
- }
-
- return res;
-}
-
-HX_RESULT C3gpAdaptationHeader::GetStringParam(const char* pName,
- REF(const char*) pCur,
- const char* pEnd)
-{
- HX_RESULT res = HXR_INVALID_PARAMETER;
-
- if (pName && pCur && (pCur < pEnd) && *pCur)
- {
- const char* pStrStart = pCur;
-
- // Search for the end of the string or a ';'
- for (;(pCur < pEnd) && *pCur && (*pCur != ';'); pCur++)
- ;
-
- if (!*pCur || (*pCur == ';') && m_pCCF && m_pValues)
- {
- res = SetCStringPropertyCCFWithNullTerm(m_pValues,
- pName,
- (BYTE*)pStrStart,
- pCur - pStrStart,
- m_pCCF);
- }
- }
-
- return res;
-}
-
-BOOL C3gpAdaptationHeader::IsIntParam(const char* pName)
-{
- return InKeyList(pName, zm_pIntParams,
- sizeof(zm_pIntParams) / sizeof(const char*));
-}
-
-BOOL C3gpAdaptationHeader::IsStringParam(const char* pName)
-{
- return InKeyList(pName, zm_pStringParams,
- sizeof(zm_pStringParams) / sizeof(const char*));
-}
-
-BOOL C3gpAdaptationHeader::InKeyList(const char* pName,
- const char** pList, UINT32 uSize)
-{
- BOOL bRet = FALSE;
-
- if (pName)
- {
- for (UINT32 i = 0; !bRet && (i < uSize); i++)
- {
- if (!strcasecmp(pName, pList[i]))
- {
- // We found a match
- bRet = TRUE;
- }
- }
- }
-
- return bRet;
-}
-
-bool C3gpAdaptationHeader::CompareIHXValues(IHXValues* pA, IHXValues* pB)
-{
- bool ret = true;
-
- if (pA && pB)
- {
- const char* pKey = NULL;
- IHXBuffer* pValueA = NULL;
-
- HX_RESULT res = pA->GetFirstPropertyCString(pKey, pValueA);
- while (ret && (HXR_OK == res))
- {
- IHXBuffer* pValueB = NULL;
-
- if ((HXR_OK != pB->GetPropertyCString(pKey, pValueB)) ||
- (pValueA->GetSize() != pValueB->GetSize()) ||
- (memcmp(pValueA->GetBuffer(), pValueB->GetBuffer(),
- pValueA->GetSize())))
- {
- ret = false;
- }
-
- HX_RELEASE(pValueA);
- HX_RELEASE(pValueB);
-
- res = pA->GetNextPropertyCString(pKey, pValueA);
- }
-
- if (ret)
- {
- ULONG32 ulValueA;
- HX_RESULT res = pA->GetFirstPropertyULONG32(pKey, ulValueA);
-
- while (ret && (HXR_OK == res))
- {
- ULONG32 ulValueB;
-
- if ((HXR_OK != pB->GetPropertyULONG32(pKey, ulValueB)) ||
- (ulValueA != ulValueB))
- {
- ret = false;
- }
-
- res = pA->GetNextPropertyULONG32(pKey, ulValueA);
- }
- }
- }
- else
- {
- ret = false;
- }
-
- return ret;
-}
-
-HX_RESULT C3gpAdaptationHeader::CopyIHXValues(IHXValues* pA)
-{
- HX_RESULT res = HXR_UNEXPECTED;
-
- HX_RELEASE(m_pValues);
-
- if (!pA)
- {
- res = HXR_OK;
- }
- else if (m_pCCF)
- {
- res = m_pCCF->CreateInstance(CLSID_IHXValues, (void**)&m_pValues);
-
- if (HXR_OK == res)
- {
- const char* pKey = NULL;
- IHXBuffer* pValue = NULL;
-
- HX_RESULT tmpRes = pA->GetFirstPropertyCString(pKey, pValue);
-
- while ((HXR_OK == res) && (HXR_OK == tmpRes))
- {
- res = SetCStringPropertyCCF(m_pValues,
- pKey,
- (const char*)pValue->GetBuffer(),
- m_pCCF);
- HX_RELEASE(pValue);
- tmpRes = pA->GetNextPropertyCString(pKey, pValue);
- }
-
- if (HXR_OK == res)
- {
- ULONG32 ulValue;
- HX_RESULT tmpRes = pA->GetFirstPropertyULONG32(pKey, ulValue);
-
- while ((HXR_OK == res) && (HXR_OK == tmpRes))
- {
- res = m_pValues->SetPropertyULONG32(pKey, ulValue);
- tmpRes = pA->GetNextPropertyCString(pKey, pValue);
- }
- }
- }
- }
-
- return res;
-}
-
-BOOL C3gpAdaptationHeader::AreValuesValid(IHXValues* pA)
-{
- BOOL bRet = TRUE;
-
- if (pA)
- {
- // Check for and verify URL property
- IHXBuffer* pURL = NULL;
-
- if ((HXR_OK != pA->GetPropertyCString("url", pURL)) ||
- (pURL->GetSize() <= 1) ||
- !IsValidURL((const char*)pURL->GetBuffer()))
- {
- // The url property must always be present
- bRet = FALSE;
- }
- HX_RELEASE(pURL);
-
- if (bRet)
- {
- // Check ULONG32 properties
- const char* pKey = NULL;
- ULONG32 ulValue;
- HX_RESULT res = pA->GetFirstPropertyULONG32(pKey, ulValue);
-
- while(bRet && (HXR_OK == res))
- {
- if (IsStringParam(pKey))
- {
- // This is a string parameter passed as a
- // ULONG32
- bRet = FALSE;
- }
-
- res = pA->GetNextPropertyULONG32(pKey, ulValue);
- }
- }
-
- if (bRet)
- {
- // Check CString properties
- const char* pKey = NULL;
- IHXBuffer* pValue = NULL;
- HX_RESULT res = pA->GetFirstPropertyCString(pKey, pValue);
-
- while(bRet && (HXR_OK == res))
- {
- if (IsIntParam(pKey))
- {
- // This is a ULONG32 parameter passed as a
- // string
- bRet = FALSE;
- }
-
- HX_RELEASE(pValue);
- res = pA->GetNextPropertyCString(pKey, pValue);
- }
- }
- }
-
- return bRet;
-}
-
-BOOL C3gpAdaptationHeader::IsValidURL(const char* pURL)
-{
- return TRUE;
-}
-
-HX_RESULT C3gpAdaptationHeader::AddURL(IHXBuffer* pBuf,
- IHXBuffer* pURL)
-{
- HX_RESULT res = HXR_INVALID_PARAMETER;
-
- if (pBuf && (pBuf->GetSize() == 0) && pURL)
- {
- // We need to add url=" to the beginning and an ending "
- UINT32 ulURLLength = pURL->GetSize() - 1 ; // w/o null terminator
- res = pBuf->SetSize(ulURLLength +
- 6 + // 6 is for the 'url="' and '"'
- 1); // null terminator
-
- if (HXR_OK == res)
- {
- char* pCur = (char*)pBuf->GetBuffer();
- memcpy(pCur, "url=\"", 5);
- pCur += 5;
-
- memcpy(pCur, (char*)pURL->GetBuffer(), ulURLLength);
- pCur += ulURLLength;
-
- *pCur++ = '\"';
- *pCur++ = '\0';
- }
- }
-
- return res;
-}
+{}
-HX_RESULT C3gpAdaptationHeader::AddStringParam(IHXBuffer* pBuf,
- const char* pKey,
- IHXBuffer* pValue)
+const char**
+C3gpAdaptationHeader::intParams() const
{
- HX_RESULT res = HXR_INVALID_PARAMETER;
-
- if (pBuf && pKey && pValue && (pValue->GetSize() > 1))
- {
- UINT32 uOldSize = pBuf->GetSize() - 1; // size w/o null terminator
- UINT32 uKeySize = strlen(pKey);
- UINT32 uValueSize = pValue->GetSize() - 1; // size w/o null terminator
-
- res = pBuf->SetSize(uOldSize + uKeySize + uValueSize +
- 3); // 3 for ';' & '=' & null terminator
-
- if (HXR_OK == res)
- {
- char* pCur = (char*)pBuf->GetBuffer() + uOldSize;
-
- *pCur++ = ';';
-
- memcpy(pCur, pKey, uKeySize);
- pCur += uKeySize;
-
- *pCur++ = '=';
-
- memcpy(pCur, pValue->GetBuffer(), uValueSize);
- pCur += uValueSize;
-
- *pCur++ = '\0';
- }
- }
-
- return res;
+ return zm_pIntParams;
}
-HX_RESULT C3gpAdaptationHeader::AddULONG32Param(IHXBuffer* pBuf,
- const char* pKey,
- ULONG32 ulValue)
+const char**
+C3gpAdaptationHeader::stringParams() const
{
- HX_RESULT res = HXR_INVALID_PARAMETER;
-
- if (pBuf && pKey)
- {
- char buf[10];
- buf[9] = '\0';
- int numberSize = snprintf(buf, 9, "%lu", ulValue);
-
- if (numberSize > 0)
- {
- UINT32 uOldSize = pBuf->GetSize(); // Includes a null terminator
- UINT32 uKeySize = strlen(pKey);
- res = pBuf->SetSize(uOldSize + uKeySize +
- numberSize + 2); // 2 for ';' & '='
-
- if (HXR_OK == res)
- {
- char* pCur = (char*)pBuf->GetBuffer() + uOldSize - 1;
-
- *pCur++ = ';';
-
- memcpy(pCur, pKey, uKeySize);
- pCur += uKeySize;
-
- *pCur++ = '=';
-
- memcpy(pCur, buf, numberSize);
- pCur += numberSize;
-
- *pCur++ = '\0';
- }
- }
- }
-
- return res;
+ return zm_pStringParams;
}
-
Index: Umakefil
===================================================================
RCS file: /cvsroot/protocol/rtsp/Umakefil,v
retrieving revision 1.14
diff -u -r1.14 Umakefil
--- Umakefil 9 Sep 2004 21:44:45 -0000 1.14
+++ Umakefil 12 Oct 2004 00:16:59 -0000
@@ -81,6 +81,7 @@
'rtspmsg.cpp', 'rtspmdsc.cpp',
'rtsppars.cpp', 'mhprop.cpp',
'servrsnd.cpp', '3gpadapthdr.cpp',
+ 'adapthdr.cpp', 'helixadapthdr.cpp',
'rateadaptinfo.cpp', 'ntsrcbufstats.cpp')
if (project.IsDefined('HELIX_FEATURE_HTTPCLOAK')):
Index: rateadaptinfo.cpp
===================================================================
RCS file: /cvsroot/protocol/rtsp/rateadaptinfo.cpp,v
retrieving revision 1.2
diff -u -r1.2 rateadaptinfo.cpp
--- rateadaptinfo.cpp 29 Jun 2004 16:58:54 -0000 1.2
+++ rateadaptinfo.cpp 12 Oct 2004 00:16:59 -0000
@@ -1,66 +1,93 @@
-/* ***** BEGIN LICENSE BLOCK *****
- * Source last modified: $Id: rateadaptinfo.cpp,v 1.2 2004/06/29 16:58:54 acolwell Exp $
- *
- * Portions Copyright (c) 1995-2004 RealNetworks, Inc. All Rights Reserved.
- *
- * The contents of this file, and the files included with this file,
- * are subject to the current version of the RealNetworks Public
- * Source License (the "RPSL") available at
- * http://www.helixcommunity.org/content/rpsl unless you have licensed
- * the file under the current version of the RealNetworks Community
- * Source License (the "RCSL") available at
- * http://www.helixcommunity.org/content/rcsl, in which case the RCSL
- * will apply. You may also obtain the license terms directly from
- * RealNetworks. You may not use this file except in compliance with
- * the RPSL or, if you have a valid RCSL with RealNetworks applicable
- * to this file, the RCSL. Please see the applicable RPSL or RCSL for
- * the rights, obligations and limitations governing use of the
- * contents of the file.
- *
- * This file is part of the Helix DNA Technology. RealNetworks is the
- * developer of the Original Code and owns the copyrights in the
- * portions it created.
- *
- * This file, and the files included with this file, is distributed
- * and made available on an 'AS IS' basis, WITHOUT WARRANTY OF ANY
- * KIND, EITHER EXPRESS OR IMPLIED, AND REALNETWORKS HEREBY DISCLAIMS
- * ALL SUCH WARRANTIES, INCLUDING WITHOUT LIMITATION, ANY WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, QUIET
- * ENJOYMENT OR NON-INFRINGEMENT.
- *
- * Technology Compatibility Kit Test Suite(s) Location:
- * http://www.helixcommunity.org/content/tck
- *
- * Contributor(s):
- *
+/* ***** BEGIN LICENSE BLOCK *****
+ * Source last modified: $Id:$
+ *
+ * Portions Copyright (c) 1995-2004 RealNetworks, Inc. All Rights Reserved.
+ *
+ * The contents of this file, and the files included with this file,
+ * are subject to the current version of the RealNetworks Public
+ * Source License (the "RPSL") available at
+ * http://www.helixcommunity.org/content/rpsl unless you have licensed
+ * the file under the current version of the RealNetworks Community
+ * Source License (the "RCSL") available at
+ * http://www.helixcommunity.org/content/rcsl, in which case the RCSL
+ * will apply. You may also obtain the license terms directly from
+ * RealNetworks. You may not use this file except in compliance with
+ * the RPSL or, if you have a valid RCSL with RealNetworks applicable
+ * to this file, the RCSL. Please see the applicable RPSL or RCSL for
+ * the rights, obligations and limitations governing use of the
+ * contents of the file.
+ *
+ * Alternatively, the contents of this file may be used under the
+ * terms of the GNU General Public License Version 2 or later (the
+ * "GPL") in which case the provisions of the GPL are applicable
+ * instead of those above. If you wish to allow use of your version of
+ * this file only under the terms of the GPL, and not to allow others
+ * to use your version of this file under the terms of either the RPSL
+ * or RCSL, indicate your decision by deleting the provisions above
+ * and replace them with the notice and other provisions required by
+ * the GPL. If you do not delete the provisions above, a recipient may
+ * use your version of this file under the terms of any one of the
+ * RPSL, the RCSL or the GPL.
+ *
+ * This file is part of the Helix DNA Technology. RealNetworks is the
+ * developer of the Original Code and owns the copyrights in the
+ * portions it created.
+ *
+ * This file, and the files included with this file, is distributed
+ * and made available on an 'AS IS' basis, WITHOUT WARRANTY OF ANY
+ * KIND, EITHER EXPRESS OR IMPLIED, AND REALNETWORKS HEREBY DISCLAIMS
+ * ALL SUCH WARRANTIES, INCLUDING WITHOUT LIMITATION, ANY WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, QUIET
+ * ENJOYMENT OR NON-INFRINGEMENT.
+ *
+ * Technology Compatibility Kit Test Suite(s) Location:
+ * http://www.helixcommunity.org/content/tck
+ *
+ * Contributor(s):
+ *
* ***** END LICENSE BLOCK ***** */
#include "rateadaptinfo.h"
#include "hxasm.h"
#include "hxcore.h"
#include "pckunpck.h"
#include "3gpadapthdr.h"
+#include "helixadapthdr.h"
// There is nothing magical about these constants. The just
// seemed like reasonable maximums
const ULONG32 Max3gpAdaptTargetTime = 60000; // in milliseconds
const ULONG32 Max3gpAdaptBufferSize = 3000000; // in bytes
+static const char z_3GPPAdaptationHdr[] = "3GPP-Adaptation";
+static const char z_HelixAdaptationHdr[] = "Helix-Adaptation";
+
+
+typedef enum {
+ ahtUnknown,
+ aht3GPP,
+ ahtHelix
+} AdaptationHeaderType;
+
class HXRAIStreamInfo
{
public:
HXRAIStreamInfo();
~HXRAIStreamInfo();
- HX_RESULT Init(UINT16 uStreamNumber,
+ HX_RESULT Init(AdaptationHeaderType type,
+ UINT16 uStreamNumber,
UINT32 ulReportFreq,
IHXValues* pHdr);
-
+
+ AdaptationHeaderType Type() const { return m_type;}
+ const char* HeaderName() const;
UINT16 StreamNumber() const {return m_uStreamNumber;}
UINT32 Get3gpBufferSize() const;
UINT32 Get3gpTargetTime() const;
UINT32 Get3gpReportFreq() const;
private:
+ AdaptationHeaderType m_type;
UINT16 m_uStreamNumber;
UINT32 m_ulBufferSize;
UINT32 m_ulTargetTime;
@@ -68,6 +95,7 @@
};
HXRAIStreamInfo::HXRAIStreamInfo() :
+ m_type(ahtUnknown),
m_uStreamNumber(0),
m_ulBufferSize(0),
m_ulTargetTime(0),
@@ -78,7 +106,8 @@
{}
HX_RESULT
-HXRAIStreamInfo::Init(UINT16 uStreamNumber,
+HXRAIStreamInfo::Init(AdaptationHeaderType type,
+ UINT16 uStreamNumber,
UINT32 ulReportFreq,
IHXValues* pHdr)
{
@@ -113,6 +142,7 @@
m_ulReportFreq = ulReportFreq;
m_uStreamNumber = uStreamNumber;
+ m_type = type;
res = HXR_OK;
}
@@ -120,6 +150,16 @@
return res;
}
+const char*
+HXRAIStreamInfo::HeaderName() const
+{
+ const char* pRet =
+ (aht3GPP == m_type) ? z_3GPPAdaptationHdr :
+ (ahtHelix == m_type) ? z_HelixAdaptationHdr :
+ NULL;
+ return pRet;
+}
+
UINT32 HXRAIStreamInfo::Get3gpBufferSize() const
{
return m_ulBufferSize;
@@ -193,39 +233,56 @@
IHXValues* pHdr)
{
HX_RESULT res = HXR_OK;
- ULONG32 ulReportFreq;
-
if (!pHdr)
{
res = HXR_POINTER;
}
- else if (m_pRateAdaptCtl && m_pOBSN &&
- (HXR_OK == pHdr->GetPropertyULONG32("3GPP-Adaptation-Support",
- ulReportFreq)))
+ else if (m_pRateAdaptCtl && m_pOBSN)
{
- HXRAIStreamInfo* pInfo = new HXRAIStreamInfo;
+ ULONG32 ulReportFreq = 0;
+ ULONG32 ulHelixAdaptation = 0;
+ AdaptationHeaderType hdrType = ahtUnknown;
- if (pInfo)
+ if (HXR_OK == pHdr->GetPropertyULONG32("Helix-Adaptation-Support",
+ ulHelixAdaptation) &&
+ (1 == ulHelixAdaptation))
+ {
+ ulReportFreq = 1;
+ hdrType = ahtHelix;
+ }
+ else if (HXR_OK == pHdr->GetPropertyULONG32("3GPP-Adaptation-Support",
+ ulReportFreq))
{
- res = pInfo->Init(uStreamNumber,
- ulReportFreq,
- pHdr);
+ hdrType = aht3GPP;
+ }
+
+ if (ahtUnknown != hdrType)
+ {
+ HXRAIStreamInfo* pInfo = new HXRAIStreamInfo;
- if ((HXR_OK == res) &&
- (!m_streamInfo.AddTail(pInfo)))
+ if (pInfo)
{
- res = HXR_OUTOFMEMORY;
+ res = pInfo->Init(hdrType,
+ uStreamNumber,
+ ulReportFreq,
+ pHdr);
+
+ if ((HXR_OK == res) &&
+ (!m_streamInfo.AddTail(pInfo)))
+ {
+ res = HXR_OUTOFMEMORY;
+ }
+
+ if (HXR_OK != res)
+ {
+ HX_DELETE(pInfo);
+ }
}
-
- if (HXR_OK != res)
+ else
{
- HX_DELETE(pInfo);
+ res = HXR_OUTOFMEMORY;
}
}
- else
- {
- res = HXR_OUTOFMEMORY;
- }
}
return res;
@@ -243,19 +300,27 @@
if (pInfo)
{
- IHXBuffer* pAdaptStr = Create3gpAdaptHdrs(pStreamURL,
- pInfo);
-
+ IHXBuffer* pAdaptStr = NULL;
+
+ if (aht3GPP == pInfo->Type())
+ {
+ pAdaptStr = Create3gpAdaptHdrs(pStreamURL, pInfo);
+ }
+ else if (ahtHelix == pInfo->Type())
+ {
+ pAdaptStr = CreateHelixAdaptHdrs(pStreamURL, pInfo);
+ }
+
if (pAdaptStr)
{
res = CreateValuesCCF(pHdrs, m_pCCF);
if (HXR_OK == res)
{
- res = pHdrs->SetPropertyCString("3GPP-Adaptation",
+ res = pHdrs->SetPropertyCString(pInfo->HeaderName(),
pAdaptStr);
}
-
+
if(HXR_OK != res)
{
HX_RELEASE(pHdrs);
@@ -285,9 +350,9 @@
// The value in the request must match the value in the
// response
- if ((HXR_OK == pReqHdrs->GetPropertyCString("3GPP-Adaptation",
+ if ((HXR_OK == pReqHdrs->GetPropertyCString(pInfo->HeaderName(),
pReqField)) &&
- (HXR_OK == pRespHdrs->GetPropertyCString("3GPP-Adaptation",
+ (HXR_OK == pRespHdrs->GetPropertyCString(pInfo->HeaderName(),
pRespField)) &&
(pReqField->GetSize() == pRespField->GetSize()) &&
(!memcmp(pReqField->GetBuffer(), pRespField->GetBuffer(),
@@ -404,6 +469,76 @@
{
res = pValues->SetPropertyULONG32("size",
ulBufferSize);
+ }
+
+ if (HXR_OK == res)
+ {
+ res = adaptHdr.SetValues(pValues);
+ }
+
+ if (HXR_OK == res)
+ {
+ res = adaptHdr.GetString(pRet);
+ }
+
+ HX_RELEASE(pValues);
+ }
+
+ return pRet;
+}
+
+IHXBuffer*
+CHXRateAdaptationInfo::CreateHelixAdaptHdrs(const char* pStreamURL,
+ HXRAIStreamInfo* pInfo)
+{
+ IHXBuffer* pRet = NULL;
+
+ if (pStreamURL && pInfo)
+ {
+ IHXValues* pValues = NULL;
+ CHelixAdaptationHeader adaptHdr;
+
+ HX_RESULT res = adaptHdr.Init(m_pCCF);
+ ULONG32 ulTargetTime =
+ pInfo->Get3gpTargetTime();
+ ULONG32 ulBufferSize =
+ pInfo->Get3gpBufferSize();
+
+ if (HXR_OK == res)
+ {
+ res = CreateValuesCCF(pValues, m_pCCF);
+ }
+
+ if (HXR_OK == res)
+ {
+ res = SetCStringPropertyCCF(pValues,
+ "url",
+ pStreamURL,
+ m_pCCF);
+ }
+
+ if (HXR_OK == res)
+ {
+ res = pValues->SetPropertyULONG32("target-time",
+ ulTargetTime);
+ }
+
+ if (HXR_OK == res)
+ {
+ res = pValues->SetPropertyULONG32("size",
+ ulBufferSize);
+ }
+
+ if (HXR_OK == res)
+ {
+ res = pValues->SetPropertyULONG32("stream-switch",
+ 1);
+ }
+
+ if (HXR_OK == res)
+ {
+ res = pValues->SetPropertyULONG32("feedback-level",
+ 1);
}
if (HXR_OK == res)
Index: rateadaptinfo.h
===================================================================
RCS file: /cvsroot/protocol/rtsp/rateadaptinfo.h,v
retrieving revision 1.2
diff -u -r1.2 rateadaptinfo.h
--- rateadaptinfo.h 29 Jun 2004 16:58:54 -0000 1.2
+++ rateadaptinfo.h 12 Oct 2004 00:16:59 -0000
@@ -1,40 +1,51 @@
-/* ***** BEGIN LICENSE BLOCK *****
- * Source last modified: $Id: rateadaptinfo.h,v 1.2 2004/06/29 16:58:54 acolwell Exp $
- *
- * Portions Copyright (c) 1995-2004 RealNetworks, Inc. All Rights Reserved.
- *
- * The contents of this file, and the files included with this file,
- * are subject to the current version of the RealNetworks Public
- * Source License (the "RPSL") available at
- * http://www.helixcommunity.org/content/rpsl unless you have licensed
- * the file under the current version of the RealNetworks Community
- * Source License (the "RCSL") available at
- * http://www.helixcommunity.org/content/rcsl, in which case the RCSL
- * will apply. You may also obtain the license terms directly from
- * RealNetworks. You may not use this file except in compliance with
- * the RPSL or, if you have a valid RCSL with RealNetworks applicable
- * to this file, the RCSL. Please see the applicable RPSL or RCSL for
- * the rights, obligations and limitations governing use of the
- * contents of the file.
- *
- * This file is part of the Helix DNA Technology. RealNetworks is the
- * developer of the Original Code and owns the copyrights in the
- * portions it created.
- *
- * This file, and the files included with this file, is distributed
- * and made available on an 'AS IS' basis, WITHOUT WARRANTY OF ANY
- * KIND, EITHER EXPRESS OR IMPLIED, AND REALNETWORKS HEREBY DISCLAIMS
- * ALL SUCH WARRANTIES, INCLUDING WITHOUT LIMITATION, ANY WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, QUIET
- * ENJOYMENT OR NON-INFRINGEMENT.
- *
- * Technology Compatibility Kit Test Suite(s) Location:
- * http://www.helixcommunity.org/content/tck
- *
- * Contributor(s):
- *
- * ***** END LICENSE BLOCK ***** */
-
+/* ***** BEGIN LICENSE BLOCK *****
+ * Source last modified: $Id:$
+ *
+ * Portions Copyright (c) 1995-2004 RealNetworks, Inc. All Rights Reserved.
+ *
+ * The contents of this file, and the files included with this file,
+ * are subject to the current version of the RealNetworks Public
+ * Source License (the "RPSL") available at
+ * http://www.helixcommunity.org/content/rpsl unless you have licensed
+ * the file under the current version of the RealNetworks Community
+ * Source License (the "RCSL") available at
+ * http://www.helixcommunity.org/content/rcsl, in which case the RCSL
+ * will apply. You may also obtain the license terms directly from
+ * RealNetworks. You may not use this file except in compliance with
+ * the RPSL or, if you have a valid RCSL with RealNetworks applicable
+ * to this file, the RCSL. Please see the applicable RPSL or RCSL for
+ * the rights, obligations and limitations governing use of the
+ * contents of the file.
+ *
+ * Alternatively, the contents of this file may be used under the
+ * terms of the GNU General Public License Version 2 or later (the
+ * "GPL") in which case the provisions of the GPL are applicable
+ * instead of those above. If you wish to allow use of your version of
+ * this file only under the terms of the GPL, and not to allow others
+ * to use your version of this file under the terms of either the RPSL
+ * or RCSL, indicate your decision by deleting the provisions above
+ * and replace them with the notice and other provisions required by
+ * the GPL. If you do not delete the provisions above, a recipient may
+ * use your version of this file under the terms of any one of the
+ * RPSL, the RCSL or the GPL.
+ *
+ * This file is part of the Helix DNA Technology. RealNetworks is the
+ * developer of the Original Code and owns the copyrights in the
+ * portions it created.
+ *
+ * This file, and the files included with this file, is distributed
+ * and made available on an 'AS IS' basis, WITHOUT WARRANTY OF ANY
+ * KIND, EITHER EXPRESS OR IMPLIED, AND REALNETWORKS HEREBY DISCLAIMS
+ * ALL SUCH WARRANTIES, INCLUDING WITHOUT LIMITATION, ANY WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, QUIET
+ * ENJOYMENT OR NON-INFRINGEMENT.
+ *
+ * Technology Compatibility Kit Test Suite(s) Location:
+ * http://www.helixcommunity.org/content/tck
+ *
+ * Contributor(s):
+ *
+ * ***** END LICENSE BLOCK ***** */
#ifndef RATEADAPTINFO_H
#define RATEADAPTINFO_H
@@ -79,6 +90,8 @@
void RemoveStreamInfo(UINT16 uStreamNumber);
IHXBuffer* Create3gpAdaptHdrs(const char* pStreamURL,
HXRAIStreamInfo* pInfo);
+ IHXBuffer* CreateHelixAdaptHdrs(const char* pStreamURL,
+ HXRAIStreamInfo* pInfo);
IUnknown* m_pContext;
IHXClientRateAdaptControl* m_pRateAdaptCtl;
Index: rtspclnt.cpp
===================================================================
RCS file: /cvsroot/protocol/rtsp/rtspclnt.cpp,v
retrieving revision 1.115
diff -u -r1.115 rtspclnt.cpp
--- rtspclnt.cpp 11 Oct 2004 16:57:53 -0000 1.115
+++ rtspclnt.cpp 12 Oct 2004 00:16:59 -0000
@@ -1960,6 +1960,48 @@
hresult = m_pContext->QueryInterface(IID_IHXCommonClassFactory,
(void**) &m_pCommonClassFactory);
+
+ // m_pSrcBufStats MUST be initialized before m_pRateAdaptInfo
+ // because it provides interfaces that m_pRateAdaptInfo needs
+ // for initialization.
+ if (HXR_OK == hresult)
+ {
+ HX_RELEASE(m_pSrcBufStats);
+ m_pSrcBufStats = new HXNetSourceBufStats(this);
+
+ if (m_pSrcBufStats)
+ {
+ m_pSrcBufStats->AddRef();
+
+ if (HXR_OK != m_pSrcBufStats->Init(m_pContext))
+ {
+ HX_RELEASE(m_pSrcBufStats);
+ }
+ }
+ else
+ {
+ hresult = HXR_OUTOFMEMORY;
+ }
+ }
+
+ if (HXR_OK == hresult)
+ {
+ m_pRateAdaptInfo = new CHXRateAdaptationInfo();
+
+ if (m_pRateAdaptInfo)
+ {
+ if (HXR_OK != m_pRateAdaptInfo->Init(pContext))
+ {
+ // This is not a critical error. It just means
+ // that we can't negotiate server rate adaptation.
+ HX_DELETE(m_pRateAdaptInfo);
+ }
+ }
+ else
+ {
+ hresult = HXR_OUTOFMEMORY;
+ }
+ }
if (HXR_OK != hresult)
{
@@ -2205,48 +2247,6 @@
HX_RELEASE(m_pUAProfDiff);
m_pPreferences->ReadPref("XWapProfileURI", m_pUAProfURI);
m_pPreferences->ReadPref("XWapProfileDiff", m_pUAProfDiff);
- }
-
- // m_pSrcBufStats MUST be initialized before m_pRateAdaptInfo
- // because it provides interfaces that m_pRateAdaptInfo needs
- // for initialization.
- if (HXR_OK == hresult)
- {
- HX_RELEASE(m_pSrcBufStats);
- m_pSrcBufStats = new HXNetSourceBufStats(this);
-
- if (m_pSrcBufStats)
- {
- m_pSrcBufStats->AddRef();
-
- if (HXR_OK != m_pSrcBufStats->Init(m_pContext))
- {
- HX_RELEASE(m_pSrcBufStats);
- }
- }
- else
- {
- hresult = HXR_OUTOFMEMORY;
- }
- }
-
- if (HXR_OK == hresult)
- {
- m_pRateAdaptInfo = new CHXRateAdaptationInfo();
-
- if (m_pRateAdaptInfo)
- {
- if (HXR_OK != m_pRateAdaptInfo->Init(pContext))
- {
- // This is not a critical error. It just means
- // that we can't negotiate server rate adaptation.
- HX_DELETE(m_pRateAdaptInfo);
- }
- }
- else
- {
- hresult = HXR_OUTOFMEMORY;
- }
}
#if defined(_MACINTOSH)
Index: pub/3gpadapthdr.h
===================================================================
RCS file: /cvsroot/protocol/rtsp/pub/3gpadapthdr.h,v
retrieving revision 1.1
diff -u -r1.1 3gpadapthdr.h
--- pub/3gpadapthdr.h 7 May 2004 17:35:50 -0000 1.1
+++ pub/3gpadapthdr.h 12 Oct 2004 00:16:59 -0000
@@ -1,30 +1,44 @@
/* ***** BEGIN LICENSE BLOCK *****
- * Version: RCSL 1.0/RPSL 1.0
+ * Source last modified: $Id:$
*
- * Portions Copyright (c) 1995-2002 RealNetworks, Inc. All Rights Reserved.
+ * Portions Copyright (c) 1995-2004 RealNetworks, Inc. All Rights Reserved.
*
- * The contents of this file, and the files included with this file, are
- * subject to the current version of the RealNetworks Public Source License
- * Version 1.0 (the "RPSL") available at
+ * The contents of this file, and the files included with this file,
+ * are subject to the current version of the RealNetworks Public
+ * Source License (the "RPSL") available at
* http://www.helixcommunity.org/content/rpsl unless you have licensed
- * the file under the RealNetworks Community Source License Version 1.0
- * (the "RCSL") available at http://www.helixcommunity.org/content/rcsl,
- * in which case the RCSL will apply. You may also obtain the license terms
- * directly from RealNetworks. You may not use this file except in
- * compliance with the RPSL or, if you have a valid RCSL with RealNetworks
- * applicable to this file, the RCSL. Please see the applicable RPSL or
- * RCSL for the rights, obligations and limitations governing use of the
+ * the file under the current version of the RealNetworks Community
+ * Source License (the "RCSL") available at
+ * http://www.helixcommunity.org/content/rcsl, in which case the RCSL
+ * will apply. You may also obtain the license terms directly from
+ * RealNetworks. You may not use this file except in compliance with
+ * the RPSL or, if you have a valid RCSL with RealNetworks applicable
+ * to this file, the RCSL. Please see the applicable RPSL or RCSL for
+ * the rights, obligations and limitations governing use of the
* contents of the file.
*
+ * Alternatively, the contents of this file may be used under the
+ * terms of the GNU General Public License Version 2 or later (the
+ * "GPL") in which case the provisions of the GPL are applicable
+ * instead of those above. If you wish to allow use of your version of
+ * this file only under the terms of the GPL, and not to allow others
+ * to use your version of this file under the terms of either the RPSL
+ * or RCSL, indicate your decision by deleting the provisions above
+ * and replace them with the notice and other provisions required by
+ * the GPL. If you do not delete the provisions above, a recipient may
+ * use your version of this file under the terms of any one of the
+ * RPSL, the RCSL or the GPL.
+ *
* This file is part of the Helix DNA Technology. RealNetworks is the
- * developer of the Original Code and owns the copyrights in the portions
- * it created.
+ * developer of the Original Code and owns the copyrights in the
+ * portions it created.
*
- * This file, and the files included with this file, is distributed and made
- * available on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
- * EXPRESS OR IMPLIED, AND REALNETWORKS HEREBY DISCLAIMS ALL SUCH WARRANTIES,
- * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, FITNESS
- * FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * This file, and the files included with this file, is distributed
+ * and made available on an 'AS IS' basis, WITHOUT WARRANTY OF ANY
+ * KIND, EITHER EXPRESS OR IMPLIED, AND REALNETWORKS HEREBY DISCLAIMS
+ * ALL SUCH WARRANTIES, INCLUDING WITHOUT LIMITATION, ANY WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, QUIET
+ * ENJOYMENT OR NON-INFRINGEMENT.
*
* Technology Compatibility Kit Test Suite(s) Location:
* http://www.helixcommunity.org/content/tck
@@ -35,63 +49,22 @@
#ifndef _3GP_ADAPT_HDR_H
#define _3GP_ADAPT_HDR_H
-#include "hxtypes.h"
-#include "hxcom.h"
-#include "ihxpckts.h"
-#include "ihxpckts.h"
-#include "hxccf.h"
+#include "adapthdr.h"
-class C3gpAdaptationHeader
+class C3gpAdaptationHeader : public CHXAdaptationHeader
{
public:
C3gpAdaptationHeader();
-
-
~C3gpAdaptationHeader();
- bool operator==(const C3gpAdaptationHeader& rhs);
-
- HX_RESULT Init(IUnknown* pContext);
-
- HX_RESULT Parse(const char* pBuf, UINT32 ulSize);
- HX_RESULT GetValues(REF(IHXValues*) pValues);
-
- HX_RESULT SetValues(IHXValues* pValues);
- HX_RESULT GetString(REF(IHXBuffer*) pBuf);
-
- HX_RESULT Copy(const C3gpAdaptationHeader& rhs);
+protected:
+ virtual const char** intParams() const;
+ virtual const char** stringParams() const;
private:
- // Hide copy constructor and assignment operator. If you want
- // to copy this object use the Copy() function
+ // Hide copy constructor and assignment operator.
C3gpAdaptationHeader(const C3gpAdaptationHeader& rhs);
C3gpAdaptationHeader& operator=(const C3gpAdaptationHeader& rhs);
-
- HX_RESULT GetURL(REF(const char*) pCur, const char* pEnd);
- HX_RESULT GetAdaptParam(REF(const char*) pCur, const char* pEnd);
- HX_RESULT GetIntParam(const char* pName, REF(const char*) pCur,
- const char* pEnd);
- HX_RESULT GetStringParam(const char* pName, REF(const char*) pCur,
- const char* pEnd);
-
- BOOL IsIntParam(const char* pName);
- BOOL IsStringParam(const char* pName);
- BOOL InKeyList(const char* pName, const char** pList, UINT32 uSize);
-
- bool CompareIHXValues(IHXValues* pA, IHXValues* pB);
- HX_RESULT CopyIHXValues(IHXValues* pA);
-
- BOOL AreValuesValid(IHXValues* pA);
- BOOL IsValidURL(const char* pURL);
-
- HX_RESULT AddURL(IHXBuffer* pBuf, IHXBuffer* pURL);
- HX_RESULT AddStringParam(IHXBuffer* pBuf,
- const char* pKey, IHXBuffer* pValue);
- HX_RESULT AddULONG32Param(IHXBuffer* pBuf,
- const char* pKey, ULONG32 ulValue);
-
- IHXCommonClassFactory* m_pCCF;
- IHXValues* m_pValues;
static const char* zm_pIntParams[];
static const char* zm_pStringParams[];
Index: test/3gpadapthdr_test.cpp
===================================================================
RCS file: /cvsroot/protocol/rtsp/test/3gpadapthdr_test.cpp,v
retrieving revision 1.1
diff -u -r1.1 3gpadapthdr_test.cpp
--- test/3gpadapthdr_test.cpp 7 May 2004 17:35:50 -0000 1.1
+++ test/3gpadapthdr_test.cpp 12 Oct 2004 00:16:59 -0000
@@ -41,6 +41,9 @@
#include "hxassert.h"
#include "chxminiccf.h"
#include "pckunpck.h"
+#include "ihxlist.h"
+#include "hxtbuf.h"
+#include "hxlistp.h"
C3gpAdaptationHeaderTest::C3gpAdaptationHeaderTest() :
m_pA(NULL),
@@ -131,14 +134,6 @@
HX_ASSERT(i < cmds.Nelements());
cmds[i++] = new HLXUnitTestCmdInfoDisp<C3gpAdaptationHeaderTest>(
this,
- "Copy",
- &C3gpAdaptationHeaderTest::HandleCopyCmd,
- 4);
-
- cmds.Resize(i + 1);
- HX_ASSERT(i < cmds.Nelements());
- cmds[i++] = new HLXUnitTestCmdInfoDisp<C3gpAdaptationHeaderTest>(
- this,
"CreateValues",
&C3gpAdaptationHeaderTest::HandleCreateValuesCmd,
1);
@@ -450,43 +445,6 @@
return ret;
}
-bool C3gpAdaptationHeaderTest::HandleCopyCmd(const UTVector<UTString>& info)
-{
- bool ret = false;
-
- C3gpAdaptationHeader* pSrc = GetHdr(info[1]);
- C3gpAdaptationHeader* pDest = GetHdr(info[2]);
- unsigned int expected;
-
- if (!UTParamUtil::GetUInt(info[3], expected))
- {
- DPRINTF(D_ERROR, ("Failed to convert parameter\n"));
- }
- else if (!pSrc)
- {
- DPRINTF(D_ERROR, ("Source ID invalid\n"));
- }
- else if (!pDest)
- {
- DPRINTF(D_ERROR, ("Destination ID invalid\n"));
- }
- else
- {
- HX_RESULT res = pDest->Copy(*pSrc);
-
- if ((unsigned int)res != expected)
- {
- DPRINTF(D_ERROR, ("Got %u, expected %u\n",
- res, expected));
- }
- else
- {
- ret = true;
- }
- }
-
- return ret;
-}
bool
C3gpAdaptationHeaderTest::HandleCreateValuesCmd(const UTVector<UTString>& info)
Index: test/3gpadapthdr_test.h
===================================================================
RCS file: /cvsroot/protocol/rtsp/test/3gpadapthdr_test.h,v
retrieving revision 1.1
diff -u -r1.1 3gpadapthdr_test.h
--- test/3gpadapthdr_test.h 7 May 2004 17:35:50 -0000 1.1
+++ test/3gpadapthdr_test.h 12 Oct 2004 00:16:59 -0000
@@ -57,7 +57,6 @@
bool HandleGetStringPropCmd(const UTVector<UTString>& info);
bool HandleGetULONG32PropCmd(const UTVector<UTString>& info);
bool HandleCompareCmd(const UTVector<UTString>& info);
- bool HandleCopyCmd(const UTVector<UTString>& info);
bool HandleCreateValuesCmd(const UTVector<UTString>& info);
bool HandleSetValuesCmd(const UTVector<UTString>& info);
bool HandleSetStringPropCmd(const UTVector<UTString>& info);
Index: test/t3gpadapthdr.in
===================================================================
RCS file: /cvsroot/protocol/rtsp/test/t3gpadapthdr.in,v
retrieving revision 1.1
diff -u -r1.1 t3gpadapthdr.in
--- test/t3gpadapthdr.in 7 May 2004 17:35:50 -0000 1.1
+++ test/t3gpadapthdr.in 12 Oct 2004 00:16:59 -0000
@@ -115,52 +115,6 @@
Parse A 0x00000000 "url=\"rtsp://foo.com/blah.rm\";size=42;target-time=3"
Compare 1
-# test Copy() w/ only a string
-Parse A 0x00000000 "url=\"rtsp://foo.com/blah.rm\""
-Construct B
-Init B 0x00000000
-GetValues B 0x80004005
-Compare 0
-Copy A B 0x00000000
-Compare 1
-GetValues A 0x00000000
-GetStringProp url 0x00000000 "rtsp://foo.com/blah.rm"
-GetValues B 0x00000000
-GetStringProp url 0x00000000 "rtsp://foo.com/blah.rm"
-
-# test Copy() w/ a string and an int
-Parse A 0x00000000 "url=\"rtsp://foo.com/blah.rm\";size=42"
-Construct B
-Init B 0x00000000
-Copy A B 0x00000000
-Compare 1
-GetValues A 0x00000000
-GetStringProp url 0x00000000 "rtsp://foo.com/blah.rm"
-GetValues B 0x00000000
-GetStringProp url 0x00000000 "rtsp://foo.com/blah.rm"
-
-# test self Copy()
-Parse A 0x00000000 "url=\"rtsp://foo.com/blah.rm\";size=42"
-GetValues A 0x00000000
-GetStringProp url 0x00000000 "rtsp://foo.com/blah.rm"
-GetULONG32Prop size 0x00000000 42
-Copy A A 0x00000000
-GetValues A 0x00000000
-GetStringProp url 0x00000000 "rtsp://foo.com/blah.rm"
-GetULONG32Prop size 0x00000000 42
-
-# test uninitialized Copy()
-Construct A
-Construct B
-Copy A B 0x00000000
-
-# test Copy() an uninitialized into an initialized
-GetValues A 0x80004005
-Init B 0x00000000
-Parse B 0x00000000 "url=\"rtsp://foo.com/blah.rm\";size=42"
-GetValues B 0x00000000
-Copy A B 0x00000000
-GetValues B 0x80004005
# test SetValues()
Construct A
-------------- next part --------------
A non-text attachment was scrubbed...
Name: adapthdr.cpp
Type: text/x-c++src
Size: 18840 bytes
Desc: not available
Url : http://lists.helixcommunity.org/pipermail/protocol-dev/attachments/20041011/88b3ba03/adapthdr-0002.bin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: helixadapthdr.cpp
Type: text/x-c++src
Size: 3231 bytes
Desc: not available
Url : http://lists.helixcommunity.org/pipermail/protocol-dev/attachments/20041011/88b3ba03/helixadapthdr-0002.bin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: adapthdr.h
Type: text/x-chdr
Size: 4278 bytes
Desc: not available
Url : http://lists.helixcommunity.org/pipermail/protocol-dev/attachments/20041011/88b3ba03/adapthdr-0003.bin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: helixadapthdr.h
Type: text/x-chdr
Size: 2993 bytes
Desc: not available
Url : http://lists.helixcommunity.org/pipermail/protocol-dev/attachments/20041011/88b3ba03/helixadapthdr-0003.bin