how to stream mp3 in thread

DLL Edition of the F-IN-BOX
ani123
Posts: 1
Joined: Fri Jul 02, 2010 8:09 am

how to stream mp3 in thread

Postby ani123 » Fri Jul 02, 2010 9:13 am

I am trying out f-in-box for a project and have been successful in the following:
1. Use FPC_AddOnLoadExternalResourceHandler with CoMarshalInterThreadInterfaceInStream to stream a FLV in a separate thread
2. Use FPCN_LOADEXTERNALRESOURCE to load and play a MP3 from a stream. This however holds up the app until the entire MP3 loads. This is where my problem lies.

What I need to be able to do is stream a MP3 in a separate thread just like the FLV. This is where Ihave been unsuccessful. I have tried to use the AddOnLoadExternalResourceHandler for MP3 files but it crashes the app. I have tried the code below inside LOADEXTERNALRESOURCE to setup a thread for the stream. But this aborts with E_ABORT when writing to the stream and the MediaPlayback component behaves as if no file is loaded.
...
case FPCN_LOADEXTERNALRESOURCE:
{
SFPCLoadExternalResource* pInfo = (SFPCLoadExternalResource*)lParam;


if (0 == lstrcmpi(pInfo->lpszRelativePath, "test.mp3"))
{
SFPCLoadExternalResource* pInfo = (SFPCLoadExternalResource*)lParam;
IStream* pStream = pInfo->lpStream;

IStream* pStreamForMarshalling;
CoMarshalInterThreadInterfaceInStream(IID_IStream, pStream, &pStreamForMarshalling);

DWORD dwThreadId;
HANDLE hThread = CreateThread(NULL, 0, &FlashContentProviderThread, (LPVOID)pStreamForMarshalling, 0, &dwThreadId);
CloseHandle(hThread);

}
....
Has anybody been able to stream a MP3 in a separate thread so that it doesnt block up the system till the entire file is streamed? Please advise!

cheers
ani

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

Postby Softanics » Fri Jul 02, 2010 9:44 am

Hello,

Could you please send me the sample code to support (at) f-in-box.com, I will check it.

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


Return to “DLL Edition”

Who is online

Users browsing this forum: Google [Bot] and 8 guests

cron