🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.cppbuilder.multimedia
7 messages
7 total messages Started by Mathias Thorell Tue, 16 May 2006 04:51
TMediaPlayer can't play MP3's
#41
Author: Mathias Thorell
Date: Tue, 16 May 2006 04:51
46 lines
2722 bytes
Hello all !

I'm going completly nuts over this :

I want to play an MP3-file using TMediaPlayer.
I have tried this on 2 different machines (all with the latest hotfixes 
and Windows Media player installed):
   PC #1: W2K Prof   : Fails in mciSendCommand(...MCI_OPEN...).
   PC #2: W2K Prof   : Works perfectly.
   PC #2: WinXP Prof : Fails in mciSendCommand(...MCI_OPEN...).

The error I get is 266; "Unknown problem while loading the specified 
device driver."

All machines/OS's listed above plays an MP3 perfectly well if I load it 
up with Windows Media Player (v9.00.00.3344), even with the "old" one, 
v6.4.09.1129.

As I understand, the Windows MediaPlayer is using the mci API to render 
a file, right ?

The installed codecs differs heavily, and PC #2 booted in WinXP has a 
native WinXP installation, only the latest hotfixes and SP's installed, 
and it fails too...
All of them has the Fraunhofer MP3 decoder, isn't that all I should need 
? I even tried to move that codec to the highest priority in the system 
codec list without any success :(

I have tried with every, single option set up for the DeviceType 
property without luck. I have also tried using the mciSendCommand() 
function directly (i.e. not using the TMediaPlayer) in "string command 
mode", i.e. "open E:\\Test.mp3 type mpegvideo alias test", with the same 
results.

Why does this work on some machines and not in some other ?
Is it just another example of MS Windows not being compatible with itself ?

What I want to do is to open a small MP3-file to see if the PC can play 
it (and in most cases, it can't, grrr).
If the PC is able to play MP3's, I enable a menuitem that will play 
different, selectable MP3 HTTP Streams.

TIA,
/Mathias

PS. Don't tell me to use FMod... DS.
Re: TMediaPlayer can't play MP3's
#42
Author: Jonathan Benedicto
Date: Tue, 16 May 2006 13:01
20 lines
1600 bytes
Mathias Thorell wrote:
> As I understand, the Windows MediaPlayer is using the mci API to render a 
> file, right ?

No, Windows Media Player uses DirectShow.

> What I want to do is to open a small MP3-file to see if the PC can play it 
> (and in most cases, it can't, grrr).
> If the PC is able to play MP3's, I enable a menuitem that will play 
> different, selectable MP3 HTTP Streams.

I'd suggest trying AudioLab from http://www.mitov.com

HTH

Jonathan
------------------------
TwineCompiler, blazingly fast C++ compiles on ANY machine:
http://www.jomitech.com/#twine
------------------------ 
Re: TMediaPlayer can't play MP3's
#43
Author: Remy Lebeau (TeamB)
Date: Tue, 16 May 2006 19:57
105 lines
3892 bytes
"Jonathan Benedicto" <invalid@nobody.com> wrote in message
news:4469cd34@newsgroups.borland.com...

> No, Windows Media Player uses DirectShow.

Which in itself is not that hard to use.  I just recently wrote an app that
plays MP3s via DirectShow.  It only takes a few lines of code to play a
file, ie:

    #include <dshow.h>

    IGraphBuilder *Graph = NULL;
    IMediaControl *Control = NULL;
    IMediaSeeking *Seeker = NULL

    __fastcall TForm1::TForm1(TComponent *Owner)
        : TForm(Owner)
    {
        ::CoInitialize(NULL);
        if( SUCCEEDED(::CoCreateInstance(CLSID_FilterGraph, NULL,
CLSCTX_INPROC_SERVER, IID_IGraphBuilder, (LPVOID*)&Graph)) )
        {
            Graph->QueryInterface(IID_IMediaControl, (LPVOID*)&Control);
            Graph->QueryInterface(IID_IMediaSeeking, (LPVOID*)&Seeker);
        }
    }

    __fastcall TForm1::~TForm1()
    {
        if( Seeker )
            Seeker->Release();

        if( Control )
        {
            Control->Stop();
            Control->Release();
        }

        if( Graph )
            Graph->Release();

        ::CoUninitialize();
    }

    void __fastcall TForm1::OpenFileButtonClick(TObject *Sender)
    {
        if( Graph && Control )
        {
            if( OpenDialog1->Execute() )
            {
                Control->Stop();
                RemoveFilters();
                Graph->RenderFile(WideString(OpenDialog1->FileName), NULL);
            }
        }
    }

    void __fastcall TForm1::PlayFileButtonClick(TObject *Sender)
    {
        if( Control && Seeker )
        {
            REFERENCE_TIME rt = 0;
            if( SUCCEEDED(Seeker->SetPositions(&rt,
AM_SEEKING_AbsolutePositioning, NULL, AM_SEEKING_NoPositioning)) )
                Control->Run();
        }
    }

    void __fastcall TForm1::RemoveFilters()
    {
        IEnumFilters* pEnumFilters = NULL;
        IBaseFilter* pFilter = NULL;
        IEnumPins* pEnumPins = NULL;
        IPin* pPin = NULL;
        IPin* pOtherPin = NULL;

        if( SUCCEEDED(Graph->EnumFilters(&pEnumFilters)) )
        {
            while( pEnumFilters->Next(1, &pFilter, NULL) == S_OK )
            {
                if( SUCCEEDED(pFilter->EnumPins(&pEnumPins)) )
                {
                    while( pEnumPins->Next(1, &pPin, NULL) == S_OK )
                    {
                        if( pPin->ConnectedTo(&pOtherPin) == S_OK )
                        {
                            Graph->Disconnect(pPin);
                            Graph->Disconnect(pOtherPin);
                            pOtherPin->Release();
                        }
                        pPin->Release();
                    }
                    pEnumPins->Release();
                }
                Graph->RemoveFilter(pFilter);
                pFilter->Release();
                pEnumFilters->Reset();
            }
            pEnumFilters->Release();
        }
    }


Gambit
Re: TMediaPlayer can't play MP3's
#44
Author: Mathias Thorell
Date: Thu, 18 May 2006 04:25
27 lines
1771 bytes
Remy Lebeau (TeamB) wrote:
> "Jonathan Benedicto" <invalid@nobody.com> wrote in message
> news:4469cd34@newsgroups.borland.com...
> 
>>No, Windows Media Player uses DirectShow.

...of course...  :-]

> Which in itself is not that hard to use.  I just recently wrote an app that
> plays MP3s via DirectShow.  It only takes a few lines of code to play a
> file, ie:

Yes ! Thanks Gambit !
I had the impression that I needed to mess deeply with codes and such 
things if I wanted to use DirectShow, but I was obviously wrong.
Works like charm now !

As usual, you saved me from getting a lot of gray hairs Gambit.

1000 thanks,
/Mathias Thorell

<snip>

> Gambit
> 
> 
Re: TMediaPlayer can't play MP3's
#54
Author: 4N
Date: Mon, 28 Aug 2006 11:59
27 lines
1790 bytes
hmm, I tought it used vfw since after installing ffdshow some video didn't 
play anyways...

"Jonathan Benedicto" <invalid@nobody.com> ha scritto nel messaggio 
news:4469cd34@newsgroups.borland.com...
> Mathias Thorell wrote:
>> As I understand, the Windows MediaPlayer is using the mci API to render a 
>> file, right ?
>
> No, Windows Media Player uses DirectShow.
>
>> What I want to do is to open a small MP3-file to see if the PC can play 
>> it (and in most cases, it can't, grrr).
>> If the PC is able to play MP3's, I enable a menuitem that will play 
>> different, selectable MP3 HTTP Streams.
>
> I'd suggest trying AudioLab from http://www.mitov.com
>
> HTH
>
> Jonathan
> ------------------------
> TwineCompiler, blazingly fast C++ compiles on ANY machine:
> http://www.jomitech.com/#twine
> ------------------------ 
>
> 
Re: TMediaPlayer can't play MP3's
#55
Author: Boian Mitov
Date: Mon, 28 Aug 2006 20:44
13 lines
1467 bytes
     Hi 4N,

AudioLab supports both VFW ( actually WaveAPI + ACM ), and DirectShow. 
You can develop with one of them, the other or mix them as you wish. 
There are demos included for both technologies. It also supports native 
filters.

   With best regards,
      Boian Mitov

4N wrote:
> hmm, I tought it used vfw since after installing ffdshow some video didn't 
> play anyways...
Re: TMediaPlayer can't play MP3's
#56
Author: 4N
Date: Tue, 29 Aug 2006 16:30
18 lines
1692 bytes
oops, I actually were talking about TMediaPlayer of builder...
sorry for the misunderstanding...


"Boian Mitov" <mitov@mitov.com> ha scritto nel messaggio 
news:44f35520$1@newsgroups.borland.com...
>     Hi 4N,
>
> AudioLab supports both VFW ( actually WaveAPI + ACM ), and DirectShow. You 
> can develop with one of them, the other or mix them as you wish. There are 
> demos included for both technologies. It also supports native filters.
>
>   With best regards,
>      Boian Mitov
>
> 4N wrote:
>> hmm, I tought it used vfw since after installing ffdshow some video 
>> didn't play anyways... 
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads