it has often been discussed that PBs internal Movie Library doesn't handle some formats properly or even does provide wrong time lenghts which also messes up proper seeking. Such issues on mp3 handling for instance where more or less solved by using MCI. This also can be replaced by using this include file.
I did generate an include file incl. commands which in certain situations can replace PBs movie commands . For avoiding confusions I did define those Commands as "Media" Commands as Directshow also is able to perfectly playback & handle audio formats.
The supported formats do depend on the users system installed Dshow filters, means splitters, filters, decoders etc.
I also appended an example where you simply can see the usage.
Beside handling/decoding media formats its also capable to render media outputs individually. Means you/the user can decide which one has to be used for rendering like ... DefaultRenderer, Overlaymixer, VMR7_Windowed/Windowless, VMR9_Windowed/Windowless. And in case of Audio for example the Direct Sound Renderer or the Waveout Renderer.
Such capabilities are i.E. known from MediaplayerClassic and other Dshow supporting Media-Playback apps.
Also you can enumerate the filters in the graph which are actually used for playback
I testet the include using many formats and their containers under WinXP SP2 und Win2000 SP4 like ...
-Avi
-mpeg
-Vob
-mp4-video
-mp4-audio
-mpeg2
-mpeg1
-ogg
-aac (2.0ch, 5.1ch)
-ac3 (2.0ch, 5.1ch)
-mp2
-wave (8,16,20,24,32f bit) (2.0, 5.1)
-mp3 (cbr, vbr)
.... etc
Seeking within streams comes with no problems and therefore also the requested Media time lenghts are correct. Well at least in my Workout environments - please do report bugs if they occur.
Code: Select all
Changes on v1.1 (07/25/2006)
- Everything in the pbi has been checked on proper declarations
by using temporary "EnableExplicit" when testing.
- The missing "If *p" checks in some Procedures have been added.
- Now the WideCharString memory is allocated within the LoadMedia() Procedure.
Therefore on each LoadMedia() call the heap containing the
WideChar String will be set free at the end of the LoadMedia() Procedure.
This made the Procedure L(string.s) becoming
L(*WideCharPointer, String.s) ... see inside.
- The FreeMedia() Command now does check'n stop the media state
by calling the methods from the interfaces directly.
DshowMedia_Example.pb
EDIT: A newer version (v. 1.3) of this include you can find in the german forum: http://www.purebasic.fr/german/viewtopi ... 73#p269873