Loading video problem in DirectShowMovieTexture

Get answers to all your basic programming questions. No Ogre questions, please!
Post Reply
Uma
Gnoblar
Posts: 23
Joined: Fri Mar 28, 2014 8:01 am

Loading video problem in DirectShowMovieTexture

Post by Uma » Fri May 30, 2014 8:46 am

Hi everyone,

I tried to load video using Direct Show and followed instruction in http://www.ogre3d.org/tikiwiki/tiki-ind ... re+texture. And also add some code in createScene() method for video calling.

But there was an error :(

Code: Select all

error LNK2019: unresolved external symbol "public: class Ogre::TexturePtr __thiscall OgreUtils::DirectShowMovieTexture::getMovieTexture(void)"
Following is my code:

SampleVideo.cpp

Code: Select all

#include "SampleVideo.h"
#include "UtilsOgreDshow.h"

void SampleVideo::createScene(void)
{
	OgreUtils::DirectShowMovieTexture* dshowMovieTextureSystem = new OgreUtils::DirectShowMovieTexture(320, 240, true);
	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);
	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(""));
	}
}


If anyone can help me to solve this i'll be much pleased...
0 x

User avatar
c6burns
Beholder
Posts: 1511
Joined: Fri Feb 22, 2013 4:44 am
Location: Deep behind enemy lines

Re: Loading video problem in DirectShowMovieTexture

Post by c6burns » Fri May 30, 2014 12:45 pm

Add the cpp with OgreUtils::DirectShowMovieTexture::getMovieTexture to your project so it gets compiled, then the linker will find the symbol
0 x

Uma
Gnoblar
Posts: 23
Joined: Fri Mar 28, 2014 8:01 am

Re: Loading video problem in DirectShowMovieTexture

Post by Uma » Mon Jun 02, 2014 7:51 am

I also tried as you said but the same error will appear. :oops:
I'm using Visual studio 2010 and Ogre 1.8, Is there are any problem with those coding and the versions.
0 x

User avatar
c6burns
Beholder
Posts: 1511
Joined: Fri Feb 22, 2013 4:44 am
Location: Deep behind enemy lines

Re: Loading video problem in DirectShowMovieTexture

Post by c6burns » Mon Jun 02, 2014 12:24 pm

This is the simplest possible linker error. The linker is telling you in no uncertain terms that you are using OgreUtils::DirectShowMovieTexture::getMovieTexture(void) in your code, but it literally has no definition. The reason the compiler didn't stop you before the linker is that it has a declaration. Without a definition for this method, how can you expect the linker to produce an executable?

The most likely cause is that you aren't actually compiling the file with the definition in it. You are just including the header, which is only enough to get through compilation but not linking.
0 x

Uma
Gnoblar
Posts: 23
Joined: Fri Mar 28, 2014 8:01 am

Re: Loading video problem in DirectShowMovieTexture

Post by Uma » Thu Jun 19, 2014 10:20 am

Now I have managed to load the video. But the problem is it is loading in separate window. I want to put that window into ogre main window. I also tried to load that video onto panel resides on ogre main window. But it is not loading. Anyone Knows how to do this?
0 x

Uma
Gnoblar
Posts: 23
Joined: Fri Mar 28, 2014 8:01 am

Re: Loading video problem in DirectShowMovieTexture

Post by Uma » Fri Jun 20, 2014 11:44 am

My code is as follows,

Code: Select all

	OgreUtils::DirectShowMovieTexture* dshowMovieTextureSystem = new OgreUtils::DirectShowMovieTexture( 640, 480 );
	dshowMovieTextureSystem->loadMovie( "C:/Video/Helicopter.avi" );
	dshowMovieTextureSystem->playMovie();
	bool isPlaying=dshowMovieTextureSystem->isPlayingMovie();
	dshowMovieTextureSystem->updateMovieTexture();

	if( Ogre::MaterialManager::getSingleton().resourceExists( "IntroMaterial" ) )
	   throw( "Error, material already exist!" );

	Ogre::MaterialPtr mat = static_cast<Ogre::MaterialPtr>( Ogre::MaterialManager::getSingleton().create( "IntroMaterial", Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME ) );
	mat->load();
	Ogre::Technique *t = mat->createTechnique();
	Ogre::Pass* p = t->createPass();
	Ogre::TextureUnitState* state = p->createTextureUnitState();
	state->setTextureName( dshowMovieTextureSystem->getMovieTexture()->getName() );

	Ogre::OverlayManager& overlayManager = Ogre::OverlayManager::getSingleton();
	Ogre::Overlay* overlay = overlayManager.create( "OverlayName" );
	Ogre::OverlayContainer* panel = static_cast<Ogre::OverlayContainer*>( overlayManager.createOverlayElement( "Panel", "PanelName" ) );
	panel->setPosition( 0.5, 0.1 );
	panel->setDimensions( 0.4, 0.5 );
	panel->setMaterialName( mat->getName() );
	overlay->add2D( panel );
	overlay->show();
When i remove following code from the UtilsOgreDshow.cpp file, the video is loading in separate window.

Code: Select all

	hr=dsdata->pGraph->QueryInterface(IID_IVideoWindow, (void**) & dsdata->pWindow);
	if (FAILED(hr)) throw("[DSHOW] Error getting video window interface");
	dsdata->pWindow->put_AutoShow(OAFALSE);
When I close this separate window which loads the video, I can still hear the sound of the video till video ends. But video is not displaying on the main rendering window. I want to display the video on Ogre main rendering window.

Did I miss something, I really need to fix this problem.....
0 x

Post Reply