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;
}
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);
            );
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;
}
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););
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 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;
}
        //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;
        }