Esempio n. 1
0
static int Create(flytv* p)
{
	p->Overlay.Module = LoadLibrary(T("FlyPresenter_TV.DLL"));
	GetProc(&p->Overlay.Module,&p->DriverVersion,T("DriverVersion"),0);
	GetProc(&p->Overlay.Module,&p->Initial_FLY_TV,T("Initial_FLY_TV"),0);
	GetProc(&p->Overlay.Module,&p->UnInitial_FLY_TV,T("UnInitial_FLY_TV"),0);
	GetProc(&p->Overlay.Module,&p->Zoom,T("Zoom"),0);
	GetProc(&p->Overlay.Module,&p->SendFrame,T("SendFrame"),0);
	if (!p->Overlay.Module)
		return ERR_DEVICE_ERROR;

	p->Overlay.Primary = 0;
	p->Overlay.Output.Format.Video.Width = 320;
	p->Overlay.Output.Format.Video.Height = 240;
	p->Overlay.Output.Format.Video.Direction = 0;
	p->Overlay.Output.Format.Video.Aspect = ASPECT_ONE;
	p->Overlay.Output.Format.Video.Pitch = p->Overlay.Output.Format.Video.Width*2;
	DefaultRGB(&p->Overlay.Output.Format.Video.Pixel,16,5,6,5,0,0,0);
	p->Overlay.Output.Format.Video.Pixel.Flags |= PF_16ALIGNED;
	p->Overlay.Init = Init;
	p->Overlay.Done = Done;
	p->Overlay.Blit = Blit;
	p->Overlay.UpdateShow = UpdateShow;
	p->Overlay.Lock = Lock;
	p->Overlay.Unlock = Unlock;
	return ERR_NONE;
}
Esempio n. 2
0
static Err GE2DBlitBitmap(void *dstP, Coord left, Coord top,
		UInt16 dstWidth, UInt16 dstHeight, GE2DBitmapType* p)
{
	video Src;
	video Dst;
	planes SrcPlanes;
	planes DstPlanes;

	memset(&Src,0,sizeof(Src));
	Src.Pixel.Flags = PF_YUV420;
	Src.Width = p->width;
	Src.Height = p->height;
	Src.Pitch = p->pitch;
	SrcPlanes[0] = p->plane1P;
	SrcPlanes[1] = p->plane3P;
	SrcPlanes[2] = p->plane2P;

	memset(&Dst,0,sizeof(Dst));
	DefaultRGB(&Dst.Pixel,16,5,6,5,0,0,0);
	Dst.Width = p->width;
	Dst.Height = p->height;
	Dst.Pitch = dstWidth*2;
	DstPlanes[0] = (char*)dstP + top * Dst.Pitch + left * 2;

	SurfaceCopy(&Src,&Dst,SrcPlanes,DstPlanes,NULL);
	return 0;
}
Esempio n. 3
0
static bool_t BuildOutputFormat(ffmpeg_video* p)
{
	int pix_fmt = p->Context->pix_fmt;
	if (pix_fmt<0)
		pix_fmt = PIX_FMT_YUV420P; // is this needed?

	PacketFormatClear(&p->Codec.Out.Format);
	p->Codec.Out.Format.Type = PACKET_VIDEO;

	switch (pix_fmt)
	{
	case PIX_FMT_YUV410P:
		p->Codec.Out.Format.Format.Video.Pixel.Flags = PF_YUV410;
		break;
	case PIX_FMT_YUV420P:
		p->Codec.Out.Format.Format.Video.Pixel.Flags = PF_YUV420;
		break;
	case PIX_FMT_BGR24:
		DefaultRGB(&p->Codec.Out.Format.Format.Video.Pixel,24,8,8,8,0,0,0);
		break;;
	case PIX_FMT_RGB32:
		DefaultRGB(&p->Codec.Out.Format.Format.Video.Pixel,32,8,8,8,0,0,0);
		break;
	case PIX_FMT_RGB555:
		DefaultRGB(&p->Codec.Out.Format.Format.Video.Pixel,16,5,5,5,0,0,0);
		break;
	case PIX_FMT_PAL8:
		p->Codec.Out.Format.Format.Video.Pixel.Flags = PF_PALETTE;
		p->Codec.Out.Format.Format.Video.Pixel.BitCount = 8;
		p->Codec.Out.Format.Format.Video.Pixel.Palette = p->Codec.In.Format.Format.Video.Pixel.Palette;
		break;
	default:
		return 0;
	}

	p->Aspect = p->Context->sample_aspect_ratio;
	p->Codec.Out.Format.Format.Video.Aspect = p->Codec.In.Format.Format.Video.Aspect;
	if (p->Context->sample_aspect_ratio.num>0 && !p->Codec.Out.Format.Format.Video.Aspect)
		p->Codec.Out.Format.Format.Video.Aspect = Scale(ASPECT_ONE,p->Context->sample_aspect_ratio.num,p->Context->sample_aspect_ratio.den);

	p->Codec.In.Format.Format.Video.Width = p->Codec.Out.Format.Format.Video.Width = p->Context->width;
	p->Codec.In.Format.Format.Video.Height = p->Codec.Out.Format.Format.Video.Height = p->Context->height;
	
	if (p->Picture->linesize[0])
		p->Codec.Out.Format.Format.Video.Pitch = p->Picture->linesize[0];
	else
		DefaultPitch(&p->Codec.Out.Format.Format.Video);

	p->PixelFormat = p->Context->pix_fmt;

	if (p->Context->bit_rate > 0 && p->Context->bit_rate < 100000000)
		p->Codec.In.Format.ByteRate = p->Context->bit_rate/8;
	if (p->Context->time_base.num > 0)
	{
		p->Codec.In.Format.PacketRate.Num = p->Context->time_base.den;
		p->Codec.In.Format.PacketRate.Den = p->Context->time_base.num;
		p->FrameTime = Scale(TICKSPERSEC,p->Codec.In.Format.PacketRate.Den,p->Codec.In.Format.PacketRate.Num);
	}
	else
		p->FrameTime = TIME_UNKNOWN;

	//ShowMessage("","%d %d %d",p->Context->pix_fmt,p->Context->width,p->Context->height);
	return 1;
}
Esempio n. 4
0
static int Init(gapi* p)
{
	GXDisplayProperties Info;
	video GDI;
	int Caps = QueryPlatform(PLATFORM_CAPS);

	if (!p->Opened)
	{
		ShowError(p->Overlay.Node.Class,GAPI_ID,GAPI_OPEN_ERROR);
		return ERR_NOT_SUPPORTED; // don't show device error
	}

	Info = p->Info;

	if (Info.cxWidth == GetSystemMetrics(SM_CXSCREEN) &&
		Info.cyHeight < GetSystemMetrics(SM_CYSCREEN))
	{
		// HPC devices we need the taskbar counted in the height too
		RECT WorkArea;
		SystemParametersInfo(SPI_GETWORKAREA,0,&WorkArea,0);
		if (WorkArea.top == 0 && WorkArea.bottom == Info.cyHeight)
			Info.cyHeight = GetSystemMetrics(SM_CYSCREEN);
	}

	p->Overlay.Output.Format.Video.Direction = 0;
	p->Overlay.Output.Format.Video.Aspect = ASPECT_ONE;

	if (Info.ffFormat & kfPalette)
	{
		QueryDesktop(&GDI);
		p->Overlay.Output.Format.Video.Pixel.Flags = PF_PALETTE;
		p->Overlay.Output.Format.Video.Pixel.BitCount = Info.cBPP;
		p->Overlay.Output.Format.Video.Pixel.Palette = GDI.Pixel.Palette;
	}
	else
	if (Info.ffFormat & kfDirect444)
		DefaultRGB(&p->Overlay.Output.Format.Video.Pixel,Info.cBPP,4,4,4,0,0,0);
	else
	if (Info.ffFormat & kfDirect565)
	{
		if (Caps & CAPS_ONLY12BITRGB)
			DefaultRGB(&p->Overlay.Output.Format.Video.Pixel,Info.cBPP,4,4,4,1,2,1);
		else
			DefaultRGB(&p->Overlay.Output.Format.Video.Pixel,Info.cBPP,5,6,5,0,0,0);
	}
	else
	if (Info.ffFormat & kfDirect555)
		DefaultRGB(&p->Overlay.Output.Format.Video.Pixel,Info.cBPP,5,5,5,0,0,0);
	else
	if (Info.ffFormat & kfDirect888)
		DefaultRGB(&p->Overlay.Output.Format.Video.Pixel,Info.cBPP,8,8,8,0,0,0);

	if (Info.ffFormat & kfDirectInverted)
		p->Overlay.Output.Format.Video.Pixel.Flags |= PF_INVERTED;

	// get signed x/y pitches in bits
	Info.cbxPitch <<= 3;
	Info.cbyPitch <<= 3;

	// one pitch is probably zero when BPP<8
	if (!Info.cbxPitch) 
		if (Info.cbyPitch < 0)
			Info.cbxPitch = -Info.cBPP;
		else
			Info.cbxPitch = Info.cBPP;
	else
	if (!Info.cbyPitch)
		if (Info.cbxPitch < 0)
			Info.cbyPitch = Info.cBPP;
		else
			Info.cbyPitch = -Info.cBPP;

	// one of the pitches absolute value must be BPP
	if (abs(Info.cbyPitch) < abs(Info.cbxPitch))
	{
		if (abs(Info.cbxPitch) < Info.cyHeight*Info.cBPP &&
			abs(Info.cbxPitch) >= Info.cxWidth*Info.cBPP) //swapped gapi resolution
			SwapInt(&Info.cxWidth,&Info.cyHeight);

		Info.ffFormat |= kfLandscape;
		Info.cbyPitch = Info.cbyPitch<0 ? -Info.cBPP : Info.cBPP;
	}
	else
	{
		if (abs(Info.cbyPitch) < Info.cxWidth*Info.cBPP &&
			abs(Info.cbyPitch) >= Info.cyHeight*Info.cBPP) //swapped gapi resolution
			SwapInt(&Info.cxWidth,&Info.cyHeight);

		Info.ffFormat &= ~kfLandscape;
		Info.cbxPitch = Info.cbxPitch<0 ? -Info.cBPP : Info.cBPP;
	}

	p->Overlay.Output.Format.Video.Width = Info.cxWidth;
	p->Overlay.Output.Format.Video.Height = Info.cyHeight;

	// we need the physical start of the framebuffer
	p->AdjustPtr = 0;
	if (Info.cbxPitch<0) 
		p->AdjustPtr += (Info.cbxPitch * (Info.cxWidth-1)) >> 3;
	if (Info.cbyPitch<0) 
		p->AdjustPtr += (Info.cbyPitch * (Info.cyHeight-1)) >> 3;

	if (Info.ffFormat & kfLandscape)
	{
		p->Overlay.Output.Format.Video.Direction |= DIR_SWAPXY;
		p->Overlay.Output.Format.Video.Pitch = abs(Info.cbxPitch) >> 3;
		SwapInt(&p->Overlay.Output.Format.Video.Width,&p->Overlay.Output.Format.Video.Height);

		if (Info.cbxPitch<0) 
			p->Overlay.Output.Format.Video.Direction |= DIR_MIRRORUPDOWN;
		if (Info.cbyPitch<0) 
			p->Overlay.Output.Format.Video.Direction |= DIR_MIRRORLEFTRIGHT;
	}