コード例 #1
0
ファイル: manifestor_audio.cpp プロジェクト: Audioniek/driver
Manifestor_Audio_c::Manifestor_Audio_c(void)
	: DestroySyncrhonizationPrimatives(false)
{
	MANIFESTOR_DEBUG(">><<\n");
	Configuration.ManifestorName = "Audio";
	Configuration.StreamType = StreamTypeAudio;
	Configuration.DecodeBufferDescriptor = &InitialDecodeBufferDescriptor;
	Configuration.PostProcessControlBufferCount = 16;
	if (InitializationStatus != ManifestorNoError)
	{
		MANIFESTOR_ERROR("Initialization status not valid - aborting init\n");
		return;
	}
	if (OS_InitializeMutex(&BufferQueueLock) != OS_NO_ERROR)
	{
		MANIFESTOR_ERROR("Unable to create the buffer queue lock\n");
		InitializationStatus = ManifestorError;
		return;
	}
	if (OS_InitializeEvent(&BufferQueueUpdated) != OS_NO_ERROR)
	{
		MANIFESTOR_ERROR("Unable to create the buffer queue update event\n");
		OS_TerminateMutex(&BufferQueueLock);
		InitializationStatus = ManifestorError;
		return;
	}
	DestroySyncrhonizationPrimatives = true;
	RelayfsIndex = st_relayfs_getindex(ST_RELAY_SOURCE_AUDIO_MANIFESTOR);
	Manifestor_Audio_c::Reset();
}
コード例 #2
0
ファイル: stack_generic.cpp プロジェクト: miciomaxx/driver
StackGeneric_c::StackGeneric_c(unsigned int MaxEntries)
{
    OS_InitializeMutex(&Lock);
    Limit       = MaxEntries;
    Level       = 0;
    Storage     = new unsigned int[Limit];
    InitializationStatus = (Storage == NULL) ? StackNoMemory : StackNoError;
}
コード例 #3
0
BufferManager_Generic_c::BufferManager_Generic_c(void)
{
	InitializationStatus = BufferError;
//
	OS_InitializeMutex(&Lock);
	TypeDescriptorCount = 0;
	ListOfBufferPools = NULL;
//
	InitializationStatus = BufferNoError;
}
コード例 #4
0
RingGeneric_c::RingGeneric_c( unsigned int MaxEntries )
{
    OS_InitializeMutex( &Lock );
    OS_InitializeEvent( &Signal );

    Limit       = MaxEntries + 1;
    NextExtract = 0;
    NextInsert  = 0;
    Storage     = new unsigned int[Limit];

    InitializationStatus = (Storage == NULL) ? RingNoMemory : RingNoError;
}
コード例 #5
0
Buffer_Generic_c::Buffer_Generic_c( 	BufferManager_Generic_t	  Manager,
					BufferPool_Generic_t	  Pool,
					BufferDataDescriptor_t	 *Descriptor )
{
//

    InitializationStatus	= BufferError;

    //
    // Initialize class data
    //

    this->Manager		= Manager;
    this->Pool			= Pool;

    Next			= NULL;
    ReferenceCount		= 0;
    BufferBlock			= NULL;
    ListOfMetaData		= 0;
    DataSize			= 0;

    memset( OwnerIdentifier, 0x00, MAX_BUFFER_OWNER_IDENTIFIERS * sizeof(unsigned int) );
    memset( AttachedBuffers, 0x00, MAX_ATTACHED_BUFFERS * sizeof(Buffer_t) );

    OS_InitializeMutex( &Lock );

    //
    // Get a memory block descriptor, and initialize it
    //

    BufferBlock	= new struct BlockDescriptor_s;
    if( BufferBlock == NULL )
    {
        report( severity_error, "Buffer_Generic_c::Buffer_Generic_c - Unable to create a block descriptor record.\n" );
        return;
    }

    BufferBlock->Next				= NULL;
    BufferBlock->Descriptor			= Descriptor;
    BufferBlock->AttachedToPool			= false;
    BufferBlock->Size				= 0;
    BufferBlock->Address[CachedAddress]		= NULL;
    BufferBlock->Address[UnCachedAddress]	= NULL;
    BufferBlock->Address[PhysicalAddress]	= NULL;
    BufferBlock->MemoryAllocatorDevice		= ALLOCATOR_INVALID_DEVICE;

//

    InitializationStatus	= BufferNoError;
}
コード例 #6
0
// /////////////////////////////////////////////////////////////////////////
//
//      The Constructor function
//
FrameParser_Base_c::FrameParser_Base_c(void)
{
	InitializationStatus        = FrameParserError;
//
	OS_InitializeMutex(&Lock);
	CodedFrameBufferPool    = NULL;
	FrameBufferCount        = 0;
	DecodeBufferPool        = NULL;
	DecodeBufferCount       = 0;
	OutputRing          = NULL;
	BufferManager       = NULL;
	StreamParametersDescriptor  = NULL;
	StreamParametersType    = NOT_SPECIFIED;
	StreamParametersPool    = NULL;
	StreamParametersBuffer  = NULL;
	FrameParametersDescriptor   = NULL;
	FrameParametersType     = NOT_SPECIFIED;
	FrameParametersPool     = NULL;
	FrameParametersBuffer   = NULL;
	Buffer          = NULL;
	BufferLength        = 0;
	BufferData          = NULL;
	CodedFrameParameters    = NULL;
	ParsedFrameParameters   = NULL;
	StartCodeList       = NULL;
	FirstDecodeAfterInputJump   = true;
	SurplusDataInjected     = false;
	ContinuousReverseJump   = false;
	NextDecodeFrameIndex    = 0;
	NextDisplayFrameIndex   = 0;
	NativeTimeBaseLine      = INVALID_TIME;
	LastNativeTimeUsedInBaseline = INVALID_TIME;
	FrameToDecode       = false;
	PlaybackSpeed       = 1;
	PlaybackDirection       = PlayForward;
	//
	// Fill out default values for the configuration record
	//
	memset(&Configuration, 0x00, sizeof(FrameParserConfiguration_t));
	Configuration.FrameParserName       = "Unspecified";
	Configuration.StreamParametersCount     = 32;
	Configuration.StreamParametersDescriptor    = NULL;
	Configuration.FrameParametersCount      = 32;
	Configuration.FrameParametersDescriptor = NULL;
	Configuration.MaxReferenceFrameCount    = 32;       // Only need limiting for specific codecs (IE h264)
	Configuration.SupportSmoothReversePlay  = false;
	Configuration.InitializeStartCodeList   = false;
//
	InitializationStatus        = FrameParserNoError;
}
コード例 #7
0
AllocatorSimple_c::AllocatorSimple_c(unsigned int     BufferSize,
									 unsigned int     SegmentSize,
									 unsigned char   *PhysicalAddress)
{
	InitializationStatus        = AllocatorError;
	OS_InitializeMutex(&Lock);
	OS_InitializeEvent(&EntryFreed);
	this->BufferSize        = BufferSize;
	this->SegmentSize       = SegmentSize;
	this->PhysicalAddress       = PhysicalAddress;
	BeingDeleted        = false;
	InAllocate          = false;
	Free();
	InitializationStatus        = AllocatorNoError;
}
コード例 #8
0
ファイル: osinline.c プロジェクト: Audioniek/driver
// -----------------------------------------------------------------------------------------------
// The event functions
OS_Status_t OS_InitializeEvent(OS_Event_t *Event)
{
	*Event = (OS_Event_t)OSDEV_Malloc(sizeof(struct OS_Event_s));
	if (*Event != NULL)
	{
		OS_InitializeMutex(&((*Event)->Mutex));
		if (OSDEV_InitializeWaitQueue(&((*Event)->Queue)) == OSDEV_NoError)
		{
			(*Event)->Valid = false;
			return OS_NO_ERROR;
		}
		else
			OSDEV_Free(*Event);
	}
	return OS_ERROR;
}
コード例 #9
0
DemultiplexorStatus_t   Demultiplexor_Base_c::CreateContext(DemultiplexorContext_t   *Context)
{
	unsigned int            i;
	DemultiplexorContext_t      NewContext;
	DemultiplexorBaseContext_t      BaseContext;
//
	NewContext  = (DemultiplexorContext_t)new unsigned char[SizeofContext];
	memset(NewContext, 0x00, SizeofContext);
	BaseContext = (DemultiplexorBaseContext_t)NewContext;
	for (i = 0; i < DEMULTIPLEXOR_MAX_STREAMS; i++)
	{
		BaseContext->Streams[i].Stream      = NULL;
		BaseContext->Streams[i].Identifier  = INVALID_INDEX;
	}
	OS_InitializeMutex(&BaseContext->Lock);
	*Context    = NewContext;
	return DemultiplexorNoError;
}
コード例 #10
0
//}}}  
//{{{  Init
//{{{  doxynote
/// \brief Create and initialise all of the necessary player components for a new player stream
/// \param Player               The player
/// \param PlayerPlayback       The player playback to which the stream will be added
/// \param DemultiplexorContext Context variable used to manipulate the demultiplexor (TS).
/// \return                     Havana status code, HavanaNoError indicates success.
//}}}  
HavanaStatus_t HavanaDemux_c::Init     (class Player_c*         Player,
                                        PlayerPlayback_t        PlayerPlayback,
                                        DemultiplexorContext_t  DemultiplexorContext)
{
    DEMUX_DEBUG("\n");

    this->Player                = Player;
    this->PlayerPlayback        = PlayerPlayback;
    this->DemuxContext          = DemultiplexorContext;

    if (OS_InitializeMutex (&InputLock) != OS_NO_ERROR)
    {
        DEMUX_ERROR ("Failed to initialize InputLock mutex\n");
        return HavanaNoMemory;
    }

    return HavanaNoError;
}
コード例 #11
0
//}}}
//{{{  Init
HavanaStatus_t HavanaPlayback_c::Init  (class HavanaPlayer_c*   HavanaPlayer,
                                        class Player_c*         Player,
                                        class BufferManager_c*  BufferManager)
{
    PlayerStatus_t      PlayerStatus    = PlayerNoError;

    PLAYBACK_DEBUG("\n");

    this->HavanaPlayer          = HavanaPlayer;
    this->Player                = Player;
    this->BufferManager         = BufferManager;

    if (!LockInitialised)
    {
        if (OS_InitializeMutex (&Lock) != OS_NO_ERROR)
        {
            PLAYBACK_ERROR ("Failed to initialize InputLock mutex\n");
            return HavanaNoMemory;
        }
        LockInitialised         = true;
    }

    if (OutputCoordinator == NULL)
        OutputCoordinator   = new OutputCoordinator_Base_c();
    if (OutputCoordinator == NULL)
    {
        PLAYBACK_ERROR("Unable to create output coordinator\n");
        return HavanaNoMemory;
    }

    if (PlayerPlayback == NULL)
    {
        PlayerStatus    = Player->CreatePlayback (OutputCoordinator, &PlayerPlayback, true);    // Indicate we want the creation event
        if (PlayerStatus != PlayerNoError)
        {
            PLAYBACK_ERROR("Unable to create playback context %x\n", PlayerStatus);
            return HavanaNoMemory;
        }
    }

    //    PLAYBACK_DEBUG("%p\n", PlayerPlayback);

    return HavanaNoError;
}
コード例 #12
0
BufferPool_Generic_c::BufferPool_Generic_c(     BufferManager_Generic_t   Manager,
						BufferDataDescriptor_t   *Descriptor, 
						unsigned int              NumberOfBuffers,
						unsigned int              Size,
						void                     *MemoryPool[3],
						void                     *ArrayOfMemoryBlocks[][3],
						char			 *DeviceMemoryPartitionName )
{
unsigned int            i,j;
BufferStatus_t          Status;
Buffer_Generic_t        Buffer;
unsigned int            ItemSize;

//

    InitializationStatus        = BufferError;

    //
    // Initialize class data
    //

    this->Manager               = Manager;
    Next                        = NULL;

    OS_InitializeMutex( &Lock );
    OS_InitializeEvent( &BufferReleaseSignal );

    ReferenceCount		= 0;

    BufferDescriptor            = NULL;
    this->NumberOfBuffers       = 0;
    CountOfBuffers              = 0;
    this->Size                  = 0;

    ListOfBuffers               = NULL;
    FreeBuffer                  = NULL;
    this->MemoryPool[0]         = NULL;
    this->MemoryPool[1]         = NULL;
    this->MemoryPool[2]         = NULL;
    MemoryPoolAllocator         = NULL;
    MemoryPoolAllocatorDevice   = ALLOCATOR_INVALID_DEVICE;
    memset( MemoryPartitionName, 0x00, ALLOCATOR_MAX_PARTITION_NAME_SIZE );
    if( DeviceMemoryPartitionName != NULL )
	strncpy( MemoryPartitionName, DeviceMemoryPartitionName, ALLOCATOR_MAX_PARTITION_NAME_SIZE-1 );

    BufferBlock                 = NULL;
    ListOfMetaData              = NULL;

    AbortGetBuffer              = false;
    BufferReleaseSignalWaitedOn = false;

    CountOfReferencedBuffers	= 0;
    TotalAllocatedMemory	= 0;
    TotalUsedMemory		= 0;

    //
    // Record parameters
    //

    this->BufferDescriptor      = Descriptor;
    this->NumberOfBuffers       = NumberOfBuffers;
    this->Size                  = Size;

    if( MemoryPool != NULL )
    {
	this->MemoryPool[0]     = MemoryPool[0];
	this->MemoryPool[1]     = MemoryPool[1];
	this->MemoryPool[2]     = MemoryPool[2];
    }

    //
    // Shall we create the buffer class instances
    //

    if( NumberOfBuffers != NOT_SPECIFIED )
    {
	//
	// Get a ring to hold the free buffers
	//

	FreeBuffer      = new RingGeneric_c(NumberOfBuffers);
	if( (FreeBuffer == NULL) || (FreeBuffer->InitializationStatus != RingNoError) )
	{
	    report( severity_error, "BufferPool_Generic_c::BufferPool_Generic_c - Failed to create free buffer ring.\n" );
	    TidyUp();
	    return;
	}

	//
	// Can we allocate the memory for the buffers
	//

	if( Descriptor->AllocateOnPoolCreation )
	{
	    Status      = CheckMemoryParameters( Descriptor, true, Size, MemoryPool, ArrayOfMemoryBlocks, DeviceMemoryPartitionName, 
						 "BufferPool_Generic_c::BufferPool_Generic_c", &ItemSize );
	    if( Status != BufferNoError )
	    {
		TidyUp();
		return;
	    }

	    //
	    // Create a buffer block descriptor record
	    //

	    BufferBlock                         = new struct BlockDescriptor_s;
	    if( BufferBlock == NULL )
	    {
		report( severity_error, "BufferPool_Generic_c::BufferPool_Generic_c - Failed to allocate block descriptor.\n" );
		TidyUp();
		return;
	    }

	    BufferBlock->Descriptor                     = Descriptor;
	    BufferBlock->AttachedToPool                 = true;
	    BufferBlock->Size                           = ItemSize * NumberOfBuffers;
	    BufferBlock->MemoryAllocatorDevice          = ALLOCATOR_INVALID_DEVICE;

	    Status      = AllocateMemoryBlock( BufferBlock, true, 0, NULL, MemoryPool, ArrayOfMemoryBlocks, DeviceMemoryPartitionName, 
						"BufferPool_Generic_c::BufferPool_Generic_c" );
	    if( Status != BufferNoError )
	    {
		TidyUp();
		return;
	    }
	}

	//
	// Now create the buffers
	//

	for( i=0; i<NumberOfBuffers; i++ )
	{
	    Buffer              = new Buffer_Generic_c( Manager, this, Descriptor );
	    if( (Buffer == NULL) || (Buffer->InitializationStatus != BufferNoError) )
	    {
		InitializationStatus            = BufferInsufficientMemoryForBuffer;
		if( Buffer != NULL )
		{
		    InitializationStatus        = Buffer->InitializationStatus;
		    delete Buffer;
		}

		report( severity_error, "BufferPool_Generic_c::BufferPool_Generic_c - Failed to create buffer (%08x)\n", InitializationStatus );
		TidyUp();
		return;
	    }

	    Buffer->Next        = ListOfBuffers;
	    Buffer->Index       = i;
	    ListOfBuffers       = Buffer;

	    FreeBuffer->Insert( (unsigned int)Buffer );

	    //
	    // Have we allocated the buffer data block
	    //

	    if( Descriptor->AllocateOnPoolCreation )
	    {
		Buffer->DataSize                                = 0;
		Buffer->BufferBlock->AttachedToPool             = true;
		Buffer->BufferBlock->Size                       = ItemSize;
		Buffer->BufferBlock->MemoryAllocatorDevice      = ALLOCATOR_INVALID_DEVICE;
		Buffer->BufferBlock->Address[CachedAddress]     = NULL;
		Buffer->BufferBlock->Address[UnCachedAddress]   = NULL;
		Buffer->BufferBlock->Address[PhysicalAddress]   = NULL;

		if( Descriptor->AllocationSource == AllocateIndividualSuppliedBlocks )
		{
		    for( j=0; j<3; j++ )
			Buffer->BufferBlock->Address[j]         = ArrayOfMemoryBlocks[i][j];
		}
		else
		{
		    for( j=0; j<3; j++ )
			if( BufferBlock->Address[j] != NULL )
			    Buffer->BufferBlock->Address[j]     = (unsigned char *)BufferBlock->Address[j] + (i * ItemSize);
		}
	    }
	}
    }

    //
    // If we have pool memory, and we have not used it already, then we need to initialize the allocation mechanism.
    //

    if( (MemoryPool != NULL) && !Descriptor->AllocateOnPoolCreation )
    {
#if 0
	MemoryPoolAllocator     = new AllocatorSimple_c( Size, Descriptor->AllocationUnitSize, (unsigned char *)MemoryPool[PhysicalAddress] );
#else
	MemoryPoolAllocator     = new AllocatorSimple_c( Size, 1, (unsigned char *)MemoryPool[PhysicalAddress] );
#endif
	if( (MemoryPoolAllocator == NULL) || (MemoryPoolAllocator->InitializationStatus != AllocatorNoError) )
	{
	    report( severity_error, "BufferPool_Generic_c::BufferPool_Generic_c - Failed to initialize MemoryPool allocator\n" );
	    TidyUp();
	    return;
	}
    }

//

    InitializationStatus        = BufferNoError;
}
コード例 #13
0
Player_Generic_c::Player_Generic_c( void )
{
unsigned int    i;

//

    InitializationStatus        = BufferError;

//

    OS_InitializeMutex( &Lock );

    ShutdownPlayer              = false;

    BufferManager               = NULL;
    PlayerControlStructurePool  = NULL;
    InputBufferPool             = NULL;
    DemultiplexorCount          = 0;
    ListOfPlaybacks             = NULL;

    AudioCodedFrameCount	= PLAYER_AUDIO_DEFAULT_CODED_FRAME_COUNT;
    AudioCodedMemorySize	= PLAYER_AUDIO_DEFAULT_CODED_MEMORY_SIZE;
    AudioCodedFrameMaximumSize	= PLAYER_AUDIO_DEFAULT_CODED_FRAME_MAXIMUM_SIZE;
    VideoCodedFrameCount	= PLAYER_VIDEO_DEFAULT_CODED_FRAME_COUNT;
    VideoCodedMemorySize	= PLAYER_VIDEO_DEFAULT_CODED_MEMORY_SIZE;
    VideoCodedFrameMaximumSize	= PLAYER_VIDEO_DEFAULT_CODED_FRAME_MAXIMUM_SIZE;
    OtherCodedFrameCount	= PLAYER_OTHER_DEFAULT_CODED_FRAME_COUNT;
    OtherCodedMemorySize	= PLAYER_OTHER_DEFAULT_CODED_MEMORY_SIZE;
    OtherCodedFrameMaximumSize	= PLAYER_OTHER_DEFAULT_CODED_FRAME_MAXIMUM_SIZE;

    strcpy( AudioCodedMemoryPartitionName, PLAYER_AUDIO_DEFAULT_CODED_FRAME_PARTITION_NAME );
    strcpy( VideoCodedMemoryPartitionName, PLAYER_VIDEO_DEFAULT_CODED_FRAME_PARTITION_NAME );
    strcpy( OtherCodedMemoryPartitionName, PLAYER_OTHER_DEFAULT_CODED_FRAME_PARTITION_NAME );

    memset( &PolicyRecord, 0x00, sizeof(PlayerPolicyState_t) );

    EventListHead               = INVALID_INDEX;
    EventListTail               = INVALID_INDEX;
    for( i=0; i<PLAYER_MAX_OUTSTANDING_EVENTS; i++ )
	EventList[i].Record.Code = EventIllegalIdentifier;

    for( i=0; i<PLAYER_MAX_EVENT_SIGNALS; i++ )
	ExternalEventSignals[i].Signal  = NULL;

    OS_InitializeEvent( &InternalEventSignal );

//

    SetPolicy( PlayerAllPlaybacks, PlayerAllStreams, (PlayerPolicy_t)PolicyPlayoutAlwaysPlayout,		PolicyValuePlayout );
    SetPolicy( PlayerAllPlaybacks, PlayerAllStreams, (PlayerPolicy_t)PolicyPlayoutAlwaysDiscard,		PolicyValueDiscard );

    SetPolicy( PlayerAllPlaybacks, PlayerAllStreams, PolicyMasterClock,						PolicyValueVideoClockMaster );
    SetPolicy( PlayerAllPlaybacks, PlayerAllStreams, PolicyManifestFirstFrameEarly,				PolicyValueApply );

    SetPolicy( PlayerAllPlaybacks, PlayerAllStreams, PolicyExternalTimeMapping,					PolicyValueDisapply );
    SetPolicy( PlayerAllPlaybacks, PlayerAllStreams, PolicyExternalTimeMappingVsyncLocked,			PolicyValueDisapply );
    SetPolicy( PlayerAllPlaybacks, PlayerAllStreams, PolicyAVDSynchronization,   				PolicyValueApply );

    SetPolicy( PlayerAllPlaybacks, PlayerAllStreams, PolicyClampPlaybackIntervalOnPlaybackDirectionChange,	PolicyValueApply );
    SetPolicy( PlayerAllPlaybacks, PlayerAllStreams, PolicyTrickModeDomain,	 				PolicyValueTrickModeAuto );

    SetPolicy( PlayerAllPlaybacks, PlayerAllStreams, (PlayerPolicy_t)PolicyStatisticsOnAudio,			PolicyValueDisapply );
    SetPolicy( PlayerAllPlaybacks, PlayerAllStreams, (PlayerPolicy_t)PolicyStatisticsOnVideo,			PolicyValueDisapply );

    SetPolicy( PlayerAllPlaybacks, PlayerAllStreams, PolicyDiscardLateFrames,	 				PolicyValueDiscardLateFramesAfterSynchronize );
    SetPolicy( PlayerAllPlaybacks, PlayerAllStreams, PolicyVideoStartImmediate,					PolicyValueApply );
    SetPolicy( PlayerAllPlaybacks, PlayerAllStreams, PolicySyncStartImmediate,   				PolicyValueDisapply );

    SetPolicy( PlayerAllPlaybacks, PlayerAllStreams, PolicyRebaseOnFailureToDeliverDataInTime,			PolicyValueApply );
    SetPolicy( PlayerAllPlaybacks, PlayerAllStreams, PolicyRebaseOnFailureToDecodeInTime,			PolicyValueApply );

    SetPolicy( PlayerAllPlaybacks, PlayerAllStreams, PolicyH264AllowNonIDRResynchronization,			PolicyValueApply );
    SetPolicy( PlayerAllPlaybacks, PlayerAllStreams, PolicyH264AllowBadPreProcessedFrames,			PolicyValueApply );
    SetPolicy( PlayerAllPlaybacks, PlayerAllStreams, PolicyH264TreatDuplicateDpbValuesAsNonReferenceFrameFirst,	PolicyValueApply );
    SetPolicy( PlayerAllPlaybacks, PlayerAllStreams, PolicyH264ForcePicOrderCntIgnoreDpbDisplayFrameOrdering,	PolicyValueDisapply );
    SetPolicy( PlayerAllPlaybacks, PlayerAllStreams, PolicyH264TreatTopBottomPictureStructAsInterlaced,		PolicyValueApply );

    SetPolicy( PlayerAllPlaybacks, PlayerAllStreams, PolicyMPEG2ApplicationType,				PolicyValueMPEG2ApplicationDvb );
    SetPolicy( PlayerAllPlaybacks, PlayerAllStreams, PolicyMPEG2DoNotHonourProgressiveFrameFlag,		PolicyValueDisapply );

    SetPolicy( PlayerAllPlaybacks, PlayerAllStreams, PolicyClockPullingLimit2ToTheNPartsPerMillion,		8 );

    SetPolicy( PlayerAllPlaybacks, PlayerAllStreams, PolicyLimitInputInjectAhead,				PolicyValueDisapply );

    SetPolicy( PlayerAllPlaybacks, PlayerAllStreams, PolicyDecimateDecoderOutput,				PolicyValueDecimateDecoderOutputDisabled);

    SetPolicy( PlayerAllPlaybacks, PlayerAllStreams, PolicySymmetricJumpDetection,				PolicyValueDisapply );
    SetPolicy( PlayerAllPlaybacks, PlayerAllStreams, PolicyPtsForwardJumpDetectionThreshold,			4 );

    SetPolicy( PlayerAllPlaybacks, PlayerAllStreams, PolicyPixelAspectRatioCorrection, 				PolicyValuePixelAspectRatioCorrectionDisabled);

    SetPolicy( PlayerAllPlaybacks, PlayerAllStreams, PolicyAllowFrameDiscardAtNormalSpeed,			PolicyValueDisapply );

    SetPolicy( PlayerAllPlaybacks, PlayerAllStreams, PolicyOperateCollator2InReversibleMode,			PolicyValueDisapply );

    SetPolicy( PlayerAllPlaybacks, PlayerAllStreams, PolicyVideoOutputWindowResizeSteps,			1 );

    SetPolicy( PlayerAllPlaybacks, PlayerAllStreams, PolicyIgnoreStreamUnPlayableCalls,				PolicyValueDisapply );

    SetPolicy( PlayerAllPlaybacks, PlayerAllStreams, PolicyUsePTSDeducedDefaultFrameRates,			PolicyValueApply );

    //
    // Here sits Nicks debug setting for player policies, do not add normal initialization after this point
    //

#if 0
    SetPolicy( PlayerAllPlaybacks, PlayerAllStreams, PolicyAVDSynchronization,   				PolicyValueDisapply );
    SetPolicy( PlayerAllPlaybacks, PlayerAllStreams, PolicyDiscardLateFrames,	 				PolicyValueDiscardLateFramesNever );
//    SetPolicy( PlayerAllPlaybacks, PlayerAllStreams, PolicyMasterClock,                                         PolicyValueSystemClockMaster );
    SetPolicy( PlayerAllPlaybacks, PlayerAllStreams, PolicyAllowFrameDiscardAtNormalSpeed,			PolicyValueApply );
    SetPolicy( PlayerAllPlaybacks, PlayerAllStreams, PolicyRebaseOnFailureToDecodeInTime,			PolicyValueDisapply );
#endif

//
#ifdef __TDT__
    // Overwrite default settings (see class_definitions/player_types.h for definitions
    // and descriptions).

    // Discarding late frames significantly improves the H.264 deadlock behavior.
    // Obviously late frames cause the player to run out of buffers if not discarded
    // immediately. It even does not matter how many decode buffers are available -
    // all of them will be used (up to 32 if enough memory is availble in LMI_VID).
    if(discardlateframe == 0)
        SetPolicy( PlayerAllPlaybacks, PlayerAllStreams, PolicyDiscardLateFrames,                                       PolicyValueDiscardLateFramesNever );
    else if(discardlateframe == 1)
        SetPolicy( PlayerAllPlaybacks, PlayerAllStreams, PolicyDiscardLateFrames,                                       PolicyValueDiscardLateFramesAlways );
    else
        SetPolicy( PlayerAllPlaybacks, PlayerAllStreams, PolicyDiscardLateFrames,                                       PolicyValueDiscardLateFramesAfterSynchronize );
    // Usage of the immediate start depends on the LateFrame policy. Though, it is not
    // quite clear what is meant by "agressive policy".
    SetPolicy( PlayerAllPlaybacks, PlayerAllStreams, PolicyVideoStartImmediate,                                 PolicyValueApply );

    // This will fix N24 an hopefully every other interlaced-progressive miss interpretertation 
    SetPolicy( PlayerAllPlaybacks, PlayerAllStreams, PolicyMPEG2DoNotHonourProgressiveFrameFlag,                PolicyValueApply );

    //SetPolicy( PlayerAllPlaybacks, PlayerAllStreams, PolicyLimitInputInjectAhead,                             PolicyValueApply );
#endif

    InitializationStatus        = BufferNoError;
}
コード例 #14
0
//}}}  
//{{{  Init
HavanaStatus_t HavanaPlayer_c::Init (void)
{
    HAVANA_DEBUG("\n");

    if (Player == NULL)
        Player          = new Player_Generic_c();
    if (Player == NULL)
    {
        HAVANA_ERROR("Unable to create player - insufficient memory\n");
        return HavanaNoMemory;
    }

    //{{{  Event management
    // Create event signal thread and input mutexes
    if (EventSignalThreadId == OS_INVALID_THREAD)
    {
        if (OS_InitializeMutex (&Lock) != OS_NO_ERROR)
        {
            HAVANA_ERROR ("Failed to initialize Lock mutex\n");
            return HavanaNoMemory;
        }

        if (OS_InitializeEvent (&EventSignal) != OS_NO_ERROR)
        {
            HAVANA_ERROR ("Failed to initialize EventSignal\n");
            OS_TerminateMutex (&Lock);
            return HavanaError;
        }
        if (OS_InitializeEvent (&EventSignalThreadTerminated) != OS_NO_ERROR)
        {
            HAVANA_ERROR ("Failed to initialize EventSignalThreadTerminated event\n");
            OS_TerminateEvent (&EventSignal);
            OS_TerminateMutex (&Lock);
            return HavanaError;
        }
        EventSignalThreadRunning        = true;
        if (OS_CreateThread (&EventSignalThreadId, EventSignalThreadStub, this, "Havana player Event Signal Thread", OS_MID_PRIORITY) != OS_NO_ERROR)
        {
            HAVANA_ERROR("Unable to create Display Signal thread\n");
            EventSignalThreadRunning    = false;
            EventSignalThreadId         = OS_INVALID_THREAD;
            OS_TerminateEvent (&EventSignalThreadTerminated);
            OS_TerminateEvent (&EventSignal);
            OS_TerminateMutex (&Lock);
            return HavanaError;
        }
    }
    //}}}  

    if (BufferManager == NULL)
        BufferManager   = new BufferManager_Generic_c();
    if (BufferManager == NULL)
    {
        HAVANA_ERROR("Unable to create buffer manager - insufficient memory\n");
        return HavanaNoMemory;
    }
    Player->RegisterBufferManager (BufferManager);

    if (Demultiplexor == NULL)
        Demultiplexor   = new Demultiplexor_Ts_c ();
    if (Demultiplexor == NULL)
    {
        HAVANA_ERROR("Unable to create transport stream demultiplexor\n");
        return HavanaNoMemory;
    }
    Player->RegisterDemultiplexor (Demultiplexor);

    DisplayDevice       = NULL;

    if (Player->SetEventSignal (PlayerAllPlaybacks, PlayerAllStreams, EventAllEvents, &EventSignal) != PlayerNoError)
    {
        HAVANA_ERROR("Failed to set up player event signal\n");
        return HavanaError;
    }
    //Player->SpecifySignalledEvents (PlayerAllPlaybacks, PlayerAllStreams, EventAllEvents); // Must be done by every stream


    return HavanaNoError;
}