⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 streamreqque.c

📁 视频DVD解码器驱动 软件简介:视频DVD解码器驱动。
💻 C
字号:
/*++

Copyright (c) 1998  G&G Lab Corporation

Module Name:

    StreamReqQue.c 

  Copyright (c) 1998 G&G Lab Corporation.  All Rights Reserved.

  Some portions adapted with permission from code Copyright (c) 1997-1998 Toshiba Corporation

--*/
#include "strmini.h"
#include "ks.h"
#include "ksmedia.h"

#include "debug.h"
#include "DeviceInit.h"
#include "StreamQue.h"
#include "DvdToshHard.h" // header for DvdToshHard.lib routines hiding proprietary HW stuff


void DeviceQueue_init( PHW_DEVICE_EXTENSION pHwDevExt )
{
	pHwDevExt->StreamReqQue.count = 0;
	pHwDevExt->StreamReqQue.top = pHwDevExt->StreamReqQue.bottom = NULL;
}

void DeviceQueue_put( PHW_DEVICE_EXTENSION pHwDevExt, PHW_STREAM_REQUEST_BLOCK pOrigin, PHW_STREAM_REQUEST_BLOCK pSrb )
{
	pSrb->NextSRB = NULL;
	if ( pHwDevExt->StreamReqQue.top == NULL ) {
		pHwDevExt->StreamReqQue.top = pHwDevExt->StreamReqQue.bottom = pSrb;
		pHwDevExt->StreamReqQue.count++;
		return;
	}

	pHwDevExt->StreamReqQue.bottom->NextSRB = pSrb;
	pHwDevExt->StreamReqQue.bottom = pSrb;
	pHwDevExt->StreamReqQue.count++;

	return;
}



void DeviceQueue_put_video( PHW_DEVICE_EXTENSION pHwDevExt, PHW_STREAM_REQUEST_BLOCK pSrb )
{
	SRBIndex( pSrb ) = 0;
	SRBpfnEndSrb( pSrb ) = NULL;
	SRBparamSrb( pSrb ) = NULL;

	DeviceQueue_put( pHwDevExt, pHwDevExt->StreamReqQue.top, pSrb );
}

void DeviceQueue_put_audio( PHW_DEVICE_EXTENSION pHwDevExt, PHW_STREAM_REQUEST_BLOCK pSrb )
{
	SRBIndex( pSrb ) = 0;
	SRBpfnEndSrb( pSrb ) = NULL;
	SRBparamSrb( pSrb ) = NULL;

	DeviceQueue_put( pHwDevExt, pHwDevExt->StreamReqQue.top, pSrb );
}

void DeviceQueue_put_subpic( PHW_DEVICE_EXTENSION pHwDevExt, PHW_STREAM_REQUEST_BLOCK pSrb )
{
	SRBIndex( pSrb ) = 0;
	SRBpfnEndSrb( pSrb ) = NULL;
	SRBparamSrb( pSrb ) = NULL;

	DeviceQueue_put( pHwDevExt, pHwDevExt->StreamReqQue.top, pSrb );
}

PHW_STREAM_REQUEST_BLOCK DeviceQueue_get( PHW_DEVICE_EXTENSION pHwDevExt, PULONG index, PBOOLEAN last )
{
	PHW_STREAM_REQUEST_BLOCK srb;

	if ( pHwDevExt->StreamReqQue.top == NULL )
		return NULL;

	srb = pHwDevExt->StreamReqQue.top;
	(*index) = SRBIndex( srb );

// debug
	if( srb->NumberOfPhysicalPages == 0 )
		TRAP;

	if ( SRBIndex( srb ) != ( srb->NumberOfPhysicalPages - 1 ) ) {
		(*last) = FALSE;
		SRBIndex( srb )++;
		return srb;
	}

	(*last) = TRUE;

	pHwDevExt->StreamReqQue.top = pHwDevExt->StreamReqQue.top->NextSRB;

	pHwDevExt->StreamReqQue.count--;
	if ( pHwDevExt->StreamReqQue.count == 0 )
		pHwDevExt->StreamReqQue.top = pHwDevExt->StreamReqQue.bottom = NULL;

	return srb;
}

PHW_STREAM_REQUEST_BLOCK DeviceQueue_refer1st( PHW_DEVICE_EXTENSION pHwDevExt, PULONG index, PBOOLEAN last )
{
	PHW_STREAM_REQUEST_BLOCK srb;

	if( pHwDevExt->StreamReqQue.top == NULL )
		return NULL;

	srb = pHwDevExt->StreamReqQue.top;
	(*index) = SRBIndex( srb );

	if ( SRBIndex( srb ) != ( srb->NumberOfPhysicalPages - 1 ) ) {
		(*last) = FALSE;
	}
	else {
		(*last) = TRUE;
	}

	return srb;
}

PHW_STREAM_REQUEST_BLOCK DeviceQueue_refer2nd( PHW_DEVICE_EXTENSION pHwDevExt, PULONG index, PBOOLEAN last )
{
	PHW_STREAM_REQUEST_BLOCK srb;

	if( pHwDevExt->StreamReqQue.top == NULL )
		return NULL;

	srb = pHwDevExt->StreamReqQue.top;
	if( SRBIndex( srb ) != ( srb->NumberOfPhysicalPages - 1) ) {
		(*index) = SRBIndex( srb ) + 1;
		if( (SRBIndex( srb ) + 1) != ( srb->NumberOfPhysicalPages - 1 ) ) {
			(*last) = FALSE;
		}
		else {
			(*last) = TRUE;
		}
	}
	else {
		srb = srb->NextSRB;
		if( srb == NULL )
			return NULL;
		(*index) = SRBIndex( srb );
		if( SRBIndex( srb ) != ( srb->NumberOfPhysicalPages - 1 ) ) {
			(*last) = FALSE;
		}
		else {
			(*last) = TRUE;
		}
	}
	return srb;
}

void DeviceQueue_remove( PHW_DEVICE_EXTENSION pHwDevExt, PHW_STREAM_REQUEST_BLOCK pSrb )
{
	PHW_STREAM_REQUEST_BLOCK srbPrev;
	PHW_STREAM_REQUEST_BLOCK srb;

	if ( pHwDevExt->StreamReqQue.top == NULL )
		return;

	if( pHwDevExt->StreamReqQue.top == pSrb ) {
		pHwDevExt->StreamReqQue.top = pHwDevExt->StreamReqQue.top->NextSRB;
		pHwDevExt->StreamReqQue.count--;
		if ( pHwDevExt->StreamReqQue.count == 0 )
			pHwDevExt->StreamReqQue.top = pHwDevExt->StreamReqQue.bottom = NULL;

		DebugPrint(( DebugLevelTrace, "DVDTOSHIS:DeviceQueue_remove srb = 0x%x\r\n", pSrb ));

		return;
	}


	srbPrev = pHwDevExt->StreamReqQue.top;
	srb = srbPrev->NextSRB;

	while ( srb != NULL ) {
		if( srb == pSrb ) {
			srbPrev->NextSRB = srb->NextSRB;
			if( srbPrev->NextSRB == pHwDevExt->StreamReqQue.bottom )
				pHwDevExt->StreamReqQue.bottom = srbPrev;
			pHwDevExt->StreamReqQue.count--;

			DebugPrint(( DebugLevelTrace, "DVDTOSHIS:DeviceQueue_remove srb = 0x%x\r\n", pSrb ));

			break;
		}
		srbPrev = srb;
		srb = srbPrev->NextSRB;
	}
}

BOOL DeviceQueue_setEndAddress( PHW_DEVICE_EXTENSION pHwDevExt, PHW_TIMER_ROUTINE pfn, PHW_STREAM_REQUEST_BLOCK pSrb )
{
	PHW_STREAM_REQUEST_BLOCK srb;

	srb = pHwDevExt->StreamReqQue.top;
	while( srb != NULL ) {
		if( srb->NextSRB == NULL ) {
			SRBpfnEndSrb( srb ) = pfn;
			SRBparamSrb( srb ) = pSrb;

			DebugPrint(( DebugLevelTrace, "DVDTOSHIS:setEndAddress srb = 0x%x\r\n", srb ));

			return TRUE;
		}
		srb = srb->NextSRB;
	}
	return FALSE;
}

BOOL DeviceQueue_isEmpty( PHW_DEVICE_EXTENSION pHwDevExt )
{
	if( pHwDevExt->StreamReqQue.top==NULL )
		return TRUE;
	else
		return FALSE;
}

ULONG DeviceQueue_getCount( PHW_DEVICE_EXTENSION pHwDevExt )
{
	return( pHwDevExt->StreamReqQue.count );
}
//--- End.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -