📄 slicedccbuffer.cpp
字号:
/*+++ *******************************************************************\
*
* Copyright and Disclaimer:
*
* ---------------------------------------------------------------
* This software is provided "AS IS" without warranty of any kind,
* either expressed or implied, including but not limited to the
* implied warranties of noninfringement, merchantability and/or
* fitness for a particular purpose.
* ---------------------------------------------------------------
*
* Copyright (c) 2008 Conexant Systems, Inc.
* All rights reserved.
*
\******************************************************************* ---*/
#include "SlicedCCBuffer.h"
#include "AncillaryPacket.h"
#include "BasePin.h"
/////////////////////////////////////////////////////////////////////////////////////////
SlicedCCBuffer::SlicedCCBuffer():
_p_pin(NULL)
{
KeInitializeMutex(&_mutex, 0);
}
/////////////////////////////////////////////////////////////////////////////////////////
VOID SlicedCCBuffer::parseBuffer(AncillaryPacket* p_packet)
{
//Get the buffer from the packet
DWORD buffer_size;
PSLICED_CC_PACKET p_packet_buffer = (PSLICED_CC_PACKET) p_packet->getBuffer(&buffer_size);
//Fail if the buffer is too small to hold the data.
if(buffer_size < sizeof(SLICED_CC_PACKET))
{
return;
}
//6 is Mako's code for sliced CC, and it should show up in the SDID field of the buffer.
if((p_packet_buffer->data_id2 & 0xF) != 6)
{
return;
}
KeWaitForSingleObject(&_mutex, Executive, KernelMode, FALSE, NULL );
if(_p_pin)
{
PKSSTREAM_POINTER p_buffer = _p_pin->getNextBuffer();
if(p_buffer)
{
PBYTE p_data = (PBYTE)p_buffer->StreamHeader->Data;
///////////////////////////////////////////////
///////////////////////////////////////////////
p_data[0] = p_packet_buffer->sliced_cc0;
p_data[1] = p_packet_buffer->sliced_cc1;
/////////////////////////////////////////////
p_buffer->StreamHeader->DataUsed = 2;
_p_pin->onBufferComplete();
}
}
KeReleaseMutex(&_mutex, FALSE);
}
/////////////////////////////////////////////////////////////////////////////////////////
VOID SlicedCCBuffer::setPin(BasePin* p_pin)
{
KeWaitForSingleObject(&_mutex, Executive, KernelMode, FALSE, NULL );
_p_pin = p_pin;
KeReleaseMutex(&_mutex, FALSE);
}
/////////////////////////////////////////////////////////////////////////////////////////
VOID SlicedCCBuffer::releasePin()
{
KeWaitForSingleObject(&_mutex, Executive, KernelMode, FALSE, NULL );
_p_pin = NULL;
KeReleaseMutex(&_mutex, FALSE);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -