[Vorbis-dev] getting started
illiminable
ogg
Sun Jun 27 08:47:57 PDT 2004
<004901c45b80$cde5fdc0$0100000a at tiger>
<006601c45b85$5d119d70$861382cd at stever>
<005f01c45b8e$01c52f00$0100000a at tiger>
<008401c45b8f$2d24e4a0$861382cd at stever>
Message-ID: <002001c45c5e$20eb28a0$0100000a at tiger>
> >
> > All you have to do is
> >
> > 1) Create a filtergraph object with COM
> > 2) get an Igraphbuilder interface
> >
>
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/directx9_c/directx/htm/igraphbuilderinterface.asp
> > using COM.
> > IGraphBuilder* locGraphBuilder;
> > HRESULT hr = CoCreateInstance(CLSID_FilterGraph, NULL,
> > CLSCTX_INPROC_SERVER, IID_IGraphBuilder, (void **)&locGraphBuilder);
> > 3) Call RenderFile on the IGraphbuilder interface with the filename
> > 4) get an IMediaControl interface from the filter graph
> > 5) Call play on the IMediaControl interface.
> >
> > All the codec stuff will be done automagically behind the scenes, so
long
> as
> > my filters are installed.
> >
> > Zen.
> >
Actually today i needed a simple player to do some testing... so here's the
entire code for a *zero* feature, *zero* error checking command line audio
player for ogg... requires my filters installed... and you need to link to
strmiids.lib. Actually it will play any audio format... mp3s wmas, anything
directshow has a filter for. This should get you started, and hopefully be a
good starting point for anyone wanting to integrate ogg simply into windows.
Obviously there's more to make it functional... but it's a starting point.
It will be in the subversion repository as an example on my next checkin.
// CLOgg.cpp : Command line minimalist audio player.
//
#include "stdafx.h"
#include <dshow.h>
#include <windows.h>
#include <iostream>
using namespace std;
int _tmain(int argc, _TCHAR* argv[])
{
IGraphBuilder* locGraphBuilder = NULL;
IMediaControl* locMediaControl = NULL;
HRESULT locHR;
CoInitialize(NULL);
locHR = CoCreateInstance(CLSID_FilterGraph, NULL, CLSCTX_INPROC_SERVER,
IID_IGraphBuilder, (void **)&locGraphBuilder);
locHR = locGraphBuilder->RenderFile(L"g:\\h.ogg", NULL);
locHR = locGraphBuilder->QueryInterface(IID_IMediaControl,
(void**)&locMediaControl);
locHR = locMediaControl->Run();
//Wait till you enter a number and press enter to exit.
int x;
cin>>x;
locMediaControl->Release();
locGraphBuilder->Release();
CoUninitialize();
return 0;
}
Enjoy,
Zen.
More information about the Vorbis-dev
mailing list