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

📄 multiple.cpp

📁 djgpp bt878 capture for DOS
💻 CPP
字号:
#include <stdio.h>
#include <stdlib.h>
#include <conio.h>
#include "screen.h"
#include "scaler.h"
#include "philips.h"
#include "alps.h"
#include "temic.h"
#include "sbsound.h"

SCREEN screen;

#define MAX_NUMBER_OF_DECODERS 4

/******************************************************************************
 * This code shows an example of how to display live video from the tuner
 * onto the screen with multiple PCI decoders installed.
 * By using the Bt8X8 data sheet and by changing the register values, you
 * should be able to access the I2C, GPIO, and to change just about everything
 * else you could want.
 *
******************************************************************************/


/***************************************************************************
	Main outline:
    	1) Check the arguments passed.
        2) Find and initalize all PCI decoder (848, 849, 878, or 879).
        3) Allocate memory for audio and video risc programs.
        4) Select a tuner and set the channel.
        5) Initialize the sound blaster compatable card for 878 and 879.
        6) Start the Vesa 2.0 complient video mode. (640x480 16 color).
        7) Initialize internal registers.
        8) Start and scale a video window to 640 by 480
        9) Start the sound driver code.
        10) Wait for a key to be pressed.
        11) Stop the video.
        12) Remove the sound driver and interrupt.
        13) Exit the graphics mode.
***************************************************************************/
int main( int argc, char **argv )
{
	int i;
	int num_decoders;
	PCI_DECODER *decoder[MAX_NUMBER_OF_DECODERS];

    printf("***** PCI Decoder under dos  *****\n\n");

    /* Open all of the PCI decoder devices */
    decoder[0] = new PCI_DECODER( PCID_Any );
    num_decoders = decoder[0]->GetNumberOfDevices( PCID_Any ) + 1;
	for( i=1; i < MAX_NUMBER_OF_DECODERS && i < num_decoders; i++)
	    decoder[i] = new PCI_DECODER( PCID_Any );
	

    /* Start the vesa 2.0 graphics mode */
	if( screen.SetMode( MODE_640x480x16 ) == SCREEN_FAIL )
	{
		printf( "ERROR Intializing graphics mode\n" );
		exit( 10 );
	}

	/* Initialize each decoder */
	for( i=0; i < num_decoders; i++ )
	{
		decoder[i]->Video->Reset();
		decoder[i]->Video->SetVideoFormat( VideoFormatNTSC );

	    decoder[i]->Video->SetStatus( 0xFFFFFFFF );

        /* Create a new tuner for each device */
	    TUNER *tuner;
		tuner = new PHILIPS_TUNER_WITH_RADIO( );
//    	tuner = new ALPS_TUNER( );
//    	tuner = new TEMIC_TUNER( );

	    decoder[i]->AddTuner( tuner );

        /* Set the tuner mode and channel */
	    decoder[i]->Tuner->SetTunerMode( TunerModeCable );
        decoder[i]->Tuner->SetTVChannel( 3 );

        /* Set the video input to the tuner */
		decoder[i]->Video->SetVideoInput( VideoInputTuner );

    	/* Allocate memory for risc programs (4/8K) */
		decoder[i]->Video->Even->AllocateRiscMemory( 4 * 1024 );
    	decoder[i]->Video->Odd->AllocateRiscMemory( 4 * 1024 );
	    decoder[i]->Audio->AllocateRiscMemory( 8 * 1024 );

		set_output_format( *decoder[i] );

        /* Set the scaling registers */
		scale( *decoder[i], 320, 240, FieldOdd );
		scale( *decoder[i], 320, 240, FieldEven );

        /* Create a video risc program */
	    create_risc_WxH( *decoder[i], 320, 240, (i&1)?320:0, (i>1)?240:0 );	/* create a RISC program */

        /* Set video preferences */
        decoder[i]->Video->SetTritonFix( On );
		decoder[i]->Video->SetWhiteCrush( On );
	}

	/* Clear the screen */
    screen.ClearScreen();

	/* Start all of the PCI decoder devices */
	for( i=0; i < num_decoders; i++ )
	{
	    decoder[i]->Video->RunRisc();	/* Run the Risc Program */
	}

    /* Wait for a key to be pressed */
    while( !kbhit() );
	{
		for( i=0; i < num_decoders; i++ )
		{
    	    if( decoder[i]->Video->GetStatus( ) & 0x000c8000 )
        	{
            	 decoder[i]->Video->HaltRisc();  /* make sure everything is stopped */
	             decoder[i]->Video->SetStatus( 0x000c8000 );
    	         decoder[i]->Video->RunRisc();             /* Run the Risc Program */
        	}
        }
	}


	/* Stop all of the PCI decoder devices */
	for( i=0; i < num_decoders; i++ )
	{
	    decoder[i]->Video->HaltRisc();	/* Stop the Risc Program */
	}
	
	/* Clear out the keyboard buffer */
	while( kbhit() )
    	getch();

    /* Exit the vesa 2.0 graphics mode */
	screen.ExitGraphics();
	
	return 0;	
}



⌨️ 快捷键说明

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