void PlayerDriver::handleGetDurationComplete(PlayerGetDuration* cmd)
{
    cmd->set(-1);

    if (mMetaValueList.empty())
        return;

    MediaClockConverter mcc;

    for (uint32 i = 0; i < mMetaValueList.size(); ++i) {
        // Search for the duration
        char* substr=oscl_strstr(mMetaValueList[i].key, _STRLIT_CHAR("duration;valtype=uint32;timescale="));
        if (substr!=NULL) {
            uint32 timescale=1000;
            if (PV_atoi((substr+34), 'd', timescale) == false) {
                // Retrieving timescale failed so default to 1000
                timescale=1000;
            }
            uint32 duration = mMetaValueList[i].value.uint32_value;
            if (duration > 0 && timescale > 0) {
            //set the timescale
               mcc.set_timescale(timescale);
            //set the clock to the duration as per the timescale
               mcc.set_clock(duration,1);
            //convert to millisec
               cmd->set(mcc.get_converted_ts(1000));
            }
        }
    }
}
// given sample is added to interleave buffer and
// sample parameters stored in parameter vectors
bool
PVA_FF_InterLeaveBuffer::addSampleToInterLeaveBuffer(
    Oscl_Vector < OsclMemoryFragment,
    OsclMemAllocator > & fragmentList,
    uint32 size, uint32 ts, uint8 flags, int32 index)
{
    // temporary variables
    uint32 bytesWritten = 0;
    uint32 length = 0;
    uint32 ii = 0;
    OsclBinIStreamBigEndian stream;

    if (_interLeaveBuffer != NULL)
    {
        uint8* currPtr = _interLeaveBuffer + _currInterLeaveBufferSize;

        if (checkInterLeaveBufferSpace(size))
        {
            if (_mediaType == MEDIA_TYPE_VISUAL && _codecType == CODEC_TYPE_AVC_VIDEO)
            {
                for (ii = 0; ii < fragmentList.size(); ii++)
                {
                    // read NAL length in Big Endian format
                    stream.Attach((OsclAny*) &(fragmentList[ii].len), 4);
                    stream >> length;

                    // compose nal length in two bytes
                    oscl_memcpy((OsclAny*)(currPtr + bytesWritten), ((uint8*)&length), 4);

                    // write NAL uint
                    oscl_memcpy((OsclAny*)(currPtr + bytesWritten + 4), (OsclAny*)fragmentList[ii].ptr, fragmentList[ii].len);
                    bytesWritten += (fragmentList[ii].len + 4);
                }
            }
            else
            {
                for (ii = 0; ii < fragmentList.size(); ii++)
                {
                    oscl_memcpy(currPtr + bytesWritten, fragmentList[ii].ptr, fragmentList[ii].len);
                    bytesWritten += fragmentList[ii].len;
                }
            }

            _currInterLeaveBufferSize += size;
            _lastInterLeaveBufferTS = ts;

            //Store meta data params
            _pTimeStampVec->push_back(ts);
            _pSampleSizeVec->push_back(size);
            _pSampleFlagsVec->push_back(flags);
            _pIndexVec->push_back(index);

            return true;
        }
void TSCComponentRegistry::QueryRegistry(Tsc324mNodeCommand& aCmd)
{

    OSCL_String* mimetype;
    Oscl_Vector<PVUuid, OsclMemAllocator>* uuidvec;
    bool exactMatch;
    aCmd.Parse(mimetype, uuidvec, exactMatch);

//    uuidvec->clear();
    if (*mimetype == (TSC_COMPONENT_MIME_TYPE))
    {
        uuidvec->push_back((PVUuidH324ComponentInterface));
    }
}
        // From RecognizerSharedLibraryInterface
        void RegisterAllRecognizers(PVPlayerRecognizerRegistryInterface* aRegistry, OsclAny*& aContext)
        {
            PVMFRecognizerPluginFactory* tmpfac = NULL;

            Oscl_Vector<PVMFRecognizerPluginFactory*, OsclMemAllocator>* pluginList =
                new Oscl_Vector<PVMFRecognizerPluginFactory*, OsclMemAllocator>;

            tmpfac =
                OSCL_STATIC_CAST(PVMFRecognizerPluginFactory*, OSCL_NEW(PVMP4FFRecognizerFactory, ()));
            aRegistry->RegisterRecognizer(tmpfac);

            pluginList->push_back(tmpfac);

            aContext = (OsclAny *)pluginList;
        };
PVMFStatus PVOMA1KMJRecognizerPlugin::Recognize( PVMFDataStreamFactory& aSourceDataStreamFactory,
                                                 PVMFRecognizerMIMEStringList* aFormatHint,
                                                 Oscl_Vector<PVMFRecognizerResult,OsclMemAllocator>& aRecognizerResult
                                                )
{
  Oscl_FileServer fileServ;
    PVFile pvfile;

    // set data stream
    pvfile.SetCPM(&aSourceDataStreamFactory);

    // open data stream
    int32 ret = pvfile.Open( NULL,Oscl_File::MODE_READ | Oscl_File::MODE_BINARY,fileServ);
    if(ret)  // open data stream failed
    {
        LOGD("PVOMA1KMJRecognizerPlugin:Recognize pvfile.Open failed");
        return PVMFFailure;
    }

    DrmPluginDataAccess dataAccess(&pvfile);

    T_DRM_Input_Data drmInputData =
    {
        (int32_t)&dataAccess,
        TYPE_DRM_UNKNOWN,
        DrmPluginGetDataLen,
        DrmPluginReadData,
        DrmPluginSeekData
    };

    int32_t session = SVC_drm_openSession(drmInputData);

    if((DRM_MEDIA_DATA_INVALID == session) || (DRM_FAILURE == session))
    {
        LOGD("PVOMA1KMJRecognizerPlugin:Recognize SVC_drm_openSession failed");
    pvfile.Close();
        return PVMFFailure;
    }

    char mediaType[CONTENT_TYPE_LEN] = {0};
    ret = SVC_drm_getContentType(session,(uint8_t*)mediaType);

    SVC_drm_closeSession(session);
    pvfile.Close();

    if(DRM_SUCCESS != ret)  // get DRM content type failed
    {
        LOGD("PVOMA1KMJRecognizerPlugin:Recognize SVC_drm_getTypeDirectly failed");
        return PVMFFailure;
    }

    // save content type for use by outer
    PVMFRecognizerResult result;

    RecognizeContentType(mediaType,result.iRecognizedFormat);
    result.iRecognitionConfidence = PVMFRecognizerConfidenceCertain;
    aRecognizerResult.push_back(result);

    return PVMFSuccess;
}
        // From NodeRegistrySharedLibraryInterface
        void UnregisterAllNodes(PVPlayerNodeRegistryInterface* aRegistry, OsclAny* aContext)
        {
            if (NULL != aContext)
            {
                Oscl_Vector<PVPlayerNodeInfo, OsclMemAllocator>* nodeList = (Oscl_Vector<PVPlayerNodeInfo, OsclMemAllocator> *)aContext;

                while (!nodeList->empty())
                {
                    PVPlayerNodeInfo tmpnode = nodeList->front();
                    OSCL_DELETE(tmpnode.iSharedLibrary);
                    aRegistry->UnregisterNode(tmpnode);
                    nodeList->erase(nodeList->begin());
                }

                delete nodeList;
            }
        };
PVMFStatus PVPlayerNodeRegistry::QueryRegistry(PVMFFormatType& aInputType, PVMFFormatType& aOutputType, Oscl_Vector<PVUuid, OsclMemAllocator>& aUuids)
{
    uint32 SearchCount = 0;
    bool matchfound = false;

    // Find all nodes that support the specified input and ouput format pair
    while (SearchCount < iType.size())
    {
        uint32 inputsearchcount = 0, outputsearchcount = 0;
        bool iInputFoundFlag = false, iOutputFoundFlag = false;

        while (inputsearchcount < iType[SearchCount].iInputTypes.size())
        {
            // Check if the input format matches
            if (iType[SearchCount].iInputTypes[inputsearchcount] == aInputType)
            {
                // Set the the input flag to true since we found the match in the search
                iInputFoundFlag = true;
                break;
            }
            inputsearchcount++;
        }

        //Check the flag of input format if it is true check for the output format, if not return failure
        if (iInputFoundFlag)
        {
            while (outputsearchcount < iType[SearchCount].iOutputType.size())
            {
                if (iType[SearchCount].iOutputType[outputsearchcount] == aOutputType)
                {
                    //set the the output flag to true since we found the match in the search
                    iOutputFoundFlag = true;
                    break;
                }

                outputsearchcount++;
            }

            if (iOutputFoundFlag)
            {
                // There's a match so add this node UUID to the list.
                aUuids.push_back(iType[SearchCount].iNodeUUID);
                matchfound = true;
            }
        }

        SearchCount++;
    }

    if (matchfound)
    {
        return PVMFSuccess;
    }
    else
    {
        return PVMFFailure;
    }
}
PVMFCommandId PVFMVideoMIO::QueryUUID(const PvmfMimeString& aMimeType, Oscl_Vector<PVUuid, OsclMemAllocator>& aUuids,
                                      bool aExactUuidsOnly, const OsclAny* aContext)
{
    PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_STACK_TRACE, (0, "PVFMVideoMIO::QueryUUID() called"));

    OSCL_UNUSED_ARG(aMimeType);
    OSCL_UNUSED_ARG(aExactUuidsOnly);

    PVMFCommandId cmdid = iCommandCounter++;

    PVMFStatus status = PVMFFailure;
    int32 err ;
    OSCL_TRY(err,
             aUuids.push_back(PVMI_CAPABILITY_AND_CONFIG_PVUUID);
             PVUuid uuid;
             iActiveTiming.queryUuid(uuid);
             aUuids.push_back(uuid);
            );
        void UnregisterAllRecognizers(PVPlayerRecognizerRegistryInterface* aRegistry, OsclAny* aContext)
        {
            if (NULL != aContext)
            {
                Oscl_Vector<PVMFRecognizerPluginFactory*, OsclMemAllocator>* pluginList = (Oscl_Vector<PVMFRecognizerPluginFactory*, OsclMemAllocator>*)aContext;

                while (!pluginList->empty())
                {
                    PVMFRecognizerPluginFactory* tmpfac = pluginList->front();

                    aRegistry->UnregisterRecognizer(tmpfac);

                    pluginList->erase(pluginList->begin());

                    OSCL_DELETE(tmpfac);
                }

                delete pluginList;
            }
        };
PVMFCommandId LipSyncDummyOutputMIO::QueryUUID(const PvmfMimeString& aMimeType,
        Oscl_Vector<PVUuid, OsclMemAllocator>& aUuids,
        bool aExactUuidsOnly,
        const OsclAny* aContext)
{
    LIPSYNCDUMMYOUTPUTMIO_LOGDEBUG((0, "LipSyncDummyOutputMIO::QueryUUID()"));

    OSCL_UNUSED_ARG(aMimeType);
    OSCL_UNUSED_ARG(aExactUuidsOnly);

    PVMFCommandId cmdid = iCommandCounter++;

    PVMFStatus status = PVMFSuccess;
    aUuids.push_back(PVMI_CAPABILITY_AND_CONFIG_PVUUID);
    aUuids.push_back(PvmiClockExtensionInterfaceUuid);

    CommandResponse resp(status, cmdid, aContext);
    QueueCommandResponse(resp);
    return cmdid;
}
void PlayerDriver::handleGetDuration(PlayerGetDuration* ec)
{
    ec->set(-1);
    mMetaKeyList.clear();
    mMetaKeyList.push_back(OSCL_HeapString<OsclMemAllocator>("duration"));
    mMetaValueList.clear();
    mNumMetaValues=0;
    int error = 0;
    OSCL_TRY(error, mPlayer->GetMetadataValues(mMetaKeyList,0,-1,mNumMetaValues,mMetaValueList, ec));
    OSCL_FIRST_CATCH_ANY(error, commandFailed(ec));
}
예제 #12
0
PVMFCommandId AndroidCameraInput::QueryUUID(const PvmfMimeString& aMimeType,
        Oscl_Vector<PVUuid,
        OsclMemAllocator>& aUuids,
        bool aExactUuidsOnly,
        const OsclAny* aContext)
{
    LOGV("QueryUUID");
    OSCL_UNUSED_ARG(aMimeType);
    OSCL_UNUSED_ARG(aExactUuidsOnly);

    int32 err = 0;
    OSCL_TRY(err, aUuids.push_back(PVMI_CAPABILITY_AND_CONFIG_PVUUID););
PVMFStatus PVAMRFFRecognizerPlugin::Recognize(PVMFDataStreamFactory& aSourceDataStreamFactory, PVMFRecognizerMIMEStringList* aFormatHint,
        Oscl_Vector<PVMFRecognizerResult, OsclMemAllocator>& aRecognizerResult)
{
    OSCL_UNUSED_ARG(aFormatHint);
    OSCL_wHeapString<OsclMemAllocator> tmpfilename;
    Oscl_FileServer fileServ;
    PVFile pvfile;
    pvfile.SetCPM(&aSourceDataStreamFactory);

    if (!(pvfile.Open(tmpfilename.get_cstr(), Oscl_File::MODE_READ | Oscl_File::MODE_BINARY, fileServ)))
    {
        char* readData = NULL;

        readData = (char*)(oscl_malloc(sizeof(char) * AMRFF_MIN_DATA_SIZE_FOR_RECOGNITION));
        if (readData != NULL)
        {
            int bytesRead = 0;
            bytesRead = pvfile.Read(readData, sizeof(char), AMRFF_MIN_DATA_SIZE_FOR_RECOGNITION);
            if (bytesRead != AMRFF_MIN_DATA_SIZE_FOR_RECOGNITION)
            {
                pvfile.Close();
                oscl_free(readData);
                return PVMFFailure;
            }
            if (readData[0] == '#' && readData[1] == '!' && readData[2] == 'A' && readData[3] == 'M' && readData[4] == 'R')
            {
                PVMFRecognizerResult result;
                result.iRecognizedFormat = PVMF_MIME_AMRFF;
                result.iRecognitionConfidence = PVMFRecognizerConfidenceCertain;
                aRecognizerResult.push_back(result);
            }
        }
        pvfile.Close();
        oscl_free(readData);
        return PVMFFailure;
    }
    else
    {
        return PVMFFailure;
    }
    return PVMFSuccess;
}
OSCL_EXPORT_REF
int32
IMpeg4File::IsXXXable(MP4_FF_FILE_REFERENCE fileRef,
                      int32 &metaDataSize,
                      int32  &oMoovBeforeMdat,
                      uint32 *pMajorBrand,
                      uint32 *pCompatibleBrands)
{
    const int ISMOBILEMP4 = 1, ISPSEUDOSTREMABLE = 2, ISPLAYABLE = 3;

    if (metaDataSize <= DEFAULT_ATOM_SIZE)
        return READ_FAILED;

    if ((oMoovBeforeMdat < ISMOBILEMP4) || (oMoovBeforeMdat > ISPLAYABLE))
        return DEFAULT_ERROR;

    int32 checkType = oMoovBeforeMdat;
    int32 fileSize = metaDataSize;

    MP4_FF_FILE fileStruct;
    MP4_FF_FILE *fp = &fileStruct;

    fp->_pvfile.SetFilePtr(fileRef);

    AtomUtils::seekFromStart(fp, 0);
    fp->_fileSize = fileSize;

    int32	mp4ErrorCode = DEFAULT_ERROR;

    uint32 atomType = UNKNOWN_ATOM;
    uint32 atomSize = 0;

    AtomUtils::getNextAtomType(fp, atomSize, atomType);

    if (atomType == FILE_TYPE_ATOM)
    {
        //"ftyp"
        if (fileSize < (int32)atomSize)
        {
            AtomUtils::CloseMP4File(fp);
            return READ_FAILED;
        }
        FileTypeAtom *_pFileTypeAtom = NULL;
        PV_MP4_FF_NEW(fp->auditCB, FileTypeAtom, (fp, atomSize, atomType), _pFileTypeAtom);

        if (!_pFileTypeAtom->MP4Success())
        {
            PV_MP4_FF_DELETE(NULL, FileTypeAtom, _pFileTypeAtom);
            AtomUtils::CloseMP4File(fp);
            return READ_FILE_TYPE_ATOM_FAILED;
        }
        //get file type
        {
            *pMajorBrand = ENoFileType;

            uint32 majorBrand = _pFileTypeAtom->getMajorBrand();

            //conversion
            if (majorBrand == MOBILE_MP4)	*pMajorBrand = EMMP4;
            else if (majorBrand == BRAND_3GPP4)	*pMajorBrand = E3GP4;
            else if (majorBrand == BRAND_3GPP5)	*pMajorBrand = E3GP5;
            else if (majorBrand == BRAND_ISOM)	*pMajorBrand = EISOM;
            else if (majorBrand == BRAND_MP41)	*pMajorBrand = EMP41;
            else if (majorBrand == BRAND_MP42)	*pMajorBrand = EMP42;
            else if (majorBrand == WMF_BRAND)	*pMajorBrand = EWMF;


            Oscl_Vector<uint32, OsclMemAllocator> *compatibleBrandArray =
                _pFileTypeAtom->getCompatibleBrand();


            *pCompatibleBrands = ENoFileType;

            if (compatibleBrandArray != NULL)
            {
                for (uint32 i = 0; i < compatibleBrandArray->size(); i++)
                {
                    uint32 compatibleBrand = (*compatibleBrandArray)[i];

                    if (compatibleBrand == MOBILE_MP4)			*pCompatibleBrands |= EMMP4;
                    else if (compatibleBrand == BRAND_3GPP4)	*pCompatibleBrands |= E3GP4;
                    else if (compatibleBrand == BRAND_3GPP5)	*pCompatibleBrands |= E3GP5;
                    else if (compatibleBrand == BRAND_ISOM)		*pCompatibleBrands |= EISOM;
                    else if (compatibleBrand == BRAND_MP41)		*pCompatibleBrands |= EMP41;
                    else if (compatibleBrand == BRAND_MP42)		*pCompatibleBrands |= EMP42;
                    else if (compatibleBrand == WMF_BRAND)		*pCompatibleBrands |= EWMF;
                }
            }
        }//end of get file type

        int32 fpos = _pFileTypeAtom->getSize();
        PV_MP4_FF_DELETE(NULL, FileTypeAtom, _pFileTypeAtom);

        if (checkType == ISMOBILEMP4)
        {
            AtomUtils::CloseMP4File(fp);
            return EVERYTHING_FINE;
        }

        oMoovBeforeMdat = true;
        metaDataSize = 0;

        if ((fpos + DEFAULT_ATOM_SIZE) > fileSize)
        {
            AtomUtils::CloseMP4File(fp);
            return READ_FAILED;
        }

        while (fpos < fileSize)
        {
            uint32 atomType = UNKNOWN_ATOM;
            uint32 atomSize = 0;

            AtomUtils::getNextAtomType(fp, atomSize, atomType);

            fpos += DEFAULT_ATOM_SIZE;

            if ((atomType == FREE_SPACE_ATOM)
                    || (atomType == SKIP_ATOM)
                    || (atomType == USER_DATA_ATOM)
                    || (atomType == UUID_ATOM)
                    || (atomType == MOVIE_ATOM)
                    || (atomType == MEDIA_DATA_ATOM)
                    || (atomType == UNKNOWN_ATOM))
            {
                if (atomSize < DEFAULT_ATOM_SIZE)
                {
                    mp4ErrorCode = ZERO_OR_NEGATIVE_ATOM_SIZE;
                    break;
                }
                atomSize -= DEFAULT_ATOM_SIZE;
                if (atomType == MOVIE_ATOM)
                {
                    //this is an exit
                    //no check of the "size" validity
                    metaDataSize = fpos + atomSize;
                    mp4ErrorCode = EVERYTHING_FINE;
                    break;
                }
                else if (atomType == MEDIA_DATA_ATOM)
                {
                    oMoovBeforeMdat = false;
                    if (checkType == ISPSEUDOSTREMABLE)
                    {
                        mp4ErrorCode = EVERYTHING_FINE;
                        break;
                    }
                }

                if ((int32)(fpos + atomSize) > fileSize)
                {
                    mp4ErrorCode = READ_FAILED;
                    break;
                }
                AtomUtils::seekFromCurrPos(fp, atomSize);
                fpos += atomSize;

            }
            else if (atomType == 0)
            {
                //return READ_FAILED;
                //since extra check is put above, it should NEVER fall in this bracket
                mp4ErrorCode = READ_FAILED;
                break;
            }
            else
            {	//error: other atoms should not be in file level
                mp4ErrorCode = DEFAULT_ERROR;
                break;
            }
        }
    }
    AtomUtils::CloseMP4File(fp);
    return (mp4ErrorCode);
}
/* ======================================================================== */
SDP_ERROR_CODE
SDPMPEG4MediaInfoParser::parseMediaInfo(const char *buff, const int index, SDPInfo *sdp, payloadVector payload_vec, bool isSipSdp, int alt_id, bool alt_def_id)
{

    const char *current_start = buff; //Pointer to the beginning of the media text
    const char *end = buff + index;   //Pointer to the end of the media text
    const char *line_start_ptr, *line_end_ptr;
    int VOLLength = 0;
    int fmtp_cnt = 0 ;
    bool framesize_found_in_fmtp = false;
    SDPAllocDestructDealloc<uint8> SDP_alloc;


    while (get_next_line(current_start, end,
                         line_start_ptr, line_end_ptr))
    {
        if ((!oscl_strncmp(line_start_ptr, "a=alt:", oscl_strlen("a=alt:"))) && (alt_def_id == false))
        {
            line_start_ptr += oscl_strlen("a=alt:");
            for (; *line_start_ptr != ':'; line_start_ptr++);
            line_start_ptr = line_start_ptr + 1;
        }
        if (!oscl_strncmp(line_start_ptr, "a=fmtp:", oscl_strlen("a=fmtp:")))
        {
            char *tmp_start_line, *tmp_end_line;
            fmtp_cnt++ ;

            tmp_start_line = (char *)line_start_ptr + oscl_strlen("a=fmtp:");
            tmp_start_line = (char *)skip_whitespace(tmp_start_line, line_end_ptr);
            if (tmp_start_line >= line_end_ptr)
            {
                break;
            }
            tmp_end_line = (char *)skip_to_whitespace(tmp_start_line, line_end_ptr);
            if (tmp_end_line < tmp_start_line)
            {
                break;
            }
            tmp_start_line = tmp_end_line + 1;
            tmp_start_line = (char *)skip_whitespace(tmp_start_line, line_end_ptr);
            if (tmp_start_line >= line_end_ptr)
            {
                break;
            }
            int ii = 0;
            const char *temp = tmp_start_line;
            for (ii = 0; ii < (line_end_ptr - tmp_start_line) ; ii++)
            {
                if ((tmp_start_line[ii] == ';') || (ii == (line_end_ptr - tmp_start_line - 1)))
                {
                    tmp_end_line = tmp_start_line + ii;
                    if ((line_end_ptr - tmp_start_line - 1) == ii)
                    {
                        tmp_end_line++;
                    }
                    if (!oscl_strncmp(temp, "config=", oscl_strlen("config=")))
                    {
                        int currentVOLLength;
                        temp += oscl_strlen("config=");
                        temp = skip_whitespace(temp, line_end_ptr);
                        if (temp >= line_end_ptr)
                        {
                            PVMF_SDP_PARSER_LOGERROR((0, "SDPM4VMediaInfoParser::parseMediaInfo - Bad a=fmtp line format - Bad config field"));
                            return SDP_BAD_MEDIA_FMTP;
                        }

                        currentVOLLength = (int)(tmp_end_line - temp) / 2;
                        if (VOLLength < currentVOLLength)
                            VOLLength = currentVOLLength;
                    }
                    if (tmp_end_line != line_end_ptr) temp = tmp_end_line + 1;
                    temp = skip_whitespace(temp, line_end_ptr);
                    if (temp >= line_end_ptr)
                    {
                        PVMF_SDP_PARSER_LOGERROR((0, "SDPM4VMediaInfoParser::parseMediaInfo - Bad a=fmtp line format"));
                        return SDP_BAD_MEDIA_FMTP;
                    }

                }
            }
        }


        current_start = line_end_ptr + 1;
    }

    if (fmtp_cnt == 0 && isSipSdp == false)
    {
        PVMF_SDP_PARSER_LOGERROR((0, "SDPM4VMediaInfoParser::parseMediaInfo - No fmtp line found"));
        return SDP_BAD_MEDIA_FORMAT;
    }

    if (VOLLength < 0)
    {
        VOLLength = 0;
    }

    bool altMedia = false;
    if (!alt_id || (alt_def_id == true))
        altMedia = false;
    else
        altMedia = true;

    void *memory = sdp->alloc(sizeof(m4v_mediaInfo), altMedia);
    if (NULL == memory)
    {
        PVMF_SDP_PARSER_LOGERROR((0, "SDPM4VMediaInfoParser::parseMediaInfo - memory allocation failure"));
        return SDP_NO_MEMORY;
    }
    else
    {
        m4v_mediaInfo *m4Video = OSCL_PLACEMENT_NEW(memory, m4v_mediaInfo());

        m4Video->setMediaInfoID(sdp->getMediaObjectIndex());

        // Allocate memory to the payload specific objects
        for (uint32 ii = 0; ii < payload_vec.size(); ii++)
        {
            void* mem = m4Video->alloc(sizeof(M4vPayloadSpecificInfoType));
            if (mem == NULL)
            {
                PVMF_SDP_PARSER_LOGERROR((0, "SDPM4VMediaInfoParser::parseMediaInfo - Memory allocation failure"));
                return SDP_NO_MEMORY;
            }
            else
            {
                M4vPayloadSpecificInfoType* payload = OSCL_PLACEMENT_NEW(mem, M4vPayloadSpecificInfoType(payload_vec[ii]));
                (void) payload;
            }
        }


        if (alt_id && !alt_def_id)
        {
            sdp->copyFmDefMedia(m4Video);
            //empty alternate & default track ID vectors.
            m4Video->resetAlternateTrackId();
            m4Video->resetDependentTrackId();
        }

        SDP_ERROR_CODE status = baseMediaInfoParser(buff, m4Video, index, alt_id, alt_def_id, isSipSdp);
        if (status != SDP_SUCCESS)
        {
            return status;
        }

        current_start = buff;


        while (get_next_line(current_start, end,
                             line_start_ptr, line_end_ptr))
        {
            switch (*line_start_ptr)
            {
                case 'a':
                {
                    const char *sptr;
                    if ((!oscl_strncmp(line_start_ptr, "a=alt:", oscl_strlen("a=alt:"))) && (alt_def_id == false))
                    {
                        line_start_ptr += oscl_strlen("a=alt:");
                        for (; *line_start_ptr != ':'; line_start_ptr++);
                        line_start_ptr = line_start_ptr + 1;
                    }
                    if (!oscl_strncmp(line_start_ptr, "a=framerate:", oscl_strlen("a=framerate:")))
                    {
                        sptr = line_start_ptr + oscl_strlen("a=framerate:");
                        sptr = skip_whitespace(sptr, line_end_ptr);
                        if (sptr >= line_end_ptr)
                        {
                            PVMF_SDP_PARSER_LOGERROR((0, "SDPM4VMediaInfoParser::parseMediaInfo - Bad a=framerate line format"));
                            return SDP_BAD_MEDIA_FRAME_RATE;
                        }
                        OsclFloat rate;
                        if (!PV_atof(sptr, line_end_ptr - sptr, rate))
                            return SDP_BAD_MEDIA_FORMAT;
                        ((m4v_mediaInfo *)m4Video)->setFrameRate(rate);
                    }
                    if (!oscl_strncmp(line_start_ptr, "a=I_frame_interval:", oscl_strlen("a=I_frame_interval:")))
                    {
                        sptr = line_start_ptr + oscl_strlen("a=I_frame_interval:");
                        sptr = skip_whitespace(sptr, line_end_ptr);
                        if (sptr >= line_end_ptr)
                        {
                            PVMF_SDP_PARSER_LOGERROR((0, "SDPM4VMediaInfoParser::parseMediaInfo - Bad a=I_frame_interval line format"));
                            return SDP_BAD_MEDIA_FRAME_INTERVAL;
                        }
                        uint32 ifi;
                        if (PV_atoi(sptr, 'd', (line_end_ptr - sptr), ifi) == true)((m4v_mediaInfo *)m4Video)->setIFrameInterval(ifi);
                    }
                    if (!oscl_strncmp(line_start_ptr, "a=fmtp:", oscl_strlen("a=fmtp:")))
                    {
                        const char *tmp_start_line, *tmp_end_line;
                        tmp_start_line = line_start_ptr + oscl_strlen("a=fmtp:");
                        tmp_start_line = skip_whitespace(tmp_start_line, line_end_ptr);
                        if (tmp_start_line >= line_end_ptr)
                        {
                            break;
                        }
                        tmp_end_line = skip_to_whitespace(tmp_start_line, line_end_ptr);
                        if (tmp_end_line < tmp_start_line)
                        {
                            break;
                        }
                        uint32 payloadNumber;
                        if (PV_atoi(tmp_start_line, 'd', (tmp_end_line - tmp_start_line), payloadNumber) == false)
                        {
                            PVMF_SDP_PARSER_LOGERROR((0, "SDPM4VMediaInfoParser::parseMediaInfo - Bad a=fmtp line format - Bad payload number"));
                            return SDP_BAD_MEDIA_FMTP;
                        }
                        else
                        {
                            int p;
                            if (!m4Video->lookupPayloadNumber(payloadNumber, p))
                            {
                                fmtp_cnt--;
                                break;
                            }
                        }

                        M4vPayloadSpecificInfoType* payloadPtr =
                            (M4vPayloadSpecificInfoType*)m4Video->getPayloadSpecificInfoTypePtr(payloadNumber);
                        if (payloadPtr == NULL)
                        {
                            PVMF_SDP_PARSER_LOGERROR((0, "SDPM4VMediaInfoParser::parseMediaInfo - Bad a=fmtp line format - payload pointer not found for payload"));
                            return SDP_PAYLOAD_MISMATCH;
                        }

                        PVMF_SDP_PARSER_LOGINFO((0, "SDPM4VMediaInfoParser::parseMediaInfo - processing payload number : %d", payloadNumber));

                        tmp_start_line = tmp_end_line + 1;
                        tmp_start_line = skip_whitespace(tmp_start_line, line_end_ptr);
                        if (tmp_start_line >= line_end_ptr)
                        {
                            break;
                        }
                        int ii = 0;
                        const char *temp = tmp_start_line;
                        for (ii = 0; ii < (line_end_ptr - tmp_start_line) ; ii++)
                        {
                            if ((tmp_start_line[ii] == ';') || (ii == (line_end_ptr - tmp_start_line - 1)))
                            {
                                tmp_end_line = tmp_start_line + ii;
                                if (ii == (line_end_ptr - tmp_start_line - 1))
                                {
                                    tmp_end_line += 1;
                                }
                                if (!oscl_strncmp(temp, "config=", oscl_strlen("config=")))
                                {
                                    uint8 *mptr = SDP_alloc.allocate(VOLLength);
                                    OsclRefCounterSA< SDPAllocDestructDealloc<uint8> > *refcnt = new OsclRefCounterSA< SDPAllocDestructDealloc<uint8> >(mptr);
                                    OsclSharedPtr<uint8> VOLPtr(mptr, refcnt);

                                    temp += oscl_strlen("config=");
                                    temp = skip_whitespace(temp, line_end_ptr);
                                    if (temp >= line_end_ptr)
                                    {
                                        PVMF_SDP_PARSER_LOGERROR((0, "SDPM4VMediaInfoParser::parseMediaInfo - Bad a=fmtp line format - Bad config field"));
                                        return SDP_BAD_MEDIA_FMTP;
                                    }
                                    VOLLength = (int)(tmp_end_line - temp) / 2;
                                    int idx = 0;
                                    for (idx = 0; idx < VOLLength; idx++)
                                    {
                                        uint32 val;
                                        //Set this value in the vol header array
                                        if (PV_atoi((temp + 2*idx), 'x', 2 , val) == false)
                                        {
                                            PVMF_SDP_PARSER_LOGERROR((0, "SDPM4VMediaInfoParser::parseMediaInfo - Bad a=fmtp line format - Bad config field"));
                                            return SDP_BAD_MEDIA_FMTP;
                                        }

                                        *(VOLPtr + idx) = (uint8)val;

                                    }

                                    payloadPtr->setVOLHeader(VOLPtr);
                                    payloadPtr->setVOLHeaderSize(VOLLength);
                                    payloadPtr->setDecoderSpecificInfo(VOLPtr);
                                    payloadPtr->setDecoderSpecificInfoSize(VOLLength);

                                }
                                if (!oscl_strncmp(temp, "profile-level-id=", oscl_strlen("profile-level-id=")))
                                {
                                    temp += oscl_strlen("profile-level-id=");
                                    temp = skip_whitespace(temp, line_end_ptr);
                                    if (temp > line_end_ptr)
                                    {
                                        PVMF_SDP_PARSER_LOGERROR((0, "SDPM4VMediaInfoParser::parseMediaInfo - Bad a=fmtp line format - Bad profile-level-id field"));
                                        return SDP_BAD_MEDIA_FMTP;
                                    }
                                    uint32 pl;
                                    if (PV_atoi(temp, 'd', tmp_end_line - temp ,  pl) == true)
                                        payloadPtr->setProfileLevelID(pl);

                                }
                                if (!oscl_strncmp(temp, "framesize=", oscl_strlen("framesize=")))
                                {
                                    temp += oscl_strlen("framesize=");
                                    temp = skip_whitespace(temp, tmp_end_line);
                                    framesize_found_in_fmtp  = true;
                                    if (temp > tmp_end_line)
                                    {
                                        PVMF_SDP_PARSER_LOGERROR((0, "SDPM4VMediaInfoParser::parseMediaInfo - Bad a=fmtp line format - Bad framesize field"));
                                        return SDP_BAD_MEDIA_FMTP;
                                    }
                                    const char *end = NULL;
                                    int idx = 0;
                                    for (idx = 0; idx < (tmp_end_line - temp); idx++)
                                    {
                                        if (temp[idx] == '-')
                                        {
                                            end = temp + idx;
                                        }
                                    }
                                    if (end == NULL)
                                    {
                                        PVMF_SDP_PARSER_LOGERROR((0, "SDPM4VMediaInfoParser::parseMediaInfo - Bad a=fmtp line format - framesize width info missing"));
                                        return SDP_MISSING_MEDIA_DESCRIPTION;
                                    }
                                    uint32 width;
                                    if (PV_atoi(temp, 'd', (end - temp),  width) == true)
                                        payloadPtr->setFrameWidth(width);
                                    temp = end + 1;
                                    temp = skip_whitespace(temp, tmp_end_line);
                                    if (temp > tmp_end_line)
                                    {
                                        PVMF_SDP_PARSER_LOGERROR((0, "SDPM4VMediaInfoParser::parseMediaInfo - Bad a=fmtp line format - framesize height info missing"));
                                        return SDP_BAD_MEDIA_FMTP;
                                    }
                                    uint32 height;
                                    if (PV_atoi(temp, 'd', tmp_end_line - temp, height) == true)
                                        payloadPtr->setFrameHeight(height);
                                }
                                if (!oscl_strncmp(temp, "decode_buf=", oscl_strlen("decode_buf=")))
                                {
                                    temp += oscl_strlen("decode_buf=");
                                    temp = skip_whitespace(temp, tmp_end_line);
                                    if (temp > tmp_end_line)
                                    {
                                        PVMF_SDP_PARSER_LOGERROR((0, "SDPM4VMediaInfoParser::parseMediaInfo - Bad a=fmtp line format - Bad decode_buf field"));
                                        return SDP_BAD_MEDIA_FMTP;
                                    }
                                    uint32 dec;
                                    if (PV_atoi(temp, 'd', tmp_end_line - temp, dec) == true)
                                        payloadPtr->setMaxBufferSize(dec);
                                }
                                if (tmp_end_line != line_end_ptr) temp = tmp_end_line + 1;
                                temp = skip_whitespace(temp, line_end_ptr);
                                if (temp >= line_end_ptr)
                                {
                                    PVMF_SDP_PARSER_LOGERROR((0, "SDPM4VMediaInfoParser::parseMediaInfo - Bad a=fmtp line format"));
                                    return SDP_BAD_MEDIA_FMTP;
                                }
                            }
                        }
                    }
                    StrPtrLen fmsize("a=framesize:");
                    if (!oscl_strncmp(line_start_ptr, fmsize.c_str(), fmsize.length()))
                    {
                        uint32 width, height;
                        const char *sptr = line_start_ptr + fmsize.length();
                        const char *eptr = skip_to_whitespace(sptr, line_end_ptr);


                        if (sptr > eptr)
                        {
                            PVMF_SDP_PARSER_LOGERROR((0, "SDPM4VMediaInfoParser::parseMediaInfo - Bad a=framesize line format"));
                            return SDP_BAD_MEDIA_FRAMESIZE;
                        }
                        uint32 payloadNo;
                        if (PV_atoi(sptr, 'd', (eptr - sptr), payloadNo))
                        {
                            int p;
                            if (!((m4v_mediaInfo *)m4Video)->lookupPayloadNumber(payloadNo, p))
                                break;

                        }
                        else
                        {
                            PVMF_SDP_PARSER_LOGERROR((0, "SDPM4VMediaInfoParser::parseMediaInfo - Bad a=framesize line format - Bad payload number"));
                            return SDP_BAD_MEDIA_FRAMESIZE;
                        }

                        M4vPayloadSpecificInfoType* payloadPtr2 =
                            (M4vPayloadSpecificInfoType*)m4Video->getPayloadSpecificInfoTypePtr(payloadNo);
                        if (payloadPtr2 == NULL)
                        {
                            PVMF_SDP_PARSER_LOGERROR((0, "SDPM4VMediaInfoParser::parseMediaInfo - Bad a=framesize line format - payload pointer not found for payload"));
                            return SDP_PAYLOAD_MISMATCH;
                        }

                        sptr = eptr;
                        sptr = skip_whitespace(sptr , line_end_ptr);

                        for (;*eptr != '-' ; ++eptr);

                        if (!PV_atoi(sptr, 'd', eptr - sptr, width))
                        {
                            PVMF_SDP_PARSER_LOGERROR((0, "SDPM4VMediaInfoParser::parseMediaInfo - Bad a=framesize line format"));
                            return SDP_BAD_MEDIA_FRAMESIZE;
                        }

                        eptr = eptr + 1;
                        sptr = eptr;
                        if (sptr > line_end_ptr)
                            return SDP_BAD_MEDIA_FRAMESIZE;
                        eptr = skip_to_line_term(sptr, line_end_ptr);
                        if (!PV_atoi(sptr, 'd', eptr - sptr, height))
                            return SDP_BAD_MEDIA_FRAMESIZE;

                        if (framesize_found_in_fmtp)
                        {
                            if ((int)width != payloadPtr2->getFrameWidth() || (int)height != payloadPtr2->getFrameHeight())
                            {
                                return SDP_BAD_MEDIA_FRAMESIZE;
                            }

                        }
                        else
                        {
                            payloadPtr2->setFrameWidth(width);
                            payloadPtr2->setFrameHeight(height);
                        }

                    }
                }
                break;
                default:
                    break;
            }
            current_start = line_end_ptr;
        }

        sessionDescription *session = sdp->getSessionInfo();

        const char *altGroupBW = session->getAltGroupBW();
        int length = session->getAltGroupBWLength();

        if (length > 0)
        {
            status = setDependentMediaId(altGroupBW, length, m4Video, alt_id);
            if (status != SDP_SUCCESS)
                return SDP_BAD_MEDIA_ALT_ID;
        }

        const char *altGroupLANG = session->getAltGroupLANG();
        length = session->getAltGroupLANGLength();

        if (length > 0)
        {
            status = setDependentMediaId(altGroupLANG, length, m4Video, alt_id);
            if (status != SDP_SUCCESS)
                return SDP_BAD_MEDIA_ALT_ID;
        }

        if (m4Video->getCFieldStatus()	|| session->getCFieldStatus())
        {
            //if sample rate is zero override with defaults
            Oscl_Vector<PayloadSpecificInfoTypeBase*, SDPParserAlloc> payloadSpecificInfoVector =
                m4Video->getPayloadSpecificInfoVector();
            for (int ii = 0; ii < (int)payloadSpecificInfoVector.size();ii++)
            {
                if (payloadSpecificInfoVector[ii]->getSampleRate() == 0)
                {
                    payloadSpecificInfoVector[ii]->sampleRate =
                        PVMF_SDP_DEFAULT_MPEG4_VIDEO_SAMPLE_RATE;
                }
            }
            return SDP_SUCCESS;
        }
        else
        {
            PVMF_SDP_PARSER_LOGERROR((0, "SDPM4VMediaInfoParser::parseMediaInfo - No C field present"));
            return SDP_FAILURE_NO_C_FIELD;
        }
    }

}
        //Read and parse the config file
        //retval = -1 if the config file doesnt exist
        int8 ReadAndParseLoggerConfigFile()
        {
            int8 retval = 1;

            if (0 != iLogFile.Open(iLogFileName, Oscl_File::MODE_READ, iFileServer))
            {
                retval = -1;
            }
            else
            {
                if (!iLogFileRead)
                {
                    int32 nCharRead = iLogFile.Read(ibuffer, 1, sizeof(ibuffer));
                    //Parse the buffer for \n chars
                    Oscl_Vector<char*, OsclMemAllocator> LogConfigStrings;

                    const char *end_ptr = ibuffer + oscl_strlen(ibuffer) ; // Point just beyond the end
                    const char *section_start_ptr;
                    const char *line_start_ptr, *line_end_ptr;
                    char* end_temp_ptr;
                    int16 offset = 0;

                    section_start_ptr = skip_whitespace_and_line_term(ibuffer, end_ptr);

                    while (section_start_ptr < end_ptr)
                    {
                        if (!get_next_line(section_start_ptr, end_ptr,
                                           line_start_ptr, line_end_ptr))
                        {
                            break;
                        }


                        section_start_ptr = line_end_ptr + 1;

                        end_temp_ptr = (char*)line_end_ptr;
                        *end_temp_ptr = '\0';

                        LogConfigStrings.push_back((char*)line_start_ptr);

                    }

                    //Populate the  LoggerConfigElements vector
                    {
                        if (!LogConfigStrings.empty())
                        {
                            Oscl_Vector<char*, OsclMemAllocator>::iterator it;
                            it = LogConfigStrings.begin();
                            uint32 appenderType;
                            PV_atoi(*it, 'd', oscl_strlen(*it), appenderType);
                            iAppenderType = appenderType;
                            if (LogConfigStrings.size() > 1)
                            {
                                for (it = LogConfigStrings.begin() + 1; it != LogConfigStrings.end(); it++)
                                {
                                    char* CommaIndex = (char*)oscl_strstr(*it, ",");
                                    if (CommaIndex != NULL)
                                    {
                                        *CommaIndex = '\0';
                                        LoggerConfigElement obj;
                                        uint32 logLevel;
                                        PV_atoi(*it, 'd', oscl_strlen(*it), logLevel);
                                        obj.iLogLevel = logLevel;
                                        obj.iLoggerString = CommaIndex + 1;
                                        iLoggerConfigElements.push_back(obj);
                                    }
                                }
                            }
                            else
                            {
                                //Add the config element for complete logging fo all the modules
                                LoggerConfigElement obj;
                                obj.iLoggerString = "";
                                obj.iLogLevel = 8;
                                iLoggerConfigElements.push_back(obj);
                            }
                        }
                    }
                    iLogFile.Close();
                    iLogFileRead = true;
                }
            }
            return retval;
        }