static int ph_Available(void)
{
    int phstat=-1;

    phstat=PtInit(0);
    if (phstat==0)
    {
       return 1;
    }
    else
    {
       return 0;
    }
}
static int ph_Available(void)
{
    if (phstatus!=0)
    {
        phstatus=PtInit(NULL);
        if (phstatus==0)
        {
           return 1;
        }
        else
        {
           return 0;
        }
    }
    return 1;
}
Exemple #3
0
/*****************************************************************************
 * OpenVideo: allocate QNX video thread output method
 *****************************************************************************
 * This function allocate and initialize a QNX vout method. It uses some of the
 * vout properties to choose the window size, and change them according to the
 * actual properties of the display.
 *****************************************************************************/
int E_(OpenVideo) ( vlc_object_t *p_this )
{
    vout_thread_t * p_vout = (vout_thread_t *)p_this;

    /* init connection to photon */
    if( PtInit( "/dev/photon" ) != 0 )
    {
        msg_Err( p_vout, "unable to connect to photon" );
        return( 1 );
    }

    /* allocate structure */
    p_vout->p_sys = malloc( sizeof( vout_sys_t ) );
    if( p_vout->p_sys == NULL )
    {
        msg_Err( p_vout, "out of memory" );
        return( 1 );
    }

    memset( p_vout->p_sys, 0, sizeof( vout_sys_t ) );

    p_vout->b_fullscreen = config_GetInt( p_vout, "fullscreen" );
    p_vout->p_sys->i_mode = config_GetInt( p_vout, "overlay" ) ?
                                MODE_VIDEO_OVERLAY : MODE_VIDEO_MEM;
    p_vout->p_sys->dim.w = p_vout->i_window_width;
    p_vout->p_sys->dim.h = p_vout->i_window_height;

    /* init display and create window */
    if( QNXInitDisplay( p_vout ) || QNXCreateWnd( p_vout ) )
    {
        free( p_vout->p_sys );
        return( 1 );
    }

    p_vout->pf_init = QNXInit;
    p_vout->pf_end = QNXEnd;
    p_vout->pf_manage = QNXManage;
    p_vout->pf_render = NULL;
    p_vout->pf_display = QNXDisplay;

    return( 0 );
}
Exemple #4
0
main(int argc,char *argv[])
{
	CoolImage *image;
	int x,y;
	int i,j;
	PtWidget_t *win;
	PtArg_t args[3];
	PhDim_t dim={m_W,m_H};
	PhPoint_t pos={50,250};
	int fd; //Bt878 driver file descriptor
	int fd_temp;
	int size_read;
	struct timeval tv;
    fd_set rfd;
    int n;
	int error;
	int counter = 0;
	int counter_mean = 0;
	int file = 0;


	//Timing calculation
    uint64_t cps, cycle1, cycle2, ncycles;
    float sec;
    float msec;

	// if a paramater was passed, grab it as the blit type 
	if (argc>1) blittype=atoi(argv[1]);

	// initialize our connection to Photon, and create/realize a window 
	//PtInit("/net/irene2/dev/photon");
	PtInit("/dev/photon");
	PtSetArg(&args[0],Pt_ARG_POS,&pos,0);
	PtSetArg(&args[1],Pt_ARG_DIM,&dim,0);
	win=PtCreateWidget(PtWindow,Pt_NO_PARENT,2,args);
	PtRealizeWidget(win);

	// Allocate and fill a series of NUMIMAGES images with a little 
	// fading type animation.  Put your own animation in here if you like.


	/*
     *    Set a 5 second timeout.
     */
    tv.tv_sec = 5;
    tv.tv_usec = 0;

	image = AllocBuffer(m_W,m_H,fd);	
	assert(image!=0);
	
	if (file != 2)
	{
	init_bttvx(2,0, m_W,m_H,0,0);
	open_bttvx();
	
	BttvxSetImageBuffer(0, image->buffer);
	}
	fd_temp = fd;
	FD_ZERO( &rfd );
	FD_SET( fd, &rfd );
	
	
	while(1)
	{
		//fd = open("/net/europa/dev/bttvx0",O_RDWR);
		//if ( fd > 0 )
		//{
			
			///switch ( n = select( 1 + max( fd,0 ),
			///   &rfd, 0, 0, &tv ) ) 
			///{
			///  case -1:
			///	perror( "select" );
			///	return EXIT_FAILURE;
			///  case  0:
			///	puts( "select timed out" );
			///	break;
			///  default:
				//printf( "descriptor ready ...\n");
				//if( FD_ISSET( console, &rfd ) )
				//  puts( " -- console descriptor has data pending" );
				//if( FD_ISSET( serial, &rfd ) )
				//  puts( " -- serial descriptor has data pending" );
				/* Read the text */

				cycle1=ClockCycles( );

				//lseek(fd,0L,SEEK_SET);
			///	size_read = read( fd, image->buffer, W*H*deep );
		   if (file != 2)
		   {
		   BttvxWaitEvent();
		   BttvxAcquireBuffer(image->buffer);	
		    }
		   
		   switch(file)
		   {
		   	case 0:
		   		BlitBuffer(win,image);
		   		break;
		   	case 1:
		   		SaveImage(counter,image);
		   		break;
		   	case 2:
		   		
		   		LoadImage(counter,image);
		   		BlitBuffer(win,image);
		   		getchar();
		   		break;
		   };
		   
		   if (file!=2)
		   	BttvxReleaseBuffer();
		   cycle2=ClockCycles( );
		   counter++;
		   counter_mean++;

		   
		   ncycles=cycle2-cycle1;
		   //printf("%lld cycles elapsed \n", ncycles);

		   /* find out how many cycles per second */
		
		   cps = SYSPAGE_ENTRY(qtime)->cycles_per_sec;
		   //printf( "This system has %lld cycles/sec.\n",cps );
		   sec=(float)ncycles/cps;
		   msec +=sec;
		   if (counter_mean == 250 )
		   {
		   	msec = msec/counter_mean;
		   	printf("The cycles in seconds is %f \n",msec);
		   	counter_mean = 0;
		   	msec = 0;
		   }
		//}else
			//sleep(2);
		}

	//printf("Blitted %d frames using method %d\n",REPS*NUMIMAGES,blittype);

	// now free the images
	FreeBuffer(image);
	close( fd );
	/// hide the window and destroy it.
	PtUnrealizeWidget(win);
	PtDestroyWidget(win);
}