BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

play mp3 using DirectShow

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Multimedia
View previous topic :: View next topic  
Author Message
ramya
Guest





PostPosted: Thu Feb 08, 2007 5:05 pm    Post subject: play mp3 using DirectShow Reply with quote



Hi All,
I'v jus started out using directshow and tried running a code to play
an mp3 file from the disk
directly.But it doesnt play mp3 files, it plays only wav files..can
anybody help plz.
heres the code fragment :

CoInitialize(NULL);
IGraphBuilder *pGraph = NULL;
IMediaControl *pControl = NULL;
IVideoWindow *pVW = NULL;
IMediaEvent *pEvent = NULL;
int err = 0;



CoCreateInstance(CLSID_FilterGraph, NULL, CLSCTX_INPROC_SERVER,
IID_IGraphBuilder, (void **)&pGraph);

pGraph->QueryInterface(IID_IMediaControl, (void **)&pControl);
pGraph->QueryInterface(IID_IMediaEvent, (void **)&pEvent);
pGraph->QueryInterface(IID_IVideoWindow, (void **)&pVW);

pGraph->RenderFile(L"\\Cuppy_Cake_Song.mp3", NULL);
// the below wav file is playing
//pGraph->RenderFile(L"\\jana_gana_mana.wav", NULL);

err = GetLastError();

pVW->put_Owner((OAHWND)handle);

pVW->put_Visible(OATRUE);

pVW->put_WindowStyle(WS_CHILD | WS_CLIPSIBLINGS | WS_CLIPCHILDREN);
RECT vwrect;

GetClientRect(handle,&vwrect);

//Set the Child to this position
pVW-
Quote:
SetWindowPosition(0,0,vwrect.right,vwrect.bottom);

pControl->Run();
err = GetLastError();


long evCode;
pEvent->WaitForCompletion(INFINITE, &evCode);

pVW->put_Owner(NULL);

pControl->Release();
pEvent->Release();
pGraph->Release();
pVW->Release();
CoUninitialize();
Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Multimedia All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.