AVCSampleEntry::AVCSampleEntry(AVCConfigurationBox* avc_box,
                               DecoderSpecificInfo* dsi,
                               uint16 width,
                               uint16 height)
        : Atom(AVC_SAMPLE_ENTRY),
        _width(width),
        _height(height),
        _decoderSpecificInfo(dsi),
        _ownDecoderSpecificInfo(false),
        _pAVCConfigurationBox(avc_box),
        _ownAVCConfigurationBox(false)
{
    oscl_memset(_reserved, 0, sizeof(_reserved));
    _dataReferenceIndex = 0;
    _preDefined1 = 0;
    _reserved1 = 0;
    oscl_memset(_predefined2, 0, sizeof(_predefined2));
    _horizResolution = 0;
    _vertResolution = 0;
    _reserved2 = 0;
    _preDefined2 = 0;
    oscl_memset(_compressorName, 0, sizeof(_compressorName));
    _depth = 0;
    _predefined3 = 0;

    _pPASPBox = NULL;
    _pMPEG4BitRateBox = NULL;

    _success = true;
    _mp4ErrorCode = EVERYTHING_FINE;
}
CallbackContainer::CallbackContainer(CallbackParentInt *parentinterface)
{
    iParent = parentinterface;

    iCallbackType.EventHandler = CallbackEventHandler;
    iCallbackType.EmptyBufferDone = CallbackEmptyBufferDone;
    iCallbackType.FillBufferDone = CallbackFillBufferDone;

#if PROXY_INTERFACE
    oscl_memset(pEventHandlerArray, 0, sizeof(pEventHandlerArray));
    oscl_memset(pEmptyBufferDoneArray, 0, sizeof(pEmptyBufferDoneArray));
    oscl_memset(pFillBufferDoneArray, 0, sizeof(pFillBufferDoneArray));
#endif
};
void TSC_324m::IndicationMisc(TIndicationMisc type,
                              TPVChannelId channelId,
                              uint32 param,
                              OsclAny* param1)
{
    OSCL_UNUSED_ARG(param1);
    PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE,
                    (0, "TSC_324m::IndicationMisc type(%d), channelId(%d), param(%d), param1(%x)",
                     type, channelId, param, param1));

    S_ControlMsgHeader infHeader;
    S_MiscellaneousIndication miscellaneousIndication;
    oscl_memset(&miscellaneousIndication, 0, sizeof(S_MiscellaneousIndication));

    switch (type)
    {
        case EVideoTemporalSpatialTradeOffIdc:
            miscellaneousIndication.logicalChannelNumber = (uint16)channelId;
            miscellaneousIndication.miType.index = 9;
            miscellaneousIndication.miType.videoTemporalSpatialTradeOff = (uint8)param;
            break;
        default:
            return;
    }

    Tsc_SendDataSet(&infHeader, H245_PRIMITIVE, E_PtvId_Idc_Mscl, 0, 0,
                    (uint8*)&miscellaneousIndication, sizeof(S_MiscellaneousIndication));
    iH245->DispatchControlMessage(&infHeader);
}
Ejemplo n.º 4
0
void TSC_blc::BlcEtbRps(TPVChannelId incoming_lcn, TPVChannelId outgoing_lcn)
{
    S_ControlMsgHeader  infHeader;
    S_ReverseData       parameter;
    PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE,
                    (0,
                     "TSC_blc::BlcEtbRps incoming(%d), outgoing(%d)\n", incoming_lcn, outgoing_lcn));

    // Buffer Allocate
    oscl_memset(&parameter, 0, sizeof(S_ReverseData));

    // ESTABLISH.response primitive - Parameter(REVERSE_DATA)
    parameter.option_of_reverseLogicalChannelParameters = true;
    parameter.reverseLogicalChannelParameters.reverseLogicalChannelNumber =
        (uint16)incoming_lcn; // WWU_BLC: change 0->3
    parameter.reverseLogicalChannelParameters.option_of_portNumber = false;
    parameter.reverseLogicalChannelParameters.option_of_ackMultiplexParameters = false;
    parameter.reverseLogicalChannelParameters.option_of_replacementFor = false;

    Tsc_SendDataSet(&infHeader,
                    H245_PRIMITIVE,
                    E_PtvId_Blc_Etb_Rps,
                    incoming_lcn,
                    outgoing_lcn,
                    (uint8*)&parameter,
                    sizeof(S_ReverseData));

    // Primitive Send
    iH245->DispatchControlMessage(&infHeader);
}
OSCL_EXPORT_REF PVMFStatus PvmfPortBaseImpl::PeerConnect(PVMFPortInterface* aPort)
{
    PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_STACK_TRACE,
                    (0, "0x%x PvmfPortBaseImpl::PeerConnect: aPort=0x%x", this, aPort));

    if (!aPort)
    {
        PVLOGGER_LOGMSG(PVLOGMSG_INST_REL, iLogger, PVLOGMSG_ERR,
                        (0, "0x%x PvmfPortBaseImpl::PeerConnect: Error - Connecting to invalid port", this));
        return PVMFErrArgument;
    }

    if (iConnectedPort)
    {
        PVLOGGER_LOGMSG(PVLOGMSG_INST_REL, iLogger, PVLOGMSG_ERR,
                        (0, "0x%x PvmfPortBaseImpl::PeerConnect: Error - Already connected", this));
        return PVMFFailure;
    }

    iConnectedPort = aPort;

#if PVMF_PORT_BASE_IMPL_STATS
    // Reset statistics
    oscl_memset(&iStats, 0, sizeof(PvmfPortBaseImplStats));
#endif

    PortActivity(PVMF_PORT_ACTIVITY_CONNECT);
    return PVMFSuccess;
}
Ejemplo n.º 6
0
bool CDecoderVideo::Init2(uint8 *volbuf[],
							int32 *volbuf_size,
							int32 nLayers,
							int32* iWidth,
							int32* iHeight,
							int *mode){
	_iVideoCtrls = (VideoDecControls *) new VideoDecControls;
    if (_iVideoCtrls){
        oscl_memset(_iVideoCtrls, 0, sizeof(VideoDecControls));	
		if (PVInitVideoDecoder((VideoDecControls *)_iVideoCtrls, (uint8 **) volbuf, (int32*)volbuf_size, (int32)nLayers, *iWidth, *iHeight, (MP4DecodingMode) *mode))
		{
			GetVideoDimensions(iWidth, iHeight);
			*mode = (int)PVGetDecBitstreamMode((VideoDecControls *)_iVideoCtrls);
			PVSetReferenceYUV(_iVideoCtrls, (uint8*)m_pbyDecoded);
			PVSetPostProcType(_iVideoCtrls, 0);			
			VideoDecData *video = (VideoDecData *) _iVideoCtrls->videoDecoderData;
			/*video->vol[0]->quantPrecision = 4;
			video->vol[0]->errorResDisable = 1;
			video->vol[0]->useReverseVLC = 1;
			video->intra_acdcPredDisable = 0;
			video->vol[0]->scalability = 0;
			video->vol[0]->scalType = 1;*/
			return true;
		}
		else
		{
			return false;
		}
	}
	else
		return false;
}
Ejemplo n.º 7
0
void RTD::PtvTrnsCfmSend(int32 Delay)
{
    S_InfHeader        header ;
    S_Delay_Rtd        delay_Rtd ;

    /* Allocate primitive parameter area and clear it */
    oscl_memset(&delay_Rtd  , 0 , sizeof(S_Delay_Rtd)) ;
    /* Set delay time */
    delay_Rtd.Delay_Value = Delay ;

    /* Set information type */
    header.InfType = H245_PRIMITIVE ;
    /* Set promitive id */
    header.InfId = E_PtvId_Rtd_Trf_Cfm ;
    /* clear supplement */
    header.InfSupplement1 = 0 ;
    header.InfSupplement2 = 0 ;
    /* Set parameter address */
    header.pParameter = (uint8*) & delay_Rtd ;
    /* Set parameter size */
    header.Size = sizeof(S_Delay_Rtd) ;

    /* Send primitive to tsc */
    PrimitiveSend(&header) ;
}
OSCL_EXPORT_REF PVMFStatus PVMp4FFComposerPort::Connect(PVMFPortInterface* aPort)
{
    LOG_STACK_TRACE((0, "PVMp4FFComposerPort::Connect: aPort=0x%x", aPort));

    if (!aPort)
    {
        LOG_ERR((0, "PVMp4FFComposerPort::Connect: Error - Connecting to invalid port"));
        return PVMFErrArgument;
    }

    if (iConnectedPort)
    {
        LOG_ERR((0, "PVMp4FFComposerPort::Connect: Error - Already connected"));
        return PVMFFailure;
    }

    OsclAny* temp = NULL;
    aPort->QueryInterface(PVMI_CAPABILITY_AND_CONFIG_PVUUID, temp);
    PvmiCapabilityAndConfig *config = OSCL_STATIC_CAST(PvmiCapabilityAndConfig*, temp);

    if (!config)
    {
        LOG_ERR((0, "PVMp4FFComposerPort::Connect: Error - Peer port does not support capability interface"));
        return PVMFFailure;
    }

    PVMFStatus status = PVMFSuccess;
    switch (iTag)
    {
        case PVMF_MP4FFCN_PORT_TYPE_SINK:
            status = NegotiateInputSettings(config);
            break;
        default:
            LOG_ERR((0, "PVMp4FFComposerPort::Connect: Error - Invalid port tag"));
            status = PVMFFailure;
    }

    if (status != PVMFSuccess)
    {
        LOG_ERR((0, "PVMp4FFComposerPort::Connect: Error - Settings negotiation failed. status=%d", status));
        return status;
    }

    //Automatically connect the peer.
    if (aPort->PeerConnect(this) != PVMFSuccess)
    {
        LOG_ERR((0, "PVMp4FFComposerPort::Connect: Error - Peer Connect failed"));
        return PVMFFailure;
    }

    iConnectedPort = aPort;

#if PVMF_PORT_BASE_IMPL_STATS
    // Reset statistics
    oscl_memset((OsclAny*)&(PvmfPortBaseImpl::iStats), 0, sizeof(PvmfPortBaseImplStats));
#endif

    PortActivity(PVMF_PORT_ACTIVITY_CONNECT);
    return PVMFSuccess;
}
OMX_BOOL OmxAacDecoder::AacDecInit(OMX_U32 aDesiredChannels)
{
    Int                         Status;

    iMemReq = PVMP4AudioDecoderGetMemRequirements();
    ipMem = oscl_malloc(iMemReq);

    if (0 == ipMem)
    {
        return OMX_FALSE;
    }

    oscl_memset(&iExt, 0, sizeof(tPVMP4AudioDecoderExternal));

    iExt.inputBufferCurrentLength = 0;
    iExt.remainderBits        = 0;      // Not needed anymore.
    iExt.inputBufferMaxLength = PVMP4AUDIODECODER_INBUFSIZE;
    iExt.outputFormat         = OUTPUTFORMAT_16PCM_INTERLEAVED;
    iExt.desiredChannels      = aDesiredChannels;
    iExt.aacPlusEnabled       = TRUE;
    iAacInitFlag = 0;
    iInputUsedLength = 0;
    //This var is required to do init again inbetween
    iNumOfChannels           = aDesiredChannels;


    Status = PVMP4AudioDecoderInitLibrary(&iExt, ipMem);
    return OMX_TRUE;
}
Ejemplo n.º 10
0
OSCL_EXPORT_REF GAU::GAU()
        : free_buffer_states_when_done(false)
{
    oscl_memset(this, 0, sizeof(*this));
    buf.num_fragments = 0;
    numMediaSamples = 0;
};
Ejemplo n.º 11
0
Word16 dtx_enc_reset(dtx_encState *st)
{
    Word16 i;

    if (st == (dtx_encState *) NULL)
    {
        return(-1);
    }

    st->hist_ptr = 0;
    st->log_en_index = 0;
    st->init_lsf_vq_index = 0;
    st->lsp_index[0] = 0;
    st->lsp_index[1] = 0;
    st->lsp_index[2] = 0;

    /* Init lsp_hist[] */
    for (i = 0; i < DTX_HIST_SIZE; i++)
    {
        oscl_memcpy(&st->lsp_hist[i * M], lsp_init_data, M*sizeof(Word16));
    }

    /* Reset energy history */
    oscl_memset(st->log_en_hist, 0, sizeof(Word16)*M);
    st->dtxHangoverCount = DTX_HANG_CONST;
    st->decAnaElapsedCount = 32767;

    return(1);
}
Ejemplo n.º 12
0
int CEncoderVideo::Init(JNIEnv*  env, int iWidth, int iHeight){
	m_iSizeEncoded = 0;

	int iRet=0;
	m_byEncodedVideo = env->NewByteArray(BUFFER_ENCODE_SIZE_VIDEO);
	m_pbyEncodedVideo = env->GetByteArrayElements(m_byEncodedVideo, 0);

	m_pvEncVid = CPVM4VEncoder::New(-1);
	
	if (m_pvEncVid!=NULL){
	
		iRet=1;
		m_inForm.iFrameWidth  = iWidth;
		m_inForm.iFrameHeight = iHeight;
		m_inForm.iFrameRate   = 15;
		m_inForm.iFrameOrientation =-1;
		m_inForm.iVideoFormat = ECVEI_YUV420;
		
		oscl_memset(&m_enParam, 0, sizeof(m_enParam));

		m_enParam.iEncodeID = 0;
		m_enParam.iNumLayer = 1;
		m_enParam.iFrameWidth[0] = iWidth;
		m_enParam.iFrameHeight[0] = iHeight;
		m_enParam.iBitRate[0] = DEFAULT_BITRATE;		
		m_enParam.iFrameRate[0] = (float)DEFAULT_FRAME_RATE;
		m_enParam.iFrameQuality = 10;
		m_enParam.iIFrameInterval = DEFAULT_INTRA_PERIOD;
		//m_enParam.iNumIntraMBRefresh =
		//m_enParam.iBufferDelay	
		m_enParam.iContentType = ECVEI_H263;//ECVEI_STREAMING;//ECVEI_H263;
		m_enParam.iRateControlType = EVBR_1;
		m_enParam.iRDOptimal = false;
		m_enParam.iIquant[0] = 31; // default to unset
		m_enParam.iPquant[0] = 31;
		m_enParam.iBquant[0] = 31;
		m_enParam.iSearchRange = 16;
		m_enParam.iMV8x8 = false;
		m_enParam.iMVHalfPel = true;
		m_enParam.iSceneDetection = false;
		m_enParam.iPacketSize = 256;
		m_enParam.iNoCurrentSkip = false;
		m_enParam.iNoFrameSkip = false;
		m_enParam.iClipDuration = 0;
		m_enParam.iProfileLevel = ECVEI_CORE_LEVEL2;
		
		m_inData.iTimeStamp=0;
		if (m_pvEncVid->Initialize(&m_inForm, &m_enParam)==ECVEI_SUCCESS){
			iRet=1;
			__android_log_write(ANDROID_LOG_DEBUG, "CEncoderVideo::Init", "Video Encoder Initialized");		
		}
		else
			__android_log_write(ANDROID_LOG_DEBUG, "CEncoderVideo::Init", "Video Encoder Failed");		
	}
	else{
		__android_log_write(ANDROID_LOG_DEBUG, "CEncoderVideo::Init", "Video Encoder Can't alloc encoder");
	}
Ejemplo n.º 13
0
OSCL_EXPORT_REF void* _oscl_audit_calloc(size_t num, size_t nBytes, OsclAuditCB & auditCB, const char * file_name, const int line_num)
{
    size_t size = num * nBytes;
    void* ptr = _oscl_audit_malloc(size, auditCB, file_name, line_num);
    if (ptr)
        oscl_memset(ptr, 0, size);
    //note: return pointer can be null.
    return ptr;
}
PVMFStatus PVMFWAVFFParserOutPort::Connect(PVMFPortInterface* aPort)
{

    PVLOGGER_LOGMSG(PVLOGMSG_INST_MLDBG, iLogger, PVLOGMSG_STACK_TRACE
                    , (0, "PVMFWAVFFParserOutPort::FormatUpdated %s", iFormat.getMIMEStrPtr()));

    if (!aPort)
    {
        LOG_ERR((0, "PVMFWAVFFParserOutPort::Connect: Error - Connecting to invalid port"));
        return PVMFErrArgument;
    }

    if (iConnectedPort)
    {
        LOG_ERR((0, "PVMFWAVFFParserOutPort::Connect: Error - Already connected"));
        return PVMFFailure;
    }

    OsclAny* temp = NULL;
    aPort->QueryInterface(PVMI_CAPABILITY_AND_CONFIG_PVUUID, temp);
    PvmiCapabilityAndConfig *config = OSCL_STATIC_CAST(PvmiCapabilityAndConfig*, temp);

    if (!config)
    {
        LOG_ERR((0, "PVMFWAVFFParserOutPort::Connect: Error - Peer port does not support capability interface"));
        return PVMFFailure;
    }

    PVMFStatus status = PVMFSuccess;

    status = iNode->NegotiateSettings(config);

    if (status != PVMFSuccess)
    {
        LOG_ERR((0, "PVMFWAVFFParserOutPort::Connect: Error - Settings negotiation failed. status=%d", status));
        return status;
    }

    //Automatically connect the peer.
    if (aPort->PeerConnect(this) != PVMFSuccess)
    {
        LOG_ERR((0, "PVMFWAVFFParserOutPort::Connect: Error - Peer Connect failed"));
        return PVMFFailure;
    }

    iConnectedPort = aPort;

#if PVMF_PORT_BASE_IMPL_STATS
    // Reset statistics
    oscl_memset((OsclAny*)&(PvmfPortBaseImpl::iStats), 0, sizeof(PvmfPortBaseImplStats));
#endif

    PortActivity(PVMF_PORT_ACTIVITY_CONNECT);
    return PVMFSuccess;

}
void PVMFSocketPort::Construct()
{
    iConfig = NULL;
    iLogger = PVLogger::GetLoggerObject("PVMFSocketPort");
    oscl_memset(&iStats, 0, sizeof(PvmfPortBaseImplStats));
    iNumFramesConsumed = 0;
    PvmiCapabilityAndConfigPortFormatImpl::Construct(
        PVMF_SOCKET_PORT_SPECIFIC_ALLOCATOR
        , PVMF_SOCKET_PORT_SPECIFIC_ALLOCATOR_VALTYPE);
}
OSCL_EXPORT_REF void PvmfPortBaseImpl::Construct()
{
    PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_STACK_TRACE,
                    (0, "0x%x PvmfPortBaseImpl::Construct: iTag=%d", this, iTag));

#if PVMF_PORT_BASE_IMPL_STATS
    oscl_memset(&iStats, 0, sizeof(PvmfPortBaseImplStats));
#endif
    PortActivity(PVMF_PORT_ACTIVITY_CREATED);
}
OsclMemPoolResizableAllocator::MemPoolBufferInfo* OsclMemPoolResizableAllocator::addnewmempoolbuffer(uint32 aBufferAlignedSize)
{
    OSCL_ASSERT(aBufferAlignedSize > 0);
    OSCL_ASSERT(aBufferAlignedSize == oscl_mem_aligned_size(aBufferAlignedSize));

    // Allocate memory for one buffer
    uint8* newbuffer = NULL;
    if (iMemPoolBufferAllocator)
    {
        // Use the outside allocator
        newbuffer = (uint8*)iMemPoolBufferAllocator->ALLOCATE(aBufferAlignedSize);
    }
    else
    {
        // Allocate directly from heap
        newbuffer = (uint8*)OSCL_MALLOC(aBufferAlignedSize);
    }

    if (newbuffer == NULL)
    {
        OSCL_LEAVE(OsclErrNoMemory);
        // OSCL_UNUSED_RETURN(NULL);    This statement was removed to avoid compiler warning for Unreachable Code
    }

#if OSCL_MEM_FILL_WITH_PATTERN
    oscl_memset(newbuffer, 0x55, aBufferAlignedSize);
#endif

    // Fill in the buffer info header
    MemPoolBufferInfo* newbufferinfo = (MemPoolBufferInfo*)newbuffer;
    newbufferinfo->iBufferPreFence = OSCLMEMPOOLRESIZABLEALLOCATOR_PREFENCE_PATTERN;
    newbufferinfo->iStartAddr = (OsclAny*)(newbuffer + iBufferInfoAlignedSize);
    newbufferinfo->iEndAddr = (OsclAny*)(newbuffer + aBufferAlignedSize - 1);
    newbufferinfo->iBufferSize = aBufferAlignedSize;
    newbufferinfo->iNumOutstanding = 0;
    newbufferinfo->iNextFreeBlock = (MemPoolBlockInfo*)(newbufferinfo->iStartAddr);
    newbufferinfo->iAllocatedSz = 0;
    newbufferinfo->iBufferPostFence = OSCLMEMPOOLRESIZABLEALLOCATOR_POSTFENCE_PATTERN;

    // Put in one free block in the new buffer
    MemPoolBlockInfo* freeblockinfo = (MemPoolBlockInfo*)(newbufferinfo->iStartAddr);
    freeblockinfo->iBlockPreFence = OSCLMEMPOOLRESIZABLEALLOCATOR_PREFENCE_PATTERN;
    freeblockinfo->iNextFreeBlock = NULL;
    freeblockinfo->iPrevFreeBlock = NULL;
    freeblockinfo->iBlockSize = aBufferAlignedSize - iBufferInfoAlignedSize;
    freeblockinfo->iBlockBuffer = (uint8*)freeblockinfo + iBlockInfoAlignedSize;
    freeblockinfo->iParentBuffer = newbufferinfo;
    freeblockinfo->iBlockPostFence = OSCLMEMPOOLRESIZABLEALLOCATOR_POSTFENCE_PATTERN;

    // Add the new buffer to the list
    iMemPoolBufferList.push_front(newbufferinfo);

    return newbufferinfo;
}
        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;

        }
void PVMFOMXEncPort::Construct()
{
    iLogger = PVLogger::GetLoggerObject("PVMFOMXEncPort");
    oscl_memset(&iStats, 0, sizeof(PvmfPortBaseImplStats));
    iNumFramesGenerated = 0;
    iNumFramesConsumed = 0;
    iTrackConfig = NULL;
    iTrackConfigSize = 0;
    iTimescale = 0;

}
void PVMFOMXVideoDecPort::Construct()
{
    iLogger = PVLogger::GetLoggerObject("PVMFOMXVideoDecPort");
    oscl_memset(&iStats, 0, sizeof(PvmfPortBaseImplStats));
    iNumFramesGenerated = 0;
    iNumFramesConsumed = 0;
    iTrackConfig = NULL;
    iTrackConfigSize = 0;
    PvmiCapabilityAndConfigPortFormatImpl::Construct(
        PVMF_OMX_VIDEO_DEC_PORT_INPUT_FORMATS
        , PVMF_OMX_VIDEO_DEC_PORT_INPUT_FORMATS_VALTYPE);
}
OSCL_EXPORT_REF PvmfPortBaseImpl::PvmfPortBaseImpl(int32 aTag, PVMFPortActivityHandler* aNode, const char*name)
        : PVMFPortInterface(aNode),
        iConnectedPortBusy(false),
        iInputSuspended(false),
        iTag(aTag)
{
    iLogger = PVLogger::GetLoggerObject("PvmfPortBaseImpl");
    iIncomingQueue.Construct(DEFAULT_DATA_QUEUE_CAPACITY, DEFAULT_DATA_QUEUE_CAPACITY, DEFAULT_READY_TO_RECEIVE_THRESHOLD_PERCENT);
    iOutgoingQueue.Construct(DEFAULT_DATA_QUEUE_CAPACITY, DEFAULT_DATA_QUEUE_CAPACITY, DEFAULT_READY_TO_RECEIVE_THRESHOLD_PERCENT);
    SetName(name);
    oscl_memset(&iStats, 0, sizeof(PvmfPortBaseImplStats));
}
OsclAny* OsclMemPoolResizableAllocator::allocateblock(MemPoolBlockInfo& aBlockPtr, uint32 aNumAlignedBytes)
{
    OSCL_ASSERT(aNumAlignedBytes > 0);
    OSCL_ASSERT(aNumAlignedBytes == oscl_mem_aligned_size(aNumAlignedBytes));

    if (aNumAlignedBytes == 0)
    {
        OSCL_LEAVE(OsclErrArgument);
        // OSCL_UNUSED_RETURN(NULL);    This statement was removed to avoid compiler warning for Unreachable Code
    }

    // Remove the free block from the double linked list
    if (aBlockPtr.iPrevFreeBlock == NULL && aBlockPtr.iNextFreeBlock != NULL)
    {
        // Removing from the beginning of the free list
        aBlockPtr.iNextFreeBlock->iPrevFreeBlock = NULL;
        aBlockPtr.iParentBuffer->iNextFreeBlock = aBlockPtr.iNextFreeBlock;
    }
    else if (aBlockPtr.iPrevFreeBlock != NULL && aBlockPtr.iNextFreeBlock == NULL)
    {
        // Removing from the end of the free list
        aBlockPtr.iPrevFreeBlock->iNextFreeBlock = NULL;
    }
    else if (aBlockPtr.iPrevFreeBlock == NULL && aBlockPtr.iNextFreeBlock == NULL)
    {
        // Free list becomes empty so update the parent buffer's link
        aBlockPtr.iParentBuffer->iNextFreeBlock = NULL;
    }
    else
    {
        // Removing from middle of the free list
        aBlockPtr.iPrevFreeBlock->iNextFreeBlock = aBlockPtr.iNextFreeBlock;
        aBlockPtr.iNextFreeBlock->iPrevFreeBlock = aBlockPtr.iPrevFreeBlock;
    }

    aBlockPtr.iNextFreeBlock = NULL;
    aBlockPtr.iPrevFreeBlock = NULL;

    aBlockPtr.iParentBuffer->iAllocatedSz += aBlockPtr.iBlockSize;

    // Resize the block if too large
    uint32 extraspace = aBlockPtr.iBlockSize - iBlockInfoAlignedSize - aNumAlignedBytes;
    if (extraspace > (iBlockInfoAlignedSize + OSCLMEMPOOLRESIZABLEALLOCATOR_MIN_BUFFERSIZE))
    {
        trim(aBlockPtr.iBlockBuffer, extraspace);
    }

#if OSCL_MEM_FILL_WITH_PATTERN
    oscl_memset(aBlockPtr.iBlockBuffer, 0x55, (aBlockPtr.iBlockSize - iBlockInfoAlignedSize));
#endif
    return aBlockPtr.iBlockBuffer;
}
Ejemplo n.º 23
0
void ML::MsgLoopOffSend(void)
{
    S_MaintenanceLoopOffCommand    maintenanceLoopOffCommand ;
    S_H245Msg                      h245Msg ;

    oscl_memset(&maintenanceLoopOffCommand, 0, sizeof(S_MaintenanceLoopOffCommand)) ;

    h245Msg.Type1 = H245_MSG_CMD ;
    h245Msg.Type2 = MSGTYP_ML_OFF_CMD ;
    h245Msg.pData = (uint8*) & maintenanceLoopOffCommand ;

    MessageSend(&h245Msg) ;
}
PVMFWAVFFParserOutPort::PVMFWAVFFParserOutPort(int32 aTag, PVMFWAVFFParserNode* aNode)
        : PvmfPortBaseImpl(aTag, aNode, "WavFFParOut(Audio)")
{
    //Construct();
    iLogger = PVLogger::GetLoggerObject("PVMFWAVFFParserOutPort");
    oscl_memset(&iStats, 0, sizeof(PvmfPortBaseImplStats));
    iNumFramesGenerated = 0;
    iNumFramesConsumed = 0;
    PvmiCapabilityAndConfigPortFormatImpl::Construct(
        PVMF_WAVFFPARSER_PORT_OUTPUT_FORMATS,
        PVMF_WAVFFPARSER_PORT_OUTPUT_FORMATS_VALTYPE);
    iNode = aNode;
}
PVMFAvcEncPort::PVMFAvcEncPort(int32 aTag, PVMFAvcEncNode* aNode, int32 aPriority, const char* aName)
        :  PvmfPortBaseImpl(aTag, this,
                            PVMF_AVCENC_PORT_CAPACITY, PVMF_AVCENC_PORT_RESERVE, PVMF_AVCENC_PORT_THRESHOLD,
                            PVMF_AVCENC_PORT_CAPACITY, PVMF_AVCENC_PORT_RESERVE, PVMF_AVCENC_PORT_THRESHOLD, aName),
        OsclActiveObject(aPriority, "PVMFAvcEncPort"),
        iFormat(PVMF_FORMAT_UNKNOWN),
        iNode(aNode)
{
    AddToScheduler();
    iLogger = PVLogger::GetLoggerObject("PVMFAvcEncPort");
#if PVMF_PORT_BASE_IMPL_STATS
    oscl_memset((OsclAny*)&(PvmfPortBaseImpl::iStats), 0, sizeof(PvmfPortBaseImplStats));
#endif
}
void PVMFBufferDataSource::TimeoutOccurred(int32 timerID, int32 timeoutInfo)
{
    OSCL_UNUSED_ARG(timerID);
    unsigned bytesToSend = timeoutInfo;
    if (bytesToSend <= 0)
        return;

    if (!IsConnected())
        return;

    // Create new media data buffer
    OsclSharedPtr<PVMFMediaDataImpl> mediaDataImpl = iMediaDataAlloc->allocate(bytesToSend);
    PVMFSharedMediaDataPtr mediaData;
    int leavecode = 0;
    OSCL_TRY(leavecode, mediaData = PVMFMediaData::createMediaData(mediaDataImpl));
    OSCL_FIRST_CATCH_ANY(leavecode, return);

    // Send FSI if available
    if (iFsi)
    {
        OsclSharedPtr<PVMFMediaDataImpl> fsiMediaDataImpl = iMediaDataAlloc->allocate(iFsiLen);
        PVMFSharedMediaDataPtr fsiMediaData;
        OSCL_TRY(leavecode, fsiMediaData = PVMFMediaData::createMediaData(fsiMediaDataImpl));
        OSCL_FIRST_CATCH_ANY(leavecode, return);
        OsclRefCounterMemFrag fsi_frag;
        fsiMediaData->getMediaFragment(0, fsi_frag);
        oscl_memcpy((uint8*)fsi_frag.getMemFragPtr(), iFsi, iFsiLen);
        fsi_frag.getMemFrag().len = iFsiLen;
        mediaData->setFormatSpecificInfo(fsi_frag);
        OSCL_DEFAULT_FREE(iFsi);
        iFsi = NULL;
        iFsiLen = 0;
    }

    // Retrieve memory fragment to write to
    OsclRefCounterMemFrag refCtrMemFrag;
    mediaData->getMediaFragment(0, refCtrMemFrag);
    if (refCtrMemFrag.getCapacity() < bytesToSend)
        return;

    oscl_memset((uint8*)refCtrMemFrag.getMemFragPtr(), 7, bytesToSend);
    mediaDataImpl->setMediaFragFilledLen(0, bytesToSend);
    mediaData->setTimestamp(iTimestamp);
    iTimestamp += iSampleInterval;

    // Send frame to downstream node
    PVMFSharedMediaMsgPtr mediaMsg;
    convertToPVMFMediaMsg(mediaMsg, mediaData);
    QueueOutgoingMsg(mediaMsg);
}
OSCL_EXPORT_REF PVMFStatus PVMp4FFComposerPort::PeerConnect(PVMFPortInterface* aPort)
{
    PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_STACK_TRACE,
                    (0, "0x%x PVMp4FFComposerPort::PeerConnect: aPort=0x%x", this, aPort));

    if (!aPort)
    {
        PVLOGGER_LOGMSG(PVLOGMSG_INST_REL, iLogger, PVLOGMSG_ERR,
                        (0, "0x%x PVMp4FFComposerPort::PeerConnect: Error - Connecting to invalid port", this));
        return PVMFErrArgument;
    }

    if (iConnectedPort)
    {
        PVLOGGER_LOGMSG(PVLOGMSG_INST_REL, iLogger, PVLOGMSG_ERR,
                        (0, "0x%x PVMp4FFComposerPort::PeerConnect: Error - Already connected", this));
        return PVMFFailure;
    }

    // When connection is initiated by peer, this port still needs to query the peer
    // for input format configuration data
    OsclAny* temp = NULL;
    aPort->QueryInterface(PVMI_CAPABILITY_AND_CONFIG_PVUUID, temp);
    PvmiCapabilityAndConfig *config = OSCL_STATIC_CAST(PvmiCapabilityAndConfig*, temp);

    if (!config)
    {
        LOG_ERR((0, "PVMp4FFComposerPort::PeerConnect: Error - Peer port does not support capability interface"));
        return PVMFFailure;
    }

    PVMFStatus status = GetInputParametersFromPeer(config);
    if (status != PVMFSuccess)
    {
        LOG_ERR((0, "PVMp4FFComposerPort::PeerConnect: Error - GetVideoInputParametersFromPeer failed. status=%d",
                 status));
        return status;
    }

    iConnectedPort = aPort;

#if PVMF_PORT_BASE_IMPL_STATS
    // Reset statistics
    oscl_memset((OsclAny*)&(PvmfPortBaseImpl::iStats), 0, sizeof(PvmfPortBaseImplStats));
#endif

    PortActivity(PVMF_PORT_ACTIVITY_CONNECT);
    return PVMFSuccess;
}
void OsclFileStats::LogAll(PVLogger* aLogger, uint32 aLogLevel)
{
    PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, aLogger, aLogLevel
                    , (0, "OsclFileStats(0x%x): +++++++++++++++++++++ Begin", iContainer));
    for (uint32 op = 0;op < EOsclFileOp_Last;op++)
    {
        if (iStats[op].iOpCount > 0)
        {
            Log((TOsclFileOp)op, aLogger, aLogLevel);
        }
    }
    //clear all stats once they've been dumped.
    oscl_memset(iStats, 0, sizeof(iStats));
    PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, aLogger, aLogLevel
                    , (0, "OsclFileStats(0x%x): +++++++++++++++++++++ End", iContainer));
}
void TSC_324m::Tsc_IdcSkew(TPVChannelId lcn1, TPVChannelId lcn2, uint16 skew)
{
    PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE,
                    (0, "TSC_324m::Tsc_IdcSkew lcn1(%d), lcn2(%d), skew(%d)",
                     lcn1, lcn2, skew));
    S_ControlMsgHeader infHeader;
    S_H223SkewIndication skewIndication;
    oscl_memset(&skewIndication, 0, sizeof(S_H223SkewIndication));
    skewIndication.logicalChannelNumber1 = (uint16)lcn1;
    skewIndication.logicalChannelNumber2 = (uint16)lcn2;
    skewIndication.skew = skew;

    Tsc_SendDataSet(&infHeader, H245_PRIMITIVE, E_PtvId_Idc_H223skw, 0, 0,
                    (uint8*)&skewIndication, sizeof(S_H223SkewIndication));
    iH245->DispatchControlMessage(&infHeader);
}
Ejemplo n.º 30
0
OSCL_EXPORT_REF OSCL_FILEMGMT_ERR_TYPE oscl_stat(const char *path, OSCL_STAT_BUF *statbuf)
{
    oscl_memset(statbuf, 0, sizeof(OSCL_STAT_BUF));
    struct stat buf;
    if (stat(path, &buf) == 0)
    {
        if (buf.st_mode & S_IRUSR)
            statbuf->perms |= OSCL_FILEMGMT_PERMS_READ;
        if (buf.st_mode & S_IWUSR)
            statbuf->perms |= OSCL_FILEMGMT_PERMS_WRITE;
        if (buf.st_mode & S_IFDIR)
            statbuf->mode |= OSCL_FILEMGMT_MODE_DIR;
        return OSCL_FILEMGMT_E_OK;
    }
    return OSCL_FILEMGMT_E_PATH_NOT_FOUND;
}