Problem reading flv file in a dll

DLL Edition of the F-IN-BOX
FrereDavid
Posts: 7
Joined: Thu Jun 01, 2006 2:35 pm

Problem reading flv file in a dll

Postby FrereDavid » Mon Jun 05, 2006 1:07 pm

Hi

I'm now trying to do the same thing with a flv file that I did with the swf file : read the flv file in my dll, get its frames and give the data buffer to my 3d engine.
But I'm not really aware of how this should work :
- I tried to use FPC_LoadMovie(hWnd,0,"e:\\movie.flv"); , my code goes into GlobalOnLoadExternalResourceHandler() where I copied the code from the Sample_1_SWF_FLV_Reader, but it doesn't seem to work, if I try to get the current frame of my hWnd I get a -1.
- I tried to use FPCPutMovieFromResource(hWnd, 0, _T("FLVPlayer"), _T("SWF")); as in the example, but my code never goes into GlobalOnLoadExternalResourceHandler(). Maybe it is a problem a ressource as the FLVPLAYER ressource is in the dll project, that is called by the 3d engine (the 3d engine should'nt know anything about how the flv is read and so should'nt have the ressource needed).

I don't know if I made my problem really understandable but I'd be happy to have any lead :)

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

Postby Softanics » Mon Jun 05, 2006 3:31 pm

Thank you for your question.

The component isn't able to play FLV itself. It means you should load a movie that loads and play flv. You can see how it's implemented in the demo projects. The 3rd argument of FPCPutMovieFromResource is hinstance of the module that contains the resource, if you pass zero it means that the component will try to find the resource in the EXE, not in the DLL. Another words, code should be something like that:

Code: Select all

FPCPutMovieFromResource(hWnd, GetModuleHandle(_T("your_cool_dll_name_here.dll")), _T("FLVPlayer"), _T("SWF"));
Best regards, Artem A. Razin,
F-IN-BOX support
Ask your question here: http://www.f-in-box.com/support.html

FrereDavid
Posts: 7
Joined: Thu Jun 01, 2006 2:35 pm

Postby FrereDavid » Mon Jun 05, 2006 3:53 pm

Ok thanks it works great ! I needed the GetModuleHandle of my dll :)

just another question, the flv I read stops at the end and I can't make it loop even with :

SFPCPutLoop PutLoop;
PutLoop.Loop = TRUE;
::SendMessage(hWnd,FPCM_PUT_LOOP,0, (LPARAM)&PutLoop);

Any suggestion ?

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

Postby Softanics » Mon Jun 05, 2006 4:49 pm

FrereDavid wrote:just another question, the flv I read stops at the end and I can't make it loop even with :

SFPCPutLoop PutLoop;
PutLoop.Loop = TRUE;
::SendMessage(hWnd,FPCM_PUT_LOOP,0, (LPARAM)&PutLoop);

Any suggestion ?


When flv is playing in a movie, you are really have the only frame. That's why Loop doesn't work in this case.
I think you should handle NetStream.onStatus in ActionScript and restart the video when info.code == NetStream.Play.Stop (see in the flash help). Hope it helps.
Best regards, Artem A. Razin,

F-IN-BOX support

Ask your question here: http://www.f-in-box.com/support.html

FrereDavid
Posts: 7
Joined: Thu Jun 01, 2006 2:35 pm

Postby FrereDavid » Tue Jun 06, 2006 8:35 am

Hi

Doesn't it mean that I should modify the FLVPlayer.swf that you provided in order to incroporate this loop feature ? If this is the case, is it possible you provide your fla so I can do this ?
I'm thinking of puting inside a variable that you can update to decide if the flv loops or not, I could provide you the new fla with this feature if you want it.

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

Postby Softanics » Tue Jun 06, 2006 10:51 am

Yes, you should modify fla provided with the demo.

Add this code:

Code: Select all

netStream.onStatus = function(info) {
   if (info.code == "NetStream.Play.Stop") {
      netStream.seek(0);
      netStream.play();
   }
}



That's all :)
Best regards, Artem A. Razin,

F-IN-BOX support

Ask your question here: http://www.f-in-box.com/support.html

FrereDavid
Posts: 7
Joined: Thu Jun 01, 2006 2:35 pm

Postby FrereDavid » Tue Jun 06, 2006 12:07 pm

ok sorry, I didn't see it was already there :P


Return to “DLL Edition”

Who is online

Users browsing this forum: No registered users and 19 guests

cron