Пример #1
0
////////////////////////////////////////////////////////////////////////////
///
/// Pass accumulated data to the output ring and maintain class state variables.
///
/// \todo If we were more clever about buffer management we wouldn't have to
/// copy the frame header onto the stack.
///
/// \return Collator status code, CollatorNoError indicates success.
///
CollatorStatus_t Collator_PesAudio_c::InternalFrameFlush(void)
{
	CollatorStatus_t Status;
	unsigned char CopiedFrameHeader[FrameHeaderLength];
//
	AssertComponentState("Collator_PesAudio_c::InternalFrameFlush", ComponentRunning);
//
	COLLATOR_DEBUG(">><<\n");
	// temporarily copy the following frame header (if there is one) to the stack
	if (AccumulatedFrameReady)
	{
		memcpy(CopiedFrameHeader, StoredFrameHeader, FrameHeaderLength);
		AccumulatedDataSize -= FrameHeaderLength;
		//Assert( BufferBase + AccumulatedDataLength == StoredFrameHeader );
	}
	// now pass the complete frame onward
	Status = Collator_Pes_c::InternalFrameFlush();
	if (Status != CodecNoError)
		return Status;
	if (AccumulatedFrameReady)
	{
		// put the stored frame header into the new buffer
		Status = AccumulateData(FrameHeaderLength, CopiedFrameHeader);
		if (Status != CollatorNoError)
			COLLATOR_DEBUG("Cannot accumulate data #8 (%d)\n", Status);
		AccumulatedFrameReady = false;
	}
	else
	{
		ResetCollatorStateAfterForcedFrameFlush();
	}
	return CodecNoError;
}
Пример #2
0
CollatorStatus_t Collator_PesAudioLpcm_c::Reset( void )
{
  CollatorStatus_t Status;
	
  //
	
  COLLATOR_DEBUG(">><<\n");

  Status = Collator_PesAudio_c::Reset();
  if( Status != CollatorNoError )
    return Status;
    
  // FrameHeaderLength belongs to Collator_PesAudio_c so we must set it after the class has been reset    
  FrameHeaderLength = LPCM_FRAME_HEADER_SIZE;

  Configuration.StreamIdentifierMask       = 0xff;
  Configuration.StreamIdentifierCode       = 0xbd; // lpcm packets always have a stream_id equal to 0xbd
  Configuration.BlockTerminateMask         = 0xff;
  Configuration.BlockTerminateCode         = 0x00;
  Configuration.IgnoreCodesRangeStart      = 0x01; // All slice codes
  Configuration.IgnoreCodesRangeEnd        = 0xbd - 1;
  Configuration.InsertFrameTerminateCode   = false;
  Configuration.TerminalCode               = 0;
  Configuration.ExtendedHeaderLength       = AudioPesPrivateDataLength[StreamType];
  Configuration.DeferredTerminateFlag      = false;

  ResetCollatorStateAfterForcedFrameFlush();

  return CollatorNoError;
}