📄 videoinputpin.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 "VideoInputPin.h"
#include "VbiPin.h"
#include <ksmedia.h>
#include "CommonGuid.h"
KSPIN_MEDIUM VideoInputPinMedium = {XBAR_VIDEO_OUT_GUID, 0, 0 };
static
NTSTATUS
process(
KSPIN *p_ks_pin
)
{
// Get the frame buffer via the leading edge STREAM_POINTER
KSSTREAM_POINTER *p_strm_ptr;
p_strm_ptr = KsPinGetLeadingEdgeStreamPointer( p_ks_pin,
KSSTREAM_POINTER_STATE_LOCKED );
if( !p_strm_ptr )
return STATUS_UNSUCCESSFUL;
if( p_strm_ptr->StreamHeader )
{
if( p_strm_ptr->StreamHeader->FrameExtent !=
sizeof KS_TVTUNER_CHANGE_INFO )
{
KsStreamPointerAdvance( p_strm_ptr );
return STATUS_UNSUCCESSFUL;
}
}
else
{
return STATUS_UNSUCCESSFUL;
}
// Get the tv tuner change info out of the frame buffer
KS_TVTUNER_CHANGE_INFO *p_tv_info = (KS_TVTUNER_CHANGE_INFO*)
p_strm_ptr->StreamHeader->Data;
if( !p_tv_info )
{
return STATUS_UNSUCCESSFUL;
}
KSFILTER *p_filt = KsPinGetParentFilter( p_ks_pin );
if( !p_filt )
{
return STATUS_UNSUCCESSFUL;
}
if( !p_filt->Descriptor )
{
return STATUS_UNSUCCESSFUL;
}
VbiPin *p_vbi_pin = NULL;
ULONG pin_cnt = p_filt->Descriptor->PinDescriptorsCount;
// Find the vbi pin for this filter if one is instantiated
for( ULONG i = 0; i < pin_cnt; i++ )
{
KsFilterAcquireControl( p_filt );
KSPIN *p_pin = KsFilterGetFirstChildPin( p_filt, i );
KsFilterReleaseControl( p_filt );
if( p_pin &&
IsEqualGUID( *(p_pin->Descriptor->PinDescriptor.Name),
PINNAME_VIDEO_VBI ) )
{
p_vbi_pin = (VbiPin*)p_pin->Context;
break;
}
}
// If there isn't a vbi pin instantiated on this filter return
if( !p_vbi_pin )
{
KsStreamPointerAdvance( p_strm_ptr );
return STATUS_SUCCESS;
}
// Pass the tv tuner change info to the VbiPin object
p_vbi_pin->setTVInfo( p_tv_info );
KsStreamPointerAdvance( p_strm_ptr );
return STATUS_SUCCESS;
}
const
KSPIN_DISPATCH
VideoInputPinDispatch =
{
NULL, // Pin Create
NULL, // Pin Close
process, // Pin Process
NULL, // Pin Reset
NULL, // Pin Set Data Format
NULL, // Pin Set Device State
NULL, // Pin Connect
NULL, // Pin Disconnect
NULL, // Clock Dispatch
NULL // Allocator Dispatch
};
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -