四、 其它函数编写
void TForm1::DrawPic(unsigned char *yuv ,int w, int h)
{
int ww=btView->Width,wh=btView->Height;
HDC hdc;
hdc=::GetDC(btView->Handle);
DrawDibDraw(hD,hdc, 0,0, ww,wh, &bih,yuv, 0,0,w,h,0);
::ReleaseDC(btView->Handle,hdc);
}
LRESULT CALLBACK VideoStreamCallback(HWND hWnd, LPVIDEOHDR lpVHdr)
{
char b[100];
static int i = 0, len;
ConvertRGB2YUV_(lpVHdr->lpData ,PIC_WIDTH,PIC_HEIGHT, psource_buf);
len=pH264_enc_compress(g_h264_ehandle,psource_buf,CIF411_FRAMESIZE,
pencoded_buf, &key );
sprintf(b,"视频压缩#%d len = %d --> %d bytes",i++, lpVHdr->dwBytesUsed,len);
Form1->Memo1->Lines->Add(b);
Form1->SendVideo(0, pencoded_buf,len);
Form1->Memo1->Lines->Add("发送... ");
return true;
}
查看 Form1 的事件 Events 处理函数,双击 OnCreate 和 OnDestroy,添加函数内容。