OSCL_EXPORT_REF PVMFStatus PVMFCreateKVPUtils::CreateKVPForWStringValue(PvmiKvp& aKeyVal,
        const char* aKeyTypeString,
        OSCL_wString& aValString,
        char* aMiscKeyParam,
        uint32 aMaxSize,
        uint32 aTruncateFlag)
{
    // Check parameters
    if (aKeyVal.key != NULL || aKeyTypeString == NULL || aValString.get_size() == 0)
    {
        return PVMFErrArgument;
    }

    aKeyVal.value.pWChar_value = NULL;
    aKeyVal.key = NULL;

    // Determine the length of strings
    uint32 keylen = oscl_strlen(aKeyTypeString) + 1; // for key string and ";"
    keylen += oscl_strlen(PVMI_KVPVALTYPE_STRING_CONSTCHAR); // for "valtype="
    keylen += oscl_strlen(PVMI_KVPVALTYPE_WCHARPTR_STRING_CONSTCHAR) + 1; // for "wchar*" and NULL terminator
    if (aMiscKeyParam)
    {
        keylen += oscl_strlen(aMiscKeyParam);
    }
    uint32 valuelen = aValString.get_size() + 1;

// Allocate memory for the strings
    int32 leavecode = 0, leavecode1 = 0;
    OSCL_TRY(leavecode,
             aKeyVal.key = OSCL_ARRAY_NEW(char, keylen););
int32 OsclNativeFile::Open(const oscl_wchar *filename, uint32 mode
                           , const OsclNativeFileParams& params
                           , Oscl_FileServer& fileserv)
{
    iMode = mode;
    iOpenFileHandle = false;

    OSCL_UNUSED_ARG(fileserv);
    OSCL_UNUSED_ARG(params);

    char openmode[4];
    OpenModeToString(mode, openmode);

#ifdef _UNICODE
    oscl_wchar convopenmode[4];
    if (0 == oscl_UTF8ToUnicode(openmode, oscl_strlen(openmode), convopenmode, 4))
    {
        return -1;
    }

    if ((iFile = _wfopen(filename, convopenmode)) == NULL)
    {
        return -1;
    }
#else
    //Convert to UTF8
    char convfilename[OSCL_IO_FILENAME_MAXLEN];
    if (0 == oscl_UnicodeToUTF8(filename, oscl_strlen(filename), convfilename, OSCL_IO_FILENAME_MAXLEN))
    {
        return -1;
    }

    return OpenFileOrSharedFd(convfilename, openmode);
#endif
}
Пример #3
0
OSCL_EXPORT_REF OSCL_FILEMGMT_ERR_TYPE oscl_chdir(const oscl_wchar *path)
{
    char convpathname[OSCL_IO_FILENAME_MAXLEN];
    if (0 == oscl_UnicodeToUTF8(path, oscl_strlen(path), convpathname, OSCL_IO_FILENAME_MAXLEN) &&
            oscl_strlen(path) != 0)
    {
        return OSCL_FILEMGMT_E_PATH_TOO_LONG;
    }
    return oscl_chdir(convpathname);
}
Пример #4
0
OSCL_EXPORT_REF OSCL_FILEMGMT_ERR_TYPE oscl_rename(const oscl_wchar *oldpath, const oscl_wchar *newpath)
{
    char oldconvpathname[OSCL_IO_FILENAME_MAXLEN];
    char newconvpathname[OSCL_IO_FILENAME_MAXLEN];
    if (0 == oscl_UnicodeToUTF8(oldpath, oscl_strlen(oldpath), oldconvpathname, OSCL_IO_FILENAME_MAXLEN) ||
            0 == oscl_UnicodeToUTF8(newpath, oscl_strlen(newpath), newconvpathname, OSCL_IO_FILENAME_MAXLEN))
    {
        return OSCL_FILEMGMT_E_PATH_TOO_LONG;
    }
    return oscl_rename(oldconvpathname, newconvpathname);
}
void PV2WayUtil::FindTestRange(cmd_line* command_line,
                               uint32 &aFirstTest,
                               uint32 &aLastTest,
                               int32 aTestLimit)
{
    //default is to run all tests.
    aFirstTest = 0;
    if (aTestLimit == 0)
    {
        aLastTest = MAX_324_TEST;
    }
    else
    {
        aLastTest = aTestLimit;
    }

    int testArgument = 0;
    char *iTestArgStr1 = NULL;
    char *iTestArgStr2 = NULL;
    bool cmdline_iswchar = command_line->is_wchar();
    //-test
    //if (iTestFound)
    OSCL_HeapString<OsclMemAllocator> argument = "-test";
    if (FindCmdArg(command_line, argument, testArgument))
    {
        // Convert to UTF8 if necessary
        if (cmdline_iswchar)
        {
            iTestArgStr1 = OSCL_ARRAY_NEW(char, 256);
            OSCL_TCHAR* cmd;
            command_line->get_arg(testArgument, cmd);
            if (cmd)
            {
                oscl_UnicodeToUTF8(cmd, oscl_strlen(cmd), iTestArgStr1, 256);
            }

            iTestArgStr2 = OSCL_ARRAY_NEW(char, 256);
            command_line->get_arg(testArgument + 1, cmd);
            if (cmd)
            {
                oscl_UnicodeToUTF8(cmd, oscl_strlen(cmd), iTestArgStr2, 256);
            }
        }
        else
        {
            command_line->get_arg(testArgument, iTestArgStr1);
            command_line->get_arg(testArgument + 1, iTestArgStr2);
        }

        //Pull out 2 integers...
        PV_atoi(iTestArgStr1, 'd', aFirstTest);
        PV_atoi(iTestArgStr2, 'd', aLastTest);
    }
bool
PVMFSocketPort::pvmiGetPortInPlaceDataProcessingInfoSync(const char* aFormatValType,
        PvmiKvp*& aKvp)
{
    /*
     * Create PvmiKvp for capability settings
     */
    aKvp = NULL;
    OsclMemAllocator alloc;
    uint32 strLen = oscl_strlen(aFormatValType) + 1;
    uint8* ptr = (uint8*)alloc.allocate(sizeof(PvmiKvp) + strLen);
    if (!ptr)
    {
        PVLOGGER_LOGMSG(PVLOGMSG_INST_MLDBG, iLogger, PVLOGMSG_ERR, (0, "PVMFSocketPort::pvmiGetPortInPlaceDataProcessingInfoSync: Error - No memory. Cannot allocate PvmiKvp"));
        return false;
    }
    aKvp = new(ptr) PvmiKvp;
    ptr += sizeof(PvmiKvp);
    aKvp->key = (PvmiKeyType)ptr;
    oscl_strncpy(aKvp->key, aFormatValType, strLen);
    aKvp->length = aKvp->capacity = strLen;

#if SNODE_ENABLE_UDP_MULTI_PACKET
    if (iTag == PVMF_SOCKET_NODE_PORT_TYPE_SOURCE)
        aKvp->value.bool_value = false;//for the multiple UDP recv feature
    else
#endif
        aKvp->value.bool_value = true;

    return true;
}
OSCL_EXPORT_REF bool
PVMFOMXDecPort::pvmiSetPortFormatSpecificInfoSync(OsclRefCounterMemFrag& aMemFrag, PvmiKeyType KvpKey)
{
    if ((iConnectedPort) &&
            (iTag == PVMF_OMX_DEC_NODE_PORT_TYPE_OUTPUT))
    {
        OsclAny* temp = NULL;
        iConnectedPort->QueryInterface(PVMI_CAPABILITY_AND_CONFIG_PVUUID, temp);

        PvmiCapabilityAndConfig *config = (PvmiCapabilityAndConfig*)temp;

        /*
         * Create PvmiKvp for capability settings
         */
        if ((config) && (aMemFrag.getMemFragSize() > 0))
        {
            PvmiKvp kvp;

            kvp.length = oscl_strlen(KvpKey) + 1; // +1 for \0
            kvp.key = KvpKey;
            if (kvp.key == NULL)
            {
                return false;
            }

            kvp.value.key_specific_value = (OsclAny*)(aMemFrag.getMemFragPtr());
            kvp.capacity = aMemFrag.getMemFragSize();
            PvmiKvp* retKvp = NULL; // for return value
            int32 err;
            OSCL_TRY(err, config->setParametersSync(NULL, &kvp, 1, retKvp););
bool
PVMFOMXEncPort::pvmiSetPortFormatSpecificInfoSync(OsclRefCounterMemFrag& aMemFrag)
{
    if ((iConnectedPort) &&
            (iTag == PVMF_OMX_ENC_NODE_PORT_TYPE_OUTPUT))
    {
        OsclAny* temp = NULL;
        iConnectedPort->QueryInterface(PVMI_CAPABILITY_AND_CONFIG_PVUUID, temp);
        PvmiCapabilityAndConfig *config = (PvmiCapabilityAndConfig*) temp;

        /*
         * Create PvmiKvp for capability settings
         */
        if ((config) && (aMemFrag.getMemFragSize() > 0))
        {
            OsclMemAllocator alloc;
            PvmiKvp kvp;
            kvp.key = NULL;
            kvp.length = oscl_strlen(PVMF_FORMAT_SPECIFIC_INFO_KEY) + 1; // +1 for \0
            kvp.key = (PvmiKeyType)alloc.ALLOCATE(kvp.length);
            if (kvp.key == NULL)
            {
                return false;
            }
            oscl_strncpy(kvp.key, PVMF_FORMAT_SPECIFIC_INFO_KEY, kvp.length);

            kvp.value.key_specific_value = (OsclAny*)(aMemFrag.getMemFragPtr());
            kvp.capacity = aMemFrag.getMemFragSize();
            kvp.length = aMemFrag.getMemFragSize();
            PvmiKvp* retKvp = NULL; // for return value
            int32 err;
            OSCL_TRY(err, config->setParametersSync(NULL, &kvp, 1, retKvp););
Пример #9
0
OSCL_EXPORT_REF  oscl_wchar* oscl_strstr(oscl_wchar* str1,  const oscl_wchar* str2)
{
    uint32 size = oscl_strlen(str1);
    uint32 size2 = oscl_strlen(str2);
    oscl_wchar* p = (oscl_wchar*) str1;
    while ((*p != '\0') && (size >= size2))
    {
        if (!oscl_strncmp(p, str2, size2))
            return p;
        else
        {
            p += 1;
            size -= 1;
        }
    }
    return 0;
}
void FindLogLevel(cmd_line* command_line, int32& loglevel, FILE* aFile)
{
    //default is verbose
    loglevel = PVLOGMSG_DEBUG;

    bool cmdline_iswchar = command_line->is_wchar();

    int count = command_line->get_count();

    // Search for the "-logerr"/"-logwarn" argument
    char *iSourceFind = NULL;
    if (cmdline_iswchar)
    {
        iSourceFind = new char[256];
    }

    // Go through each argument
    for (int iTestSearch = 0; iTestSearch < count; iTestSearch++)
    {
        // Convert to UTF8 if necessary
        if (cmdline_iswchar)
        {
            OSCL_TCHAR* cmd = NULL;
            command_line->get_arg(iTestSearch, cmd);
            oscl_UnicodeToUTF8(cmd, oscl_strlen(cmd), iSourceFind, 256);
        }
        else
        {
            iSourceFind = NULL;
            command_line->get_arg(iTestSearch, iSourceFind);
        }

        // Do the string compare
        if (oscl_strcmp(iSourceFind, "-help") == NULL)
        {
            fprintf(aFile, "Log level options. Default is debug level:\n");
            fprintf(aFile, "  -logerr\n");
            fprintf(aFile, "   Log at error level\n");
            fprintf(aFile, "  -logwarn\n");
            fprintf(aFile, "   Log at warning level\n\n");
        }
        else if (oscl_strcmp(iSourceFind, "-logerr") == NULL)
        {
            loglevel = PVLOGMSG_ERR;
        }
        else if (oscl_strcmp(iSourceFind, "-logwarn") == NULL)
        {
            loglevel = PVLOGMSG_WARNING;
        }
    }

    if (cmdline_iswchar)
    {
        delete[] iSourceFind;
        iSourceFind = NULL;
    }
}
        PVLoggerConfigFile(): iLogFileRead(false)
        {
            iFileServer.Connect();
            // Full path of pvlogger.ini is: SOURCENAME_PREPEND_STRING + pvlogger.ini
            oscl_strncpy(iLogFileName, SOURCENAME_PREPEND_STRING,
                         oscl_strlen(SOURCENAME_PREPEND_STRING) + 1);
            oscl_strcat(iLogFileName, "pvlogger.ini");
            oscl_memset(ibuffer, 0, sizeof(ibuffer));
            iAppenderType = 0;

        }
OSCL_EXPORT_REF int32 Oscl_FileServer::Oscl_DeleteFile(const oscl_wchar* filename)
{
    {
        //Convert to UTF8
        char convfilename[OSCL_IO_FILENAME_MAXLEN];
        if (0 == oscl_UnicodeToUTF8(filename, oscl_strlen(filename), convfilename, OSCL_IO_FILENAME_MAXLEN))
            return (-1);

        return unlink(convfilename);

    }
}
PVMFStatus PVMFAvcEncPort::AllocateKvp(PvmiKvp*& aKvp, PvmiKeyType aKey, int32 aNumParams)
{
    LOG_STACK_TRACE((0, "PVMFAvcEncPort::AllocateKvp"));
    uint8* buf = NULL;
    uint32 keyLen = oscl_strlen(aKey) + 1;
    int32 err = 0;

    OSCL_TRY(err,
             buf = (uint8*)iAlloc.allocate(aNumParams * (sizeof(PvmiKvp) + keyLen));
             if (!buf)
             OSCL_LEAVE(OsclErrNoMemory);
            );
Пример #14
0
OSCL_EXPORT_REF OSCL_FILEMGMT_ERR_TYPE oscl_getcwd(oscl_wchar *path, uint32 size)
{
    char convpathname[OSCL_IO_FILENAME_MAXLEN];
    if (oscl_getcwd(convpathname, size > OSCL_IO_FILENAME_MAXLEN ? OSCL_IO_FILENAME_MAXLEN : size) == OSCL_FILEMGMT_E_OK)
    {
        if (0 == oscl_UTF8ToUnicode(convpathname, oscl_strlen(convpathname), path, size) && oscl_strlen(convpathname) != 0)
        {
            return OSCL_FILEMGMT_E_PATH_TOO_LONG;
        }
        return OSCL_FILEMGMT_E_OK;
    }
    return OSCL_FILEMGMT_E_PATH_NOT_FOUND;
}
void FindMemMgmtRelatedCmdLineParams(cmd_line* command_line, bool& aPrintDetailedMemLeakInfo, FILE* aFile)
{
    aPrintDetailedMemLeakInfo = false;

    bool cmdline_iswchar = command_line->is_wchar();

    int count = command_line->get_count();

    // Search for the "-logerr"/"-logwarn" argument
    char *iSourceFind = NULL;
    if (cmdline_iswchar)
    {
        iSourceFind = new char[256];
    }

    // Go through each argument
    for (int iTestSearch = 0; iTestSearch < count; iTestSearch++)
    {
        // Convert to UTF8 if necessary
        if (cmdline_iswchar)
        {
            OSCL_TCHAR* cmd = NULL;
            command_line->get_arg(iTestSearch, cmd);
            oscl_UnicodeToUTF8(cmd, oscl_strlen(cmd), iSourceFind, 256);
        }
        else
        {
            iSourceFind = NULL;
            command_line->get_arg(iTestSearch, iSourceFind);
        }

        // Do the string compare
        if (oscl_strcmp(iSourceFind, "-help") == NULL)
        {
            fprintf(aFile, "Printing leak info option. Default is OFF:\n");
            fprintf(aFile, "  -leakinfo\n");
            fprintf(aFile, "   If there is a memory leak, prints out the memory leak information\n");
            fprintf(aFile, "   after all specified test cases have finished running.\n\n");
        }
        else if (oscl_strcmp(iSourceFind, "-leakinfo") == NULL)
        {
            aPrintDetailedMemLeakInfo = true;
        }
    }

    if (cmdline_iswchar)
    {
        delete[] iSourceFind;
        iSourceFind = NULL;
    }
}
Пример #16
0
OSCL_EXPORT_REF oscl_wchar* oscl_strcat(oscl_wchar* dest, const oscl_wchar* src)
{
    if (dest == NULL)
    {
        return NULL;
    }
    oscl_wchar* tmp = dest + oscl_strlen(dest);
    for (uint32 i = 0; *src != '\0'; i++)
    {
        *tmp++ = *src++;
    }
    *tmp = '\0';
    return dest;
}
OSCL_EXPORT_REF Oscl_Tag_Base::tag_base_type Oscl_Tag_Base::tag_ancestor(tag_base_type& dest, const tag_base_type& src) const
{
    // dest and src can be the same for this call.
    // This is optimal in some cases when the src string can be modified to be the ancestor string.
    if (dest != src)
    {
        tag_copy(dest, src);
    }

    tag_base_type endptr = dest + oscl_strlen(dest);
    while (*endptr != '.' && endptr != dest) endptr--;
    *endptr = '\0';
    return dest;
}
OSCL_EXPORT_REF int extract_string(const char * in_ptr, char *outstring, int maxsize)
{
    int len = 0;

    if (! outstring)
    {
        return 0;
    }

    in_ptr = skip_whitespace(in_ptr, in_ptr + oscl_strlen(in_ptr));

    for (; in_ptr && *in_ptr ; ++in_ptr)
    {

        if (*in_ptr == ' ' || *in_ptr == '\t' || *in_ptr == '\n' || *in_ptr == '\r')
        {
            // whitespace so stop copying
            break;
        }

        if (len < maxsize)
        {
            *outstring++ = *in_ptr;
        }
        else if (len == maxsize)
        {
            // too long so just terminate the string
            *(outstring - 1) = '\0';
        }
        ++len;

    }

    if (len < maxsize)
    {
        // terminate the string
        *outstring = '\0';
    }

    return len;
}
OSCL_EXPORT_REF bool compose_RTSP_string(char *str, unsigned int max_len,
        const RtspRangeType& range,
        int& len_used)
{
    len_used = 0;

    // first verify that there is something to do
    if (range.format == RtspRangeType::UNKNOWN_RANGE ||
            range.format == RtspRangeType::INVALID_RANGE)
    {
        // nothing to output but it is not an error
        return true;
    }

    const char *range_str = "Range: ";
    int length = oscl_strlen(range_str);
    // output the "Range: " string
    if ((int)max_len < length)
    {
        return false;
    }

    oscl_memcpy(str, range_str, length);

    str += length;
    len_used += length;
    max_len -= length;

    if (compose_range_string(str, max_len, range, length) != true)
    {
        len_used += length;
        return false;
    }

    len_used += length;

    return true;
}
Пример #20
0
//==============================================================================
// InitializeReporting                                           PUBLIC STATIC
//==============================================================================
//
OSCL_EXPORT_REF void
UT::CM::InitializeReporting
(
    const char* a_pszTestname,
    OSCL_HeapString<OsclMemAllocator>& a_filename,
    FILE* a_pFileStreamParent,
    FILE*& a_pFileStreamChild
)
{
    a_pFileStreamChild = a_pFileStreamParent;

    if (0 == a_pszTestname || 0 >= a_filename.get_size() || 0 == a_pFileStreamParent)
        return;

    Oscl_FileServer fs;
    fs.Connect();

    Oscl_File f;
    if (0 == f.Open(a_filename.get_cstr(), Oscl_File::MODE_READWRITE | Oscl_File::MODE_TEXT, fs))
    {
        _STRING xfr = xml_test_interpreter::unexpected_termination_interpretation(a_pszTestname);
        f.Write(xfr.c_str(), sizeof(char), oscl_strlen(xfr.c_str()));
        f.Close();
    }
    else
    {
        fprintf(a_pFileStreamParent, "ERROR: Failed to open XML test summary log file (%s).\n", a_filename.get_cstr());
    }

    fs.Close();

    OSCL_HeapString<OsclMemAllocator> outFilename(a_filename);
    outFilename += ".out";
    // open a new stream to file and return it to client
    a_pFileStreamChild = fopen(outFilename.get_cstr(), "w");
}
bool INetURI::parseURL(OSCL_String &aUrl8, OSCL_String &aSerAdd, int32 &aSerPort)
{
    OSCL_HeapString<OsclMemAllocator> tmpUrl8(aUrl8);

    typedef char mbchar;
    mbchar* aUrl = tmpUrl8.get_str();

    mbchar *server_ip_ptr = oscl_strstr(((mbchar*)aUrl), "//");
    if (server_ip_ptr == NULL) return false;
    server_ip_ptr += 2;

    /* Locate the IP address. */
    mbchar *server_port_ptr = oscl_strstr(server_ip_ptr, ":");
    mbchar *tmp_ptr = server_port_ptr;
    if (tmp_ptr == NULL) tmp_ptr = server_ip_ptr;
    mbchar *clip_name = oscl_strstr(tmp_ptr, "/");
    if (clip_name != NULL) *clip_name++ = '\0';

    /* Locate the port number if provided. */
    aSerPort = DEFAULT_HTTP_PORT_NUMBER;
    if ((server_port_ptr != NULL)  && (*(server_port_ptr + 1) != '/'))
    {
        *(server_port_ptr++) = '\0';
        uint32 atoi_tmp;
        if (PV_atoi(server_port_ptr, 'd', atoi_tmp)) aSerPort = atoi_tmp;
        else return false;
    }

    /* relocate the server IP address, either stop at ':' or '/' */
    mbchar *server_end_ptr = oscl_strstr(server_ip_ptr, "/");
    if (server_end_ptr) *server_end_ptr = '\0';

    OSCL_HeapString<OsclMemAllocator> tmpServerName(server_ip_ptr, oscl_strlen(server_ip_ptr));
    aSerAdd = tmpServerName;
    return true;
}
void pv_metadata_engine_test::PrintSupportedMetaDataKeys()
{

    uint32 i = 0;

    fprintf(file, "\n\nOutput for file: %s\n", iFileName);
    fprintf(file, "\nMetadata key list (count=%d):\n", iMetadataKeyList.size());

    for (i = 0; i < iMetadataKeyList.size(); ++i)
    {
        fprintf(file, "Key %d: %s\n", (i + 1), iMetadataKeyList[i].get_cstr());
    }

    fprintf(file, "\nMetadata value list (count=%d):\n", iMetadataValueList.size());

    for (i = 0; i < iMetadataValueList.size(); ++i)
    {
        fprintf(file, "Value %d:\n   Key string: %s\n", (i + 1), iMetadataValueList[i].key);

        switch (GetValTypeFromKeyString(iMetadataValueList[i].key))
        {
            case PVMI_KVPVALTYPE_CHARPTR:
                fprintf(file, "   Value:%s\n", iMetadataValueList[i].value.pChar_value);
                break;

            case PVMI_KVPVALTYPE_WCHARPTR:
            {
                // Assume string is in UCS-2 encoding so convert to UTF-8
                char tmpstr[65];
                oscl_UnicodeToUTF8(iMetadataValueList[i].value.pWChar_value,
                                   oscl_strlen(iMetadataValueList[i].value.pWChar_value), tmpstr, 65);
                tmpstr[64] = '\0';
                fprintf(file, "   Value(in UTF-8, first 64 chars):%s\n", tmpstr);
            }
            break;

            case PVMI_KVPVALTYPE_UINT32:
                fprintf(file, "   Value:%d\n", iMetadataValueList[i].value.uint32_value);
                break;

            case PVMI_KVPVALTYPE_INT32:
                fprintf(file, "   Value:%d\n", iMetadataValueList[i].value.int32_value);
                break;

            case PVMI_KVPVALTYPE_UINT8:
                fprintf(file, "   Value:%d\n", iMetadataValueList[i].value.uint8_value);
                break;

            case PVMI_KVPVALTYPE_FLOAT:
                fprintf(file, "   Value:%f\n", iMetadataValueList[i].value.float_value);
                break;

            case PVMI_KVPVALTYPE_DOUBLE:
                fprintf(file, "   Value:%f\n", iMetadataValueList[i].value.double_value);
                break;

            case PVMI_KVPVALTYPE_BOOL:
                if (iMetadataValueList[i].value.bool_value)
                {
                    fprintf(file, "   Value:true(1)\n");
                }
                else
                {
                    fprintf(file, "   Value:false(0)\n");
                }
                break;

            default:
                fprintf(file, "   Value: UNKNOWN VALUE TYPE\n");
                break;
        }

        fprintf(file, "   Length:%d  Capacity:%d\n", iMetadataValueList[i].length, iMetadataValueList[i].capacity);
    }

}
void pv_metadata_engine_test::ReadClipsFile()
{

    char* iClip;
    char ClipsFileName[255];
    int32 err = 0;

    Oscl_FileServer fileServer;
    err = fileServer.Connect();

    if (0 == err)
    {
        Oscl_File *ClipsFile = new Oscl_File;
        // Full path of ClipsFile is: SOURCENAME_PREPEND_STRING + pvlogger.ini
        oscl_strncpy(ClipsFileName, SOURCENAME_PREPEND_STRING,
                     oscl_strlen(SOURCENAME_PREPEND_STRING) + 1);
        oscl_strcat(ClipsFileName, "Clips.txt");

        printf("\nPath for Clips File is %s\n", ClipsFileName);

        err = ClipsFile->Open(ClipsFileName, Oscl_File::MODE_READ, fileServer);

        if (0 == err)
        {
            int len = 0;
            if (0 == ClipsFile->Seek(0, Oscl_File::SEEKSET))
            {
                while (!ClipsFile->EndOfFile())
                {
                    iClip = (char*)oscl_malloc(200);
                    iClip[0] = '\0';
                    fgetline(ClipsFile, iClip, 127);
                    len = oscl_strlen(iClip);
                    if (len == 0 || iClip[0] == '\n' || (iClip[0] == '\r' && iClip[1] == '\n'))
                    {
                        numOfClips--;
                        oscl_free(iClip);
                    }
                    else if (iClip[len-1] == '\n' && iClip[len-2] == '\r')
                    {
                        iClip[len-2] = '\0';
                        iClips.push_back(iClip);
                    }
                    else if (iClip[len-1] == '\n' && iClip[len-2] != '\r')
                    {
                        iClip[len-1] = '\0';
                        iClips.push_back(iClip);
                    }
                    else
                    {
                        iClip[len] = '\0';
                        iClips.push_back(iClip);
                    }

                    numOfClips++;

                }

                ClipsFile->Close();

                printf("\nClips are\n");
                for (it = iClips.begin(); it < iClips.end(); it++)
                {
                    printf("\n%s\n", *it);
                }

                it = iClips.begin();
                iClipFilePresent = true;

            }
        }
        delete(ClipsFile);
    }
    fileServer.Close();

}
void pv_metadata_engine_test::Run()
{
    int error = 0;

    switch (iState)
    {
        case STATE_CREATE:
        {
            iPVMEContainer.iCmdStatusObserver = this;
            iPVMEContainer.iInfoEventObserver = this;
            iPVMEContainer.iErrorEventObserver = this;
            iPVMEContainer.iMode = iMode;

            if (iPVMEContainer.iMode == PV_METADATA_ENGINE_THREADED_MODE)
            {
                //Configure the threadsafe queues that are used for engine
                //thread callbacks.
                iThreadSafeCommandQueue.Configure(this);
                iThreadSafeErrorQueue.Configure(this);
                iThreadSafeInfoQueue.Configure(this);

                iPVMEContainer.iSem.Create();

                iPVMEContainer.iAppenderType = iLoggerInfo.iAppenderType;
                iPVMEContainer.iLogfilename = iLoggerInfo.logfilename;
                iPVMEContainer.iLoggerConfigElements = iLoggerInfo.iLoggerConfigElements;
            }

            OSCL_TRY(error, PVMetadataEngineFactory::CreatePVMetadataEngine(iPVMEContainer));

            PVLOGGER_LOGMSG(PVLOGMSG_INST_PROF, iPerfLogger, PVLOGMSG_INFO,
                            (0, "PVMetadataEngineTest::Create Called ClockInMS=%d", OsclTickCount::TicksToMsec(OsclTickCount::TickCount())));

            if (error || iPVMEContainer.iPVMEInterface == NULL)
            {
                PVMEATB_TEST_IS_TRUE(false);
                iObserver->TestCompleted(*iTestCase);
            }
            else
            {
                iState = STATE_INIT;
                RunIfNotReady();
            }
        }
        break;


        case STATE_INIT:
        {

            PVLOGGER_LOGMSG(PVLOGMSG_INST_PROF, iPerfLogger, PVLOGMSG_INFO,
                            (0, "PVMetadataEngineTest::Init Issued ClockInMS=%d", OsclTickCount::TicksToMsec(OsclTickCount::TickCount())));

            iCurrentCmdId = iPVMEContainer.iPVMEInterface->Init((OsclAny*) & iContextObject);

        }
        break;

        case STATE_SETMETADATAKEYS:
        {
            ReadMetadataFile();
            ReadClipsFile();

            if (iClipFilePresent == false)
            {
                fprintf(file, "\nClip File Not Present \n");
                iState = STATE_RESET;
                RunIfNotReady();
            }

            else if (iMetadataKeyList.size() != 0)
            {
                PVMFStatus status;
                PVLOGGER_LOGMSG(PVLOGMSG_INST_PROF, iPerfLogger, PVLOGMSG_INFO,
                                (0, "PVMetadataEngineTest::SetMetadataKeys Issued ClockInMS=%d", OsclTickCount::TicksToMsec(OsclTickCount::TickCount())));
                status = iPVMEContainer.iPVMEInterface->SetMetaDataKeys(iMetadataKeyList);

                if (status == PVMFErrInvalidState)
                {
                    PVLOGGER_LOGMSG(PVLOGMSG_INST_PROF, iPerfLogger, PVLOGMSG_INFO,
                                    (0, "PVMetadataEngineTest::SetMetadataKeys called in wrong state"));
                }
                else
                {
                    iState = STATE_GETMETADATA;
                    RunIfNotReady();
                }
            }

            else
            {
                iState = STATE_GETMETADATA;
                RunIfNotReady();
            }
        }
        break;

        case STATE_GETMETADATA:
        {
            //If GetMetadata is being called second time in MultipleGetMetadataTest, we don't want these statements to execute again
            if (iDataSource == NULL)
            {
                // Create a player data source and add it
                iDataSource = new PVPlayerDataSourceURL;
            }

            OSCL_wHeapString<OsclMemAllocator> inputfilename;

            // Convert the source file name to UCS2 and extract the filename part
            PVMFFormatType iFileType;
            iFileName = *it;
            it++;
            GetSourceFormatType(iFileName, iFileType);

            oscl_UTF8ToUnicode(iFileName, oscl_strlen(iFileName), iTempWCharBuf, 512);
            wFileName.set(iTempWCharBuf, oscl_strlen(iTempWCharBuf));
            RetrieveFilename(wFileName.get_str(), inputfilename);

            printf("\nInput File Name is %s", iFileName);

            iDataSource->SetDataSourceURL(wFileName);
            iDataSource->SetDataSourceFormatType(iFileType);

            start_time = OsclTickCount::TicksToMsec(OsclTickCount::TickCount());

            PVLOGGER_LOGMSG(PVLOGMSG_INST_PROF, iPerfLogger, PVLOGMSG_INFO,
                            (0, "PVMetadataEngineTest::GetMetadata Issued ClockInMS = (%d)", start_time));


            OSCL_TRY(error, iCurrentCmdId = iPVMEContainer.iPVMEInterface->GetMetadata(*iDataSource, iMetadataValueList, (OsclAny*) & iContextObject));
            OSCL_FIRST_CATCH_ANY(error, PVMEATB_TEST_IS_TRUE(false); iState = STATE_RESET; RunIfNotReady());
        }

        break;

        case STATE_RESET:
        {
            PVLOGGER_LOGMSG(PVLOGMSG_INST_PROF, iPerfLogger, PVLOGMSG_INFO,
                            (0, "PVMetadataEngineTest::Reset Issued ClockInMS=%d", OsclTickCount::TicksToMsec(OsclTickCount::TickCount())));

            iCurrentCmdId = iPVMEContainer.iPVMEInterface->Reset((OsclAny*) & iContextObject);

        }
        break;

        case STATE_DELETE:
        {

            PVLOGGER_LOGMSG(PVLOGMSG_INST_PROF, iPerfLogger, PVLOGMSG_INFO,
                            (0, "PVMetadataEngineTest::Delete Called ClockInMS=%d", OsclTickCount::TicksToMsec(OsclTickCount::TickCount())));
            PVMFStatus status = PVMetadataEngineFactory::DeletePVMetadataEngine(iPVMEContainer);
            if (status != PVMFSuccess)
            {
                PVMEATB_TEST_IS_TRUE(false);
            }
            delete iDataSource;
            iDataSource = NULL;

            iFS.Close();

            if (iPVMEContainer.iMode == PV_METADATA_ENGINE_THREADED_MODE)
            {
                iPVMEContainer.iSem.Close();
            }




            PVLOGGER_LOGMSG(PVLOGMSG_INST_PROF, iPerfLogger, PVLOGMSG_INFO,
                            (0, "PVMetadataEngineTest::TotalNumClips=%d", numOfClips));

            PVLOGGER_LOGMSG(PVLOGMSG_INST_PROF, iPerfLogger, PVLOGMSG_INFO,
                            (0, "PVMetadataEngineTest::AverageGetMetaDataTimeInMS=%d", (AverageGetMetaDataTimeInMS / numOfClips)));

            PVLOGGER_LOGMSG(PVLOGMSG_INST_PROF, iPerfLogger, PVLOGMSG_INFO,
                            (0, "PVMetadataEngineTest::MaxGetMetaDataTime=%d", MaxGetMetaDataTime));

            PVLOGGER_LOGMSG(PVLOGMSG_INST_PROF, iPerfLogger, PVLOGMSG_INFO,
                            (0, "PVMetadataEngineTest::MinGetMetaDataTime=%d", MinGetMetaDataTime));

            iObserver->TestCompleted(*iTestCase);
        }
        break;

        default:
            break;

    }
}
void pv_metadata_engine_test::ReadMetadataFile()
{
    Oscl_File *MetadataFile = new Oscl_File;
    const int numKeys = 40;
    char arr[numKeys][MAX_LEN];
    char *keys[numKeys];
    int count = 0;
    char KeysFileName[255];
    int32 err = 0;

    Oscl_FileServer fileServer;
    err = fileServer.Connect();

    // Full path of MetadataFile is: SOURCENAME_PREPEND_STRING + pvlogger.ini
    oscl_strncpy(KeysFileName, SOURCENAME_PREPEND_STRING,
                 oscl_strlen(SOURCENAME_PREPEND_STRING) + 1);
    oscl_strcat(KeysFileName, "MetadataKeys.txt");

    printf("\nPath for Keys File is %s\n", KeysFileName);

    err = MetadataFile->Open(KeysFileName, Oscl_File::MODE_READ, fileServer);

    if (0 == err)
    {
        int ii = 0;
        int len = 0;
        if (0 == MetadataFile->Seek(0, Oscl_File::SEEKSET))
        {
            while (!MetadataFile->EndOfFile())
            {
                arr[ii][0] = '\0';
                fgetline(MetadataFile, arr[ii], MAX_LEN);
                len = oscl_strlen(arr[ii]);

                if (len == 0 || arr[ii][0] == '\n' || (arr[ii][0] == '\r' && arr[ii][1] == '\n'))
                {
                    ii--;
                }
                else if (arr[ii][len-1] == '\n' && arr[ii][len-2] == '\r')
                {
                    arr[ii][len-2] = '\0';
                    keys[ii] = arr[ii];
                }
                else if (arr[ii][len-1] == '\n' && arr[ii][len-2] != '\r')
                {
                    arr[ii][len-1] = '\0';
                    keys[ii] = arr[ii];
                }
                else
                {
                    arr[ii][len] = '\0';
                    keys[ii] = arr[ii];
                }

                ii++;
            }
        }

        MetadataFile->Close();

        count = ii - 1;

        printf("\nKeys are\n");
        for (int j = 0; j <= ii - 1; j++)
        {
            printf("\n%s", keys[j]);
        }

        for (int i = 0; i <= count; i++)
        {
            iMetadataKeyList.push_front(keys[i]);
        }

    }
    fileServer.Close();
    delete(MetadataFile);
}
Пример #26
0
//==============================================================================
// FinalizeReporting                                             PUBLIC STATIC
//==============================================================================
//
OSCL_EXPORT_REF void
UT::CM::FinalizeReporting
(
    const char* a_pszTestname,
    OSCL_HeapString<OsclMemAllocator> &a_filename,
    const test_result& a_tr,
    FILE* a_pFileStreamParent,
    FILE* a_pFileStreamChild
)
{
    if (0 == a_pFileStreamChild)
        return;

    //                     report the textual representation of the test results
    text_test_interpreter interp;
    _STRING rs = interp.interpretation(a_tr);
    fprintf(a_pFileStreamChild, "%s", rs.c_str());

    if (0 == a_pszTestname || 0 >= a_filename.get_size() || 0 == a_pFileStreamParent)
        return;

    _STRING strChild;

    fclose(a_pFileStreamChild);                              // close the stream

    OSCL_HeapString<OsclMemAllocator> outFilename(a_filename);
    outFilename += ".out";

    FILE* pFile = fopen(outFilename.get_cstr(), "rb");
    if (0 == pFile)
        fprintf(a_pFileStreamParent, "ERROR: Failed to open file (%s) for capturing test output!\n", outFilename.get_cstr());
    else
    {
        fseek(pFile, 0, SEEK_END);
        long lSize = ftell(pFile);
        rewind(pFile);
        char* buffer = new char[lSize];
        fread(buffer, 1, lSize, pFile);
        strChild = _STRING(buffer, lSize);
        fprintf(a_pFileStreamParent, "%s", strChild.c_str()); // send the captured output back out the parent stream
        delete [] buffer;
        fclose(pFile);
    }

    Oscl_FileServer fs;
    fs.Connect();

    Oscl_File f;
    if (0 == f.Open(a_filename.get_str(), Oscl_File::MODE_READWRITE | Oscl_File::MODE_TEXT, fs))
    {
        _STRING xfr = xml_test_interpreter::interpretation(a_tr, a_pszTestname, &strChild);
        fprintf(a_pFileStreamParent, "\nWrote xml-formatted test results to file: %s\n", a_filename.get_cstr());
        f.Write(xfr.c_str(), sizeof(char), oscl_strlen(xfr.c_str()));
        f.Close();
    }
    else
    {
        fprintf(a_pFileStreamParent, "\nERROR: Failed to open file (%s) for xml-formatted test results\n", a_filename.get_cstr());
    }

    fs.Close();
}
/* ======================================================================== */
OSCL_EXPORT_REF bool PV_atoi(const char *buf, const char new_format, uint32& value)
{
    return PV_atoi(buf, new_format, oscl_strlen(buf), value);
}
PVMFStatus PVMFFileOutputNode::GetConfigParameter(PvmiKvp*& aParameters, int& aNumParamElements, int32 aIndex, PvmiKvpAttr aReqattr)
{
    PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_STACK_TRACE, (0, "PVMFFileOutputNode::GetConfigParameter() In"));

    aNumParamElements = 0;

    // Allocate memory for the KVP
    aParameters = (PvmiKvp*)oscl_malloc(sizeof(PvmiKvp));
    if (aParameters == NULL)
    {
        PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_ERR, (0, "PVMFFileOutputNode::GetConfigParameter() Memory allocation for KVP failed"));
        return PVMFErrNoMemory;
    }
    oscl_memset(aParameters, 0, sizeof(PvmiKvp));
    // Allocate memory for the key string in KVP
    PvmiKeyType memblock = (PvmiKeyType)oscl_malloc(FILEOUTPUTCONFIG_KEYSTRING_SIZE * sizeof(char));
    if (NULL == memblock)
    {
        oscl_free(aParameters);
        PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_ERR, (0, "PVMFFileOutputNode::GetConfigParameter() Memory allocation for key string failed"));
        return PVMFErrNoMemory;
    }
    oscl_strset(memblock, 0, FILEOUTPUTCONFIG_KEYSTRING_SIZE * sizeof(char));
    // Assign the key string buffer to KVP
    aParameters[0].key = memblock;

    // Copy the key string
    oscl_strncat(aParameters[0].key, _STRLIT_CHAR("x-pvmf/file/output/"), 21);
    oscl_strncat(aParameters[0].key, FileOutputNodeConfig_BaseKeys[aIndex].iString, oscl_strlen(FileOutputNodeConfig_BaseKeys[aIndex].iString));
    oscl_strncat(aParameters[0].key, _STRLIT_CHAR(";type=value;valtype="), 20);
    switch (FileOutputNodeConfig_BaseKeys[aIndex].iValueType)
    {
        case PVMI_KVPVALTYPE_BITARRAY32:
            oscl_strncat(aParameters[0].key, _STRLIT_CHAR(PVMI_KVPVALTYPE_BITARRAY32_STRING), oscl_strlen(PVMI_KVPVALTYPE_BITARRAY32_STRING));
            break;

        case PVMI_KVPVALTYPE_KSV:
            oscl_strncat(aParameters[0].key, _STRLIT_CHAR(PVMI_KVPVALTYPE_KSV_STRING), oscl_strlen(PVMI_KVPVALTYPE_KSV_STRING));
            break;

        case PVMI_KVPVALTYPE_BOOL:
            oscl_strncat(aParameters[0].key, _STRLIT_CHAR(PVMI_KVPVALTYPE_BOOL_STRING), oscl_strlen(PVMI_KVPVALTYPE_BOOL_STRING));
            break;

        case PVMI_KVPVALTYPE_INT32:
            if (aReqattr == PVMI_KVPATTR_CUR)
            {
                oscl_strncat(aParameters[0].key, _STRLIT_CHAR(PVMI_KVPVALTYPE_INT32_STRING), oscl_strlen(PVMI_KVPVALTYPE_RANGE_UINT32_STRING));
            }
            break;
        case PVMI_KVPVALTYPE_UINT32:
        default:
            if (PVMI_KVPATTR_CAP == aReqattr)
            {
                oscl_strncat(aParameters[0].key, _STRLIT_CHAR(PVMI_KVPVALTYPE_RANGE_UINT32_STRING), oscl_strlen(PVMI_KVPVALTYPE_RANGE_UINT32_STRING));
            }
            else
            {
                oscl_strncat(aParameters[0].key, _STRLIT_CHAR(PVMI_KVPVALTYPE_UINT32_STRING), oscl_strlen(PVMI_KVPVALTYPE_UINT32_STRING));
            }
            break;
    }
    aParameters[0].key[FILEOUTPUTCONFIG_KEYSTRING_SIZE-1] = 0;

    // Copy the requested info
    switch (aIndex)
    {
        case PARAMETER1:    // "parameter1"
            if (PVMI_KVPATTR_CUR == aReqattr)
            {
                // Return current value
                // get the parameter value here
            }
            else if (PVMI_KVPATTR_DEF == aReqattr)
            {
                // return default
            }
            else
            {
                // Return capability
            }
            break;

        case PARAMETER2:    // "parameter2"
            if (PVMI_KVPATTR_CUR == aReqattr)
            {
                // Return current value
                // get the parameter value here

            }
            else if (PVMI_KVPATTR_DEF == aReqattr)
            {
                // return default
            }
            else
            {
                // Return capability
            }
            break;

        default:
            // Invalid index
            oscl_free(aParameters[0].key);
            oscl_free(aParameters);
            PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_ERR, (0, "PVMFFileOutputNode::GetConfigParameter() Invalid index to file output node parameter"));
            return PVMFErrNotSupported;
    }

    aNumParamElements = 1;

    PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_STACK_TRACE, (0, "PVMFFileOutputNode::GetConfigParameter() Out"));
    return PVMFSuccess;
}
OSCL_EXPORT_REF bool
RTSPOutgoingMessage::compose()
{



    // compose the first line
    //
    switch (msgType)
    {
        case RTSPResponseMsg:

        {
            // RTSP version
            //
            oscl_memcpy(fullRequestBuffer, RTSPVersionString, RTSPVersionString_len);
            fullRequestBufferSpace += RTSPVersionString_len;

            *(fullRequestBufferSpace++) = ' ';


            // Status code
            //
            oscl_snprintf(fullRequestBufferSpace, RTSP_MAX_FULL_REQUEST_SIZE - 1, "%d", statusCode);

            // resync the pointer and size used
            fullRequestBufferSizeUsed = oscl_strlen(fullRequestBufferSpace);
            fullRequestBufferSpace += fullRequestBufferSizeUsed;
            *(fullRequestBufferSpace++) = ' ';
            fullRequestBufferSizeUsed += 1 + RTSPVersionString_len + 1;

            if (0 != reasonString.length())
            {
                // user specified his own string
                //
                oscl_memcpy(fullRequestBufferSpace, reasonString.c_str(),
                            reasonString.length());

                fullRequestBufferSpace += reasonString.length();
                fullRequestBufferSizeUsed += reasonString.length();
            }
            else
            {
                StrPtrLen  realReasonString ;

                // user wants the built-in default
                //
                switch (statusCode)
                {
                    case CodeContinue:

                        realReasonString =  RtspReasonStringContinue;

                        break;

                    case CodeOK:

                        realReasonString =  RtspReasonStringOK;

                        break;

                    case CodeCreated:
                        realReasonString =  RtspReasonStringCreated;

                        break;

                    case CodeLowOnStorageSpace:
                        realReasonString =  RtspReasonStringLowOnStorageSpace;

                        break;

                    case CodeMultipleChoices:
                        realReasonString =  RtspReasonStringMultipleChoices;

                        break;

                    case CodeMovedPermanently:
                        realReasonString =  RtspReasonStringMovedPermanently;

                        break;

                    case CodeMovedTemporarily:
                        realReasonString =  RtspReasonStringMovedTemporarily;

                        break;

                    case CodeSeeOther:
                        realReasonString =  RtspReasonStringSeeOther;

                        break;

                    case CodeNotModified:
                        realReasonString =  RtspReasonStringNotModified;

                        break;

                    case CodeUseProxy:
                        realReasonString =  RtspReasonStringUseProxy;

                        break;

                    case CodeBadRequest:
                        realReasonString =  RtspReasonStringBadRequest;

                        break;

                    case CodeUnauthorized:
                        realReasonString =  RtspReasonStringUnauthorized;

                        break;

                    case CodePaymentRequired:
                        realReasonString =  RtspReasonStringPaymentRequired;

                        break;

                    case CodeForbidden:
                        realReasonString =  RtspReasonStringForbidden;

                        break;

                    case CodeNotFound:
                        realReasonString =  RtspReasonStringNotFound;

                        break;

                    case CodeMethodNotAllowed:
                        realReasonString =  RtspReasonStringMethodNotAllowed;

                        break;

                    case CodeNotAcceptable:
                        realReasonString =  RtspReasonStringNotAcceptable;

                        break;

                    case CodeProxyAuthenticationRequired:
                        realReasonString =
                            RtspReasonStringProxyAuthenticationRequired;

                        break;

                    case CodeRequestTimeOut:
                        realReasonString =  RtspReasonStringRequestTimeOut;

                        break;

                    case CodeGone:
                        realReasonString =  RtspReasonStringGone;

                        break;

                    case CodeLengthRequired:
                        realReasonString =  RtspReasonStringLengthRequired;

                        break;

                    case CodePreconditionFailed:
                        realReasonString =  RtspReasonStringPreconditionFailed;

                        break;

                    case CodeRequestEntityTooLarge:
                        realReasonString =
                            RtspReasonStringRequestEntityTooLarge;

                        break;

                    case CodeRequestURITooLarge:
                        realReasonString =  RtspReasonStringRequestURITooLarge;

                        break;

                    case CodeUnsupportedMediaType:
                        realReasonString =  RtspReasonStringUnsupportedMediaType;

                        break;

                    case CodeSessionNotFound:
                        realReasonString =  RtspReasonStringSessionNotFound;

                        break;

                    case CodeMethodNotValidInThisState:
                        realReasonString =  RtspReasonStringMethodNotValidInThisState;

                        break;

                    case CodeHeaderFieldNotValidForResource:
                        realReasonString =
                            RtspReasonStringHeaderFieldNotValidForResource;

                        break;

                    case CodeInvalidRange:
                        realReasonString =  RtspReasonStringInvalidRange;

                        break;

                    case CodeParameterIsReadOnly:
                        realReasonString =  RtspReasonStringParameterIsReadOnly;

                        break;

                    case CodeAggregateOperationNotAllowed:
                        realReasonString =
                            RtspReasonStringAggregateOperationNotAllowed;

                        break;

                    case CodeOnlyAggregateOperationAllowed:
                        realReasonString =
                            RtspReasonStringOnlyAggregateOperationAllowed;

                        break;

                    case CodeUnsupportedTransport:
                        realReasonString =  RtspReasonStringUnsupportedTransport;

                        break;

                    case CodeDestinationUnreachable:
                        realReasonString =  RtspReasonStringDestinationUnreachable;

                        break;

                    case CodeUnsupportedClient:
                        realReasonString =  RtspReasonStringUnsupportedClient;

                        break;

                    case CodeInternalServerError:
                        realReasonString =  RtspReasonStringInternalServerError;

                        break;

                    case CodeNotImplemented:
                        realReasonString =  RtspReasonStringNotImplemented;

                        break;

                    case CodeBadGateway:
                        realReasonString =  RtspReasonStringBadGateway;

                        break;

                    case CodeServiceUnavailable:
                        realReasonString =  RtspReasonStringServiceUnavailable;

                        break;

                    case CodeGatewayTimeout:
                        realReasonString =  RtspReasonStringGatewayTimeout;

                        break;

                    case CodeRTSPVersionNotSupported:
                        realReasonString =  RtspReasonStringRTSPVersionNotSupported;

                        break;

                    case CodeOptionNotSupported:
                        realReasonString =  RtspReasonStringOptionNotSupported;

                        break;

                    case CodeParameterNotUnderstood:
                        realReasonString =  RtspReasonStringParameterNotUnderstood;

                        break;

                    default:
                        // no string was found, since code is unknown...
                        ;;;
                }

                if (realReasonString.length())
                {
                    oscl_memcpy(fullRequestBufferSpace, realReasonString.c_str(), realReasonString.length());

                    fullRequestBufferSpace += realReasonString.length();
                    fullRequestBufferSizeUsed += realReasonString.length();
                }
            }

            break;
        }


        case RTSPRequestMsg:
        {
            if (METHOD_BINARY_DATA == method)
            { // it's interleaved stuff

                // leading dollar
                *(fullRequestBufferSpace++) = CHAR_DOLLAR;

                // 8-bit channel-id from the content-type
                *(fullRequestBufferSpace++) = contentType.c_str()[0];

                // 16-bit content length, in network byte order
                *(fullRequestBufferSpace++) = char((contentLength & 0xFF00) >> 8);
                *(fullRequestBufferSpace++) = char((contentLength & 0xFF));

                *fullRequestBufferSpace = CHAR_NULL;

                fullRequestBufferSizeUsed = 4;

                fullRequestPLS = fullRequestBuffer;

                return true;
            }

            // okay, it's a normal request

            // do the method
            if (method < 0 || method >= METHOD_NUM_ENTRIES)
            { // method unknown
                return false;
            }

            uint32 method_strlen = oscl_strlen(RtspMethodStringPLSS[method]);
            oscl_memcpy(fullRequestBufferSpace,
                        RtspMethodStringPLSS[method],
                        method_strlen
                       );
            fullRequestBufferSpace += method_strlen;
            *(fullRequestBufferSpace++) = CHAR_SPACE;
            fullRequestBufferSizeUsed += method_strlen + 1;

            // do the URI

            oscl_memcpy(fullRequestBufferSpace,
                        originalURI.c_str(),
                        originalURI.length()
                       );
            fullRequestBufferSpace += originalURI.length();
            *(fullRequestBufferSpace++) = CHAR_SPACE;
            fullRequestBufferSizeUsed += originalURI.length() + 1;

            // do the RTSP version
#ifdef SIMPLE_HTTP_SUPPORT
            if ((method == METHOD_GET) || (method == METHOD_POST))
            {
                oscl_memcpy(fullRequestBufferSpace,
                            HTTPVersion_1_0_String,
                            HTTPVersionString_len
                           );
            }
            else
#endif
                oscl_memcpy(fullRequestBufferSpace,
                            RTSPVersionString,
                            RTSPVersionString_len
                           );
            fullRequestBufferSpace += RTSPVersionString_len;
            fullRequestBufferSizeUsed += RTSPVersionString_len;

            break;
        }

        default:
        {	// cannot encode an unknown type of message

            return false;
        }
    }
/* ======================================================================== */
OSCL_EXPORT_REF bool PV_atof(const char *buf, OsclFloat& value)
{
    return PV_atof(buf, oscl_strlen(buf), value);
}