how to get pixels of every frame of a swf with high speed

DLL Edition of the F-IN-BOX
rocky
Posts: 2
Joined: Wed Mar 30, 2011 12:49 pm

how to get pixels of every frame of a swf with high speed

Postby rocky » Wed Mar 30, 2011 3:24 pm

I want to use this dll to get pixels of every frame for real-time processing.I have developed a simple application for playing swf file.some code as follows:

-------------------------------------------------------------------
g_hwndFlashPlayerControl =
CreateWindowEx(WS_EX_LAYERED,
(LPCTSTR)FPC_GetClassAtom(g_hFPC),
NULL,
FPCS_TRANSPARENT,//WS_POPUP | WS_VISIBLE,
0,
0,
600,
600,
NULL,
NULL,
NULL,
NULL);

LPSTR pszFileName = "D:\\mywork\\Flash\\Ripples.swf";

if(FAILED(FPC_LoadMovieA(g_hwndFlashPlayerControl,0,pszFileName)))
{
return;
}

FPC_Play(g_hwndFlashPlayerControl);

FPCSetEventListener(g_hwndFlashPlayerControl, &FPCListener, 0);

-------------------------------------

static
void WINAPI FPCListener(HWND hwndFlashPlayerControl, LPARAM lParam, NMHDR* pNMHDR)
{
if (FPCN_UPDATE_RECT == pNMHDR->code)
{
if (true)
{
SFPCGetFrameBitmap FPCGetFrameBitmap = { 0 };
::SendMessage(g_hwndFlashPlayerControl, FPCM_GET_FRAME_BITMAP, 0, (LPARAM)&FPCGetFrameBitmap);
...
CopyMemory(g_lpPixels, bmp_info.bmBits, g_size.cx * g_size.cy * 4);
...

}


void testApp::draw(){

ofSetColor(0xFFFFFF);


ofImage a;
a.allocate(g_size.cx,g_size.cy,OF_IMAGE_COLOR_ALPHA);
a.setFromPixels((unsigned char *)g_lpPixels,g_size.cx,g_size.cy,OF_IMAGE_COLOR_ALPHA);
a.draw(0,0,600,300);
}

After testing several swf files,I met two problems.
1.speed is slow.Is there a way to speed up getting data from swf?
2.the display image from my application is different from your demo. Can you tell me why? And teach me how to solve it.

Thank you!



Image
Image[/url]

Softanics
Site Admin
Posts: 1402
Joined: Sat Sep 18, 2004 3:03 am
Location: Russia, St. Petersburg
Contact:

Postby Softanics » Thu Mar 31, 2011 11:26 am

Hello,

Did you check sample from DirectX directory in the demo version?

Thank you.
Best regards, Artem A. Razin,
F-IN-BOX support
Ask your question here: http://www.f-in-box.com/support.html

rocky
Posts: 2
Joined: Wed Mar 30, 2011 12:49 pm

Postby rocky » Thu Mar 31, 2011 1:53 pm

Hi.
Yes.After checking DirectX sample and OpenGL sample,I got the method for getting pixels from swf file.
You can see two images from my topic for comparing my application and your demo.
Can you help me and point out the error?


Return to “DLL Edition”

Who is online

Users browsing this forum: No registered users and 12 guests

cron