PDA

View Full Version : Media Players



Troll_King
08-02-2002, 06:28 AM
Anyone ever tried to write their own Video Player?

ober
08-02-2002, 07:16 AM
nope... but I'm guessing you're going to attempt it... and then realize you can't after about a week and give up :)

Troll_King
08-02-2002, 07:17 AM
Why, is it not humanly possible?

ober
08-02-2002, 07:23 AM
It's possible... but to make something useful that more than just yourself and a handful of other people will want to use? ehh... that could take quite a long time... look at the media players that are out. It's taken MS and Quicktime years to make a viable player... and even then, you need all these damn codecs and whatnot to play all the pr0n. :)

Troll_King
08-02-2002, 07:27 AM
I want to understand more about the media players. it might not be too difficult if one looked at some open source media players code. I was wondering if anyone here had done some of this work.

maes
08-02-2002, 08:59 AM
Do you mean with something like directx and use the filters? If that is the case, then I'm trying to. Right now, I have an mp3 player, and when it is more or less a descent working program, I'm going to add the filters for mpeg, avi and possebly divx. I have no idea on how to create the filters but I hope I'll get there.

If you mean realy realy hardcoded, like not useing directx or other graph library (just C/C++) then my answer is no

Troll_King
08-02-2002, 09:03 AM
I don't like the sound of using DirectX for anything, but C/C++ is a good idea. Where do you get the filters? To tell you the truth I don't know much about it. I guess it all has to to with encoding/decoding from some protocol into binary.

maes
08-02-2002, 09:57 AM
I once found some code in C and asm that would play an mp3 file but I couldn't get it to work. I think some files where missing. It was from Xing player (see attachment). But I wouldn't recomend it to anyone. And that is only the codec for mp3, no vision only sound. But I also read somewhere that the codec for divix is available on the net.

I also don't know about Mediaplayers, But I think very few MP are made from the ground up. Most of them uses Windows Mediaplayer or Directx. I think even Win MP and the playa (from the Divx website) uses directx. I once screwed up my DirectX a bit and all the players a I tried had the same problem (they kept showing the frames, very anoying). That is why I think they all use directx. So I wouldn't recomend building from scratch (but who am I :rolleyes: )

There is a source example on how to play avi, mpeg and mp3 (and other media types) in the DirectX SDK (under DirectShow)
if you're interested, here is a bit of my mp3playing code (if you want the full code, just ask and I'll post it.)
It basicly is your friend(sunlight)'s :p code but adapted to my needs


IPin *pPin;
::CoInitialize(NULL);
CoCreateInstance(CLSID_FilterGraph, NULL,CLSCTX_INPROC, IID_IGraphBuilder,(void **)&g_pGraphBuilder);

g_pGraphBuilder->QueryInterface(IID_IMediaControl,(void **)&g_pMediaControl);
g_pGraphBuilder->AddSourceFilter(wFilename, wFilename, &pSource);
pSource->FindPin(L"Output", &pPin);
g_pGraphBuilder->Render(pPin);

//IBasicAudio *iba=NULL;
LONGLONG llPos = 0;

g_pGraphBuilder->QueryInterface(IID_IMediaSeeking, (void **)&g_pMediaSeeking);
g_pGraphBuilder->QueryInterface(IID_IMediaEventEx, (void **)&g_pMediaEventEx);
g_pGraphBuilder->QueryInterface(IID_IMediaControl, (void **)&g_pMediaControl);
//g_pGraphBuilder->QueryInterface(IID_IBasicAudio, (void **)&iba);

g_pMediaSeeking->SetPositions(&llPos, AM_SEEKING_AbsolutePositioning, &llPos, AM_SEEKING_NoPositioning);
g_pMediaEventEx->SetNotifyWindow((OAHWND)m_hWnd, WM_GRAPHNOTIFY, 0);
g_pMediaControl->Run();
//iba->put_Balance(10000);
Cmp3::play=true;
Cmp3::SetSoundVolume(Cmp3::soundvolume);
Cmp3::ReadMP3Tag();
SAFE_RELEASE(pPin)


in the attachment, there can be some additional files that my VC created but couldn't compile


hmmm, problem! file is to big. I'll upload it to my site and then I'll post a link

maes
08-02-2002, 10:06 AM
here is that link
http://users.skynet.be/wiseguy/code/files/xing.zip