@funcdoobiest
did you take a look for DirectShow in help file and see if it allows to specify the depth of the surface or not, if i have time i will dig and see how to solve that problem.
@evo
welcome back ,hope you got some funy times.
actually in may last version of magic Library { ver 1.1 } i have changed the LoadMovie function so that allows to play the movie with sound , here the prototype of the function
virtual void LoadMovie(char* filename,bool useCLOCK =false, bool useAUDIO = false);
useCLOCK allows to play movie with it's orignal FPS then SetMovieFPS function will be useless
useAUDIO allows to play movie with the sound in the Orignal FPS
see the PlayingMovie demo it playes MPEG movie with sound " see how dogs love to smoke
"
here is the demo
Code: Select all
/************************************
how to play movie
with sound
By Emil Halim
*************************************/
#include <MagicIncludes.h>
// global declration of Irrlicht interfaces
IrrlichtDevice* device;
IVideoDriver* driver;
ISceneManager* smgr;
bool ProgramRun;
#define TextureWidth 1024
#define TextureHeight 1024
class CSampleSceneNode : public ISceneNode
{
aabbox3d<f32> Box;
SMaterial Material;
public:
S3DVertex Vertices[4];
CSampleSceneNode(ISceneNode* parent, ISceneManager* mgr, s32 id,f32 u, f32 v): ISceneNode(parent, mgr, id)
{
Material.Wireframe = false;
Material.Lighting = false;
Vertices[0] = S3DVertex(-10,-10,0, 0,0,0,SColor(255,255,255,255),0,v);
Vertices[1] = S3DVertex( 10,-10,0, 0,0,0,SColor(255,255,255,255),u,v);
Vertices[2] = S3DVertex( 10, 10,0, 0,0,0,SColor(255,255,255,255),u,0);
Vertices[3] = S3DVertex(-10, 10,0, 0,0,0,SColor(255,255,255,255),0,0);
Box.reset(Vertices[0].Pos);
for (s32 i=1; i<4; ++i) Box.addInternalPoint(Vertices[i].Pos);
}
virtual void OnPreRender()
{
if (IsVisible) SceneManager->registerNodeForRendering(this);
ISceneNode::OnPreRender();
}
virtual void render()
{
u16 indices[] = { 0,1,3, 3,1,2, 1,0,2, 2,0,3 };
IVideoDriver* driver = SceneManager->getVideoDriver();
driver->setMaterial(Material);
SetBlend(ALPHABLEND);
driver->setTransform(ETS_WORLD, AbsoluteTransformation);
driver->drawIndexedTriangleList(&Vertices[0], 4, &indices[0], 4);
}
virtual const aabbox3d<f32>& getBoundingBox() const
{
return Box;
}
virtual s32 getMaterialCount()
{
return 1;
}
virtual SMaterial& getMaterial(s32 i)
{
return Material;
}
};
int main()
{
device = createDevice(EDT_OPENGL, dimension2d<s32>(640, 480), 32);
bool rslt = InitMagic(device);
if(rslt == false)
printf("Magic Library will only work with OpenGL driver");
driver = device->getVideoDriver();
smgr = device->getSceneManager();
TMovie* movie=new TMovie;
movie->LoadMovie("../../MagicLibrary/media/dog.DAT",true,true);
// movie->SetMovieFPS(10);
movie->SetLooped(true);
driver->setTextureCreationFlag(ETCF_ALWAYS_32_BIT,TRUE);
driver->setTextureCreationFlag(ETCF_CREATE_MIP_MAPS,FALSE);
ITexture* movTxtr = driver->addTexture(dimension2d<s32>(TextureWidth,TextureHeight),"",ECF_A8R8G8B8);
smgr->addCameraSceneNode(0,vector3df(0,0,-30),vector3df(0,0,0));
f32 U = (f32)movie->MovieWidth() / (f32)TextureWidth;
f32 V = (f32)movie->MovieHeight() / (f32)TextureHeight;
CSampleSceneNode* myNode=new CSampleSceneNode(smgr->getRootSceneNode(),smgr,666,U,V);
myNode->setMaterialTexture(0,movTxtr);
myNode->setMaterialType(EMT_TRANSPARENT_VERTEX_ALPHA);
myNode->setPosition(vector3df(0,5,0));
myNode->setScale(vector3df(2.5,0.75f,0));
ProgramRun = true;
int lastFPS = -1;
while(device->run()&& ProgramRun)
{
driver->beginScene(true, true, SColor(0,200,0,0));
if(KeyDown(KEY_ESCAPE))ProgramRun=false;
movie->NextMovieFrame();
movie->DrawMovie(0,0,movTxtr);
smgr->drawAll();
driver->endScene();
int fps = driver->getFPS();
if (lastFPS != fps)
{
wchar_t tmp[1024];
swprintf(tmp, 1024, L"how to play movie Example (%s)(fps:%d)",driver->getName(), fps);
device->setWindowCaption(tmp);
lastFPS = fps;
}
}
device->drop();
return 0;
}
the only drawback is when you use the movie with sound you are limit to 25 FPS for your entire scene.