(Code Snippet) Video reproduction using DirectShow

Discussion area about developing or extending OGRE, adding plugins for it or building applications on it. No newbie questions please, use the Help forum for that.
Post Reply
davisdmg
Gnoblar
Posts: 2
Joined: Mon Mar 21, 2011 12:32 pm

Re: (Code Snippet) Video reproduction using DirectShow

Post by davisdmg »

I can reproduce the avi file in windows media player without problems, so I suposse that I have the codecs.

The problems is with all videos (.avi, .mpg) :(


Sorry my english, I'm spanish.
User avatar
vitefalcon
Orc
Posts: 438
Joined: Tue Sep 18, 2007 5:28 pm
Location: Seattle, USA
x 13

Re: (Code Snippet) Video reproduction using DirectShow

Post by vitefalcon »

Windows media player and DirectShow are not the same. So you cannot assert that you've got the codec just because you play that file in WMP. You'll need to find the encoding of the AVI. Hopefully this link should be useful to you.
Image
ProDOgre
Gnoblar
Posts: 4
Joined: Wed Apr 20, 2011 2:13 pm

Re: (Code Snippet) Video reproduction using DirectShow

Post by ProDOgre »

Hi guys,

I'm playing videos normally when the application is in windowed mode but when the application is in full screen, when
I execute the playMovie() method the application goes to windows and I have to click in the application icon to go back
to the fullscreen again... it seems when playing the video for the first time it sends a Device reset or something...
I have windows7 with a nice graphics cards... Do you have any solution for this issue?

Thank you in advace!
lacasta3
Gnoblar
Posts: 1
Joined: Thu Jan 12, 2012 3:43 pm

Re: (Code Snippet) Video reproduction using DirectShow

Post by lacasta3 »

Hello ,i tried to play a movie in a basic ogre application,i hear the sound but i dont cant see the movie
my video is an AVI video with alpha i think and this is my code :

void TutorialApplication::createScene(void)
{
OgreUtils::DirectShowMovieTexture* directShozTextSys = new OgreUtils::DirectShowMovieTexture(960,540);


Ogre::MaterialPtr mat;
Ogre::TextureUnitState* tex;


Ogre::String moviename = "D:/video/PixOrb_1.avi";
directShozTextSys->loadMovie(moviename);


Ogre::String materialName="MyMaterial";



if (Ogre::MaterialManager::getSingleton().resourceExists(materialName))
{


mat=Ogre::MaterialManager::getSingleton().getByName(materialName);
tex=mat->getTechnique(0)->getPass(0)->getTextureUnitState(0);
tex->setTextureName(directShozTextSys->getMovieTexture()->getName() );

}

directShozTextSys->playMovie();

....

can anyone help me plz,i really need to resolve this.
Uma
Gnoblar
Posts: 23
Joined: Fri Mar 28, 2014 8:01 am

Re: (Code Snippet) Video reproduction using DirectShow

Post by Uma »

Hi all,

I have a problem with video loading on Ogre using DirectShow.
I followed example here: http://www.ogre3d.org/tikiwiki/tiki-ind ... re+texture

This is my code:

Code: Select all

void SampleVideo::createScene(void)
{
	OgreUtils::DirectShowMovieTexture* dshowMovieTextureSystem = new OgreUtils::DirectShowMovieTexture(320, 240);
	Ogre::String movieName="C:/Video/composite.avi";
	dshowMovieTextureSystem->loadMovie(movieName);

	dshowMovieTextureSystem->playMovie();
	dshowMovieTextureSystem->pauseMovie();
	dshowMovieTextureSystem->stopMovie();
	dshowMovieTextureSystem->rewindMovie();

	bool isPlaying = dshowMovieTextureSystem->isPlayingMovie();

	dshowMovieTextureSystem->updateMovieTexture();

	Ogre::MaterialPtr mat;
	Ogre::TextureUnitState* tex;
 
	Ogre::String materialName="MyMaterial";
	if (!Ogre::MaterialManager::getSingleton().resourceExists(materialName))
	{
		throw("Error, material doesn't exist!");
		//return 0;
	}
	mat = Ogre::MaterialManager::getSingleton().getByName(materialName);
	mat->load();
	tex = mat->getTechnique(0)->getPass(0)->getTextureUnitState(0);
	tex->setTextureName(dshowMovieTextureSystem->getMovieTexture()->getName());

	delete dshowMovieTextureSystem;

	if (Ogre::MaterialManager::getSingleton().resourceExists(materialName))
	{
		Ogre::MaterialPtr mat;
		Ogre::TextureUnitState* tex;
 
		mat=Ogre::MaterialManager::getSingleton().getByName(materialName);
		tex=mat->getTechnique(0)->getPass(0)->getTextureUnitState(0);
		tex->setTextureName(Ogre::String(""));
	}
}
But there was an error:

Code: Select all

Error	1	error LNK2019: unresolved external symbol "public: class Ogre::TexturePtr __thiscall OgreUtils::DirectShowMovieTexture::getMovieTexture(void)" (?getMovieTexture@DirectShowMovieTexture@OgreUtils@@QAE?AVTexturePtr@Ogre@@XZ) referenced in function "protected: virtual void __thiscall SampleVideo::createScene(void)" (?createScene@SampleVideo@@MAEXXZ)	C:\Univotec\Task\Process\SampleVideo\SampleVideo\SampleVideo.obj
Error	2	error LNK2019: unresolved external symbol "public: void __thiscall OgreUtils::DirectShowMovieTexture::updateMovieTexture(void)" (?updateMovieTexture@DirectShowMovieTexture@OgreUtils@@QAEXXZ) referenced in function "protected: virtual void __thiscall SampleVideo::createScene(void)" (?createScene@SampleVideo@@MAEXXZ)	C:\Univotec\Task\Process\SampleVideo\SampleVideo\SampleVideo.obj
Error	3	error LNK2019: unresolved external symbol "public: bool __thiscall OgreUtils::DirectShowMovieTexture::isPlayingMovie(void)" (?isPlayingMovie@DirectShowMovieTexture@OgreUtils@@QAE_NXZ) referenced in function "protected: virtual void __thiscall SampleVideo::createScene(void)" (?createScene@SampleVideo@@MAEXXZ)	C:\Univotec\Task\Process\SampleVideo\SampleVideo\SampleVideo.obj
Error	4	error LNK2019: unresolved external symbol "public: void __thiscall OgreUtils::DirectShowMovieTexture::rewindMovie(void)" (?rewindMovie@DirectShowMovieTexture@OgreUtils@@QAEXXZ) referenced in function "protected: virtual void __thiscall SampleVideo::createScene(void)" (?createScene@SampleVideo@@MAEXXZ)	C:\Univotec\Task\Process\SampleVideo\SampleVideo\SampleVideo.obj
Error	5	error LNK2019: unresolved external symbol "public: void __thiscall OgreUtils::DirectShowMovieTexture::stopMovie(void)" (?stopMovie@DirectShowMovieTexture@OgreUtils@@QAEXXZ) referenced in function "protected: virtual void __thiscall SampleVideo::createScene(void)" (?createScene@SampleVideo@@MAEXXZ)	C:\Univotec\Task\Process\SampleVideo\SampleVideo\SampleVideo.obj
Error	6	error LNK2019: unresolved external symbol "public: void __thiscall OgreUtils::DirectShowMovieTexture::pauseMovie(void)" (?pauseMovie@DirectShowMovieTexture@OgreUtils@@QAEXXZ) referenced in function "protected: virtual void __thiscall SampleVideo::createScene(void)" (?createScene@SampleVideo@@MAEXXZ)	C:\Univotec\Task\Process\SampleVideo\SampleVideo\SampleVideo.obj
Error	7	error LNK2019: unresolved external symbol "public: void __thiscall OgreUtils::DirectShowMovieTexture::playMovie(void)" (?playMovie@DirectShowMovieTexture@OgreUtils@@QAEXXZ) referenced in function "protected: virtual void __thiscall SampleVideo::createScene(void)" (?createScene@SampleVideo@@MAEXXZ)	C:\Univotec\Task\Process\SampleVideo\SampleVideo\SampleVideo.obj
Error	8	error LNK2019: unresolved external symbol "public: void __thiscall OgreUtils::DirectShowMovieTexture::loadMovie(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,bool)" (?loadMovie@DirectShowMovieTexture@OgreUtils@@QAEXABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@_N@Z) referenced in function "protected: virtual void __thiscall SampleVideo::createScene(void)" (?createScene@SampleVideo@@MAEXXZ)	C:\Univotec\Task\Process\SampleVideo\SampleVideo\SampleVideo.obj
Error	9	error LNK2019: unresolved external symbol "public: __thiscall OgreUtils::DirectShowMovieTexture::DirectShowMovieTexture(int,int,bool)" (??0DirectShowMovieTexture@OgreUtils@@QAE@HH_N@Z) referenced in function "protected: virtual void __thiscall SampleVideo::createScene(void)" (?createScene@SampleVideo@@MAEXXZ)	C:\Univotec\Task\Process\SampleVideo\SampleVideo\SampleVideo.obj
Error	10	error LNK1120: 9 unresolved externals	C:\Univotec\Task\Process\SampleVideo\SampleVideo\bin\Debug\\SampleVideo.exe	1
Is there anyone deal with that error before, please help me..............
User avatar
c6burns
Beholder
Posts: 1512
Joined: Fri Feb 22, 2013 4:44 am
Location: Deep behind enemy lines
x 138

Re: (Code Snippet) Video reproduction using DirectShow

Post by c6burns »

This is the same problem as your other thread http://www.ogre3d.org/forums/viewtopic.php?f=10&t=81079
(aka linking 101)
Post Reply