Try uninstalling it and let us know what happens. I would be interested in finding out if it solves your problem too.but there is no way to deny a user from having Nero installed..
(Code Snippet) Video reproduction using DirectShow
-
- Gremlin
- Posts: 158
- Joined: Tue Jan 17, 2006 12:09 am
I uninstalled it, and it solved the problem, but still, as I said, if I open the video in Media Player without setting the compatibility mode it works, but in my program it won't. And the only way it will work is checking the comptability mode.
I know that I could just say "Please check compatibility mode in the Decoder Options Dialog of XVid", but I am trying hard to avoid having to configure the user's PC for my app to work.
Is there's something in the direct show code snippet that can be implemented/extended for XVid to work without configuring?
I know that I could just say "Please check compatibility mode in the Decoder Options Dialog of XVid", but I am trying hard to avoid having to configure the user's PC for my app to work.
Is there's something in the direct show code snippet that can be implemented/extended for XVid to work without configuring?
- jona vark
- Gold Sponsor
- Posts: 83
- Joined: Tue May 01, 2007 2:38 am
I am afraid I can't answer your question as you are probably deeper into this than I am. I am glad that it works now for you but I agree it is problematic when you have to start telling users to remove other apps! I look forward to a solution if you find it and I'll post if I find one. Although this problem seems to be a Nero artifact. I don't think any program should have system wide reach like that, when it is not running.
FWIW I am not using XVID. I had this problem with WMV files so the Nero stuff affected quite a range of codecs.
Please post anything you find.
UPDATE:
Here ya go:
http://groups.google.com/group/microsof ... f183976989
FWIW I am not using XVID. I had this problem with WMV files so the Nero stuff affected quite a range of codecs.
Please post anything you find.
UPDATE:
Here ya go:
http://groups.google.com/group/microsof ... f183976989
-
- Gremlin
- Posts: 158
- Joined: Tue Jan 17, 2006 12:09 am
OK, finally made XVid work...
I had to do a very fast course on DirectShow, because I didn't know anything about it.. but I somehow got it working, with a lot of help from bits of code from all over the net...
The real change is in the loadMovie method, which creates a source and grabber filter and connects them.
I adapted (and copied a good part of it) from an example in http://www.codeproject.com/audio/VideoAnaFramework.asp
So the updated method goes like this:
I also had to modify the DirectShowData structure, and add a couple of helper functions straight from the CodeProject source:
I also added an iterator that looks for videos with .avi extension declared in the "General" resource group, so all you have to do is place them in a directory, and add it to your resources.cfg file, or manually yo can do this before loading the video:
Ogre::String myDirPath = "../videos";
Ogre::ResourceGroupManager::getSingletonPtr()->addResourceLocation(myDirPath , "FileSystem" );
Ogre::ResourceGroupManager::getSingletonPtr()->initialiseResourceGroup("General");
I still have problems with the refreshing of the texture. It looks jagged sometimes. I mean, is not as smooth as a video in media player. I suppose it could be fixed by having two textures, one as a backbuffer....but I am only supposing not sure if that is the problem..
Any pointers on this I will gladly receive. Also is it possible to load the entire movie in memory so it plays smoother?
Another issue I found is that the texture size is declared when loading the system, but if you load a video that is larger than the texture it chops parts of the movie. So I think the best way is to create the texture when the movie size is known.
I had to do a very fast course on DirectShow, because I didn't know anything about it.. but I somehow got it working, with a lot of help from bits of code from all over the net...
The real change is in the loadMovie method, which creates a source and grabber filter and connects them.
I adapted (and copied a good part of it) from an example in http://www.codeproject.com/audio/VideoAnaFramework.asp
So the updated method goes like this:
Code: Select all
void DirectShowMovieTexture::loadMovie( const Ogre::String& moviePath, bool horizontalMirroring)
{
HRESULT hr = S_OK;
// Look for the video path
Ogre::String path = "";
Ogre::FileInfoListPtr results = Ogre::ResourceGroupManager::getSingleton().findResourceFileInfo("General", "*.avi");
Ogre::FileInfoList::iterator itr = results->begin();
while(itr != results->end())
{
if((*itr).filename == moviePath)
{
//path = (*itr).archive->getName() + "/" + (*itr).filename;
path = (*itr).archive->getName() + (*itr).filename;
//and so on
break;
}
itr ++;
}
if(path==""){
Ogre::String("[DSHOW] Couldn't find the video '" + moviePath+"'.");
throw("[DSHOW] Couldn't find the video");
}
// log it!
Ogre::LogManager::getSingletonPtr()->logMessage(Ogre::String("[DSHOW] Loading movie named '")+moviePath+"'.");
// destroy previous movie objects (if any)
unloadMovie();
// Create the graph builder
hr = ::CoCreateInstance(CLSID_FilterGraph, NULL, CLSCTX_INPROC_SERVER,
IID_IGraphBuilder, reinterpret_cast<void**>(&dsdata->pGraph));
if (FAILED(hr)) throw("Failed creating DirectShow objects!");
// Create the Sample Grabber
dsdata->pGrabberF = NULL;
dsdata->pGrabber = NULL;
hr = CoCreateInstance(CLSID_SampleGrabber, NULL, CLSCTX_INPROC_SERVER,
IID_IBaseFilter, reinterpret_cast<void**>(&dsdata->pGrabberF));
hr = dsdata->pGrabberF->QueryInterface(IID_ISampleGrabber,
reinterpret_cast<void**>(&dsdata->pGrabber));
hr = dsdata->pGraph->AddFilter(dsdata->pGrabberF, L"SampleGrabber");
// Set the media type
AM_MEDIA_TYPE mt;
ZeroMemory(&mt, sizeof(AM_MEDIA_TYPE));
mt.formattype = FORMAT_VideoInfo;
mt.majortype = MEDIATYPE_Video;
mt.subtype = MEDIASUBTYPE_RGB24; // only accept 24-bit bitmaps
hr = dsdata->pGrabber->SetMediaType(&mt);
// Create the src filter
wchar_t archivo[MAX_PATH];
MultiByteToWideChar(CP_ACP, 0, path.c_str(), -1, archivo, MAX_PATH);
hr = dsdata->pGraph->AddSourceFilter(archivo, L"Source", &dsdata->pSrcFilter);
if(FAILED(hr)) throw("Unsupported media type!");
// Connect the src and grabber
hr = ConnectFilters(dsdata->pGraph, dsdata->pSrcFilter, dsdata->pGrabberF);
// Create the NULL renderer and connect
dsdata->pNullRenderer = NULL;
hr = CoCreateInstance(CLSID_NullRenderer, NULL, CLSCTX_INPROC_SERVER,
IID_IBaseFilter, reinterpret_cast<void**>(&dsdata->pNullRenderer));
hr = dsdata->pGraph->AddFilter(dsdata->pNullRenderer, L"NullRenderer");
hr = ConnectFilters(dsdata->pGraph, dsdata->pGrabberF, dsdata->pNullRenderer);
// set sampling options
dsdata->pGrabber->SetOneShot(FALSE);
dsdata->pGrabber->SetBufferSamples(TRUE);
// Necessary interfaces for controlling
dsdata->pGraph->QueryInterface(IID_IMediaControl, reinterpret_cast<void**>(&dsdata->pControl));
dsdata->pGraph->QueryInterface(IID_IMediaEvent, reinterpret_cast<void**>(&dsdata->pEvent));
dsdata->pGraph->QueryInterface(IID_IMediaSeeking, reinterpret_cast<void**>(&dsdata->pSeeking));
// Retrieve the actual media type
ZeroMemory(&mt, sizeof(mt));
hr = dsdata->pGrabber->GetConnectedMediaType(&mt);
VIDEOINFOHEADER *vih;
if (mt.formattype == FORMAT_VideoInfo)
vih = reinterpret_cast<VIDEOINFOHEADER*>(mt.pbFormat);
else
{
throw("No video stream found!");
}
vih = (VIDEOINFOHEADER*) mt.pbFormat;
dsdata->nVideoWidth=vih->bmiHeader.biWidth;
dsdata->nVideoHeight=vih->bmiHeader.biHeight;
// microsoft's help version of free media type
if (mt.cbFormat != 0)
{
CoTaskMemFree((PVOID)mt.pbFormat);
mt.cbFormat = 0;
mt.pbFormat = NULL;
}
if (mt.pUnk != NULL)
{
mt.pUnk->Release();
mt.pUnk = NULL;
}
// set some basic data
mHorizontalMirroring=horizontalMirroring;
// clean the texture, so that it's ready for rendering this video
cleanTextureContents();
}
I also had to modify the DirectShowData structure, and add a couple of helper functions straight from the CodeProject source:
Code: Select all
namespace OgreUtils
{
struct DirectShowData
{
/// Graph object
IGraphBuilder *pGraph;
/// Media control object
IMediaControl *pControl;
/// Media event object
//IMediaEvent *pEvent;
/// Grabber filter
IBaseFilter *pGrabberF;
/// Grabber object
ISampleGrabber *pGrabber;
/// Interface for seeking object
IMediaSeeking *pSeeking;
/// Window interface
/** Useful for some configuration
*/
IVideoWindow *pWindow;
/// Video output width
int nVideoWidth;
/// Video output height
int nVideoHeight;
IBaseFilter *pSrcFilter;
IBaseFilter *pNullRenderer;
IMediaEventEx *pEvent;
};
/// Util function for converting C strings to wide strings
/** (as needed for path in directshow). */
WCHAR* util_convertCStringToWString(const char* string);
HRESULT GetPin(IBaseFilter *pFilter, PIN_DIRECTION PinDir, IPin **ppPin){
IEnumPins *pEnum;
IPin *pPin;
pFilter->EnumPins(&pEnum);
while(pEnum->Next(1, &pPin, 0) == S_OK)
{
PIN_DIRECTION PinDirThis;
pPin->QueryDirection(&PinDirThis);
if (PinDir == PinDirThis)
{
pEnum->Release();
*ppPin = pPin;
return S_OK;
}
pPin->Release();
}
pEnum->Release();
return E_FAIL;
};
HRESULT ConnectFilters(IGraphBuilder *pGraph, IBaseFilter *pFirst, IBaseFilter *pSecond)
{
IPin *pOut = NULL, *pIn = NULL;
HRESULT hr = GetPin(pSecond, PINDIR_INPUT, &pIn);
if (FAILED(hr)) return hr;
// The previous filter may have multiple outputs, so try each one!
IEnumPins *pEnum;
pFirst->EnumPins(&pEnum);
while(pEnum->Next(1, &pOut, 0) == S_OK)
{
PIN_DIRECTION PinDirThis;
pOut->QueryDirection(&PinDirThis);
if (PINDIR_OUTPUT == PinDirThis)
{
hr = pGraph->Connect(pOut, pIn);
if(!FAILED(hr))
{
break;
}
}
pOut->Release();
}
pEnum->Release();
pIn->Release();
pOut->Release();
return hr;
};
}
Ogre::String myDirPath = "../videos";
Ogre::ResourceGroupManager::getSingletonPtr()->addResourceLocation(myDirPath , "FileSystem" );
Ogre::ResourceGroupManager::getSingletonPtr()->initialiseResourceGroup("General");
I still have problems with the refreshing of the texture. It looks jagged sometimes. I mean, is not as smooth as a video in media player. I suppose it could be fixed by having two textures, one as a backbuffer....but I am only supposing not sure if that is the problem..
Any pointers on this I will gladly receive. Also is it possible to load the entire movie in memory so it plays smoother?
Another issue I found is that the texture size is declared when loading the system, but if you load a video that is larger than the texture it chops parts of the movie. So I think the best way is to create the texture when the movie size is known.
-
- Gremlin
- Posts: 158
- Joined: Tue Jan 17, 2006 12:09 am
- syedhs
- Silver Sponsor
- Posts: 2703
- Joined: Mon Aug 29, 2005 3:24 pm
- Location: Kuala Lumpur, Malaysia
- x 51
-
- Gremlin
- Posts: 158
- Joined: Tue Jan 17, 2006 12:09 am
I read it but as no one replied to my posts I tought it didn't work for XVid.syedhs wrote:ricardo,
Err did you by any chance reading my past post in this thread? Because you are referring to the same article in the code project as mine Sorry for not replying earlier as I thought you can figure it out.
But it works ...
-
- Halfling
- Posts: 62
- Joined: Fri Nov 17, 2006 11:26 pm
Hello
I'm trying to use the DirectShow code snippet in my application Ogre, but i have some errors in compilation.
UtilsOgreDshow.cpp
d:\program files\microsoft sdks\windows\v6.0\include\comcat.h(158) : error C2146: syntax error : missing ';' before identifier 'IEnumGUID'
d:\program files\microsoft sdks\windows\v6.0\include\comcat.h(158) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
d:\program files\microsoft sdks\windows\v6.0\include\comcat.h(171) : error C2061: syntax error : identifier '__RPC__out_ecount_part'
d:\program files\microsoft sdks\windows\v6.0\include\comcat.h(172) : error C2059: syntax error : ')'
d:\program files\microsoft sdks\windows\v6.0\include\comcat.h(172) : fatal error C1903: unable to recover from previous error(s); stopping compilation
I have Windows Vista instaled in my computer and i had that instal the
Microsoft® Windows® Software Development Kit for Windows Vista™ and .NET Framework 3.0 Runtime Components, because the Dshow.h file is not instaled in my OS.
but i open comcat.h file and everything looks fine (I thing...)
I'm trying to use the DirectShow code snippet in my application Ogre, but i have some errors in compilation.
UtilsOgreDshow.cpp
d:\program files\microsoft sdks\windows\v6.0\include\comcat.h(158) : error C2146: syntax error : missing ';' before identifier 'IEnumGUID'
d:\program files\microsoft sdks\windows\v6.0\include\comcat.h(158) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
d:\program files\microsoft sdks\windows\v6.0\include\comcat.h(171) : error C2061: syntax error : identifier '__RPC__out_ecount_part'
d:\program files\microsoft sdks\windows\v6.0\include\comcat.h(172) : error C2059: syntax error : ')'
d:\program files\microsoft sdks\windows\v6.0\include\comcat.h(172) : fatal error C1903: unable to recover from previous error(s); stopping compilation
I have Windows Vista instaled in my computer and i had that instal the
Microsoft® Windows® Software Development Kit for Windows Vista™ and .NET Framework 3.0 Runtime Components, because the Dshow.h file is not instaled in my OS.
but i open comcat.h file and everything looks fine (I thing...)
- ruichaves
- Kobold
- Posts: 35
- Joined: Sat Dec 16, 2006 8:49 pm
- Location: Portugal
Hi everyone!
What's wrong with my code:
I can't see the movie, but i listen the sound...
What's wrong with my code:
Code: Select all
mRoot = Ogre::Root::getSingletonPtr();
mSceneMgr = mRoot->createSceneManager( Ogre::ST_GENERIC );
mCamera = mSceneMgr->createCamera( "MenuCamera" );
mViewport = mRoot->getAutoCreatedWindow()->addViewport( mCamera );
//Para efeito de testes
mViewport->setBackgroundColour( Ogre::ColourValue::White );
dshowMovieTextureSystem = new OgreUtils::DirectShowMovieTexture(
mRoot->getAutoCreatedWindow()->getWidth(),
mRoot->getAutoCreatedWindow()->getHeight());
this->movieName = "./video/intro.wmv";
this->dshowMovieTextureSystem->loadMovie(movieName); //load the movie
this->materialName = "video";
if (!Ogre::MaterialManager::getSingleton().resourceExists(this->materialName))
{
throw("Video Intro: Error, material doesn't exist!");
return;
}
this->mat = Ogre::MaterialManager::getSingleton().getByName(this->materialName);
this->tex = mat->getTechnique(0)->getPass(0)->getTextureUnitState(0);
this->tex->setTextureName(dshowMovieTextureSystem->getMovieTexture()->getName());
Ogre::LogManager::getSingletonPtr()->logMessage(
Ogre::String("VIDEO loaded?: ") + Ogre::StringConverter::toString(this->tex->isLoaded()) );
//this->tex->setTextureScale(1.0, 1.0);
this->dshowMovieTextureSystem->playMovie(); //play the movie
---- Lost Shot ----
visit in: http://www.lostshot.net
visit in: http://www.lostshot.net
- ruichaves
- Kobold
- Posts: 35
- Joined: Sat Dec 16, 2006 8:49 pm
- Location: Portugal
I resolve the problem...
I didn't use the texture, then i didn't see the video, just listen the audio...
For those that have the same problem, just create a rectangle2d and add the material to the rectangle..
I didn't use the texture, then i didn't see the video, just listen the audio...
For those that have the same problem, just create a rectangle2d and add the material to the rectangle..
Code: Select all
// Create background rectangle covering the whole screen
rect = new Rectangle2D(true);
rect->setCorners(-1.0, 1.0, 1.0, -1.0);
rect->setMaterial("videoMaterial");
// Render the background before everything else
rect->setRenderQueueGroup(RENDER_QUEUE_BACKGROUND);
// Use infinite AAB to always stay visible
AxisAlignedBox aabInf;
aabInf.setInfinite();
rect->setBoundingBox(aabInf);
// Attach background to the scene
node = mSceneMgr->getRootSceneNode()->createChildSceneNode("videoMaterial");
node->attachObject(rect); //apagar...
---- Lost Shot ----
visit in: http://www.lostshot.net
visit in: http://www.lostshot.net
-
- Gnoblar
- Posts: 2
- Joined: Thu Sep 13, 2007 4:33 pm
I tried to use the code , but linker mistakes came forward :
It Strmiids.lib is added to the library list !!
System : VS2005 EE SP1 , WinXP SP2 , Ogre 1.2 , Microsoft Platform SDK for Windows Server 2003 R2 , Microsoft DirectX SDK (June 2007) + Extras
Code: Select all
Compiling...
main.cpp
Linking...
main.obj : error LNK2001: unresolved external symbol "public: void __thiscall OgreUtils::DirectShowMovieTexture::updateMovieTexture(void)" (?updateMovieTexture@DirectShowMovieTexture@OgreUtils@@QAEXXZ)
main.obj : error LNK2001: unresolved external symbol "public: void __thiscall OgreUtils::DirectShowMovieTexture::playMovie(void)" (?playMovie@DirectShowMovieTexture@OgreUtils@@QAEXXZ)
main.obj : error LNK2001: 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)
main.obj : error LNK2001: unresolved external symbol "public: __thiscall OgreUtils::DirectShowMovieTexture::DirectShowMovieTexture(int,int,bool)" (??0DirectShowMovieTexture@OgreUtils@@QAE@HH_N@Z)
..\..\bin\Release\The_Dead.exe : fatal error LNK1120: 4 unresolved externals
System : VS2005 EE SP1 , WinXP SP2 , Ogre 1.2 , Microsoft Platform SDK for Windows Server 2003 R2 , Microsoft DirectX SDK (June 2007) + Extras
- hmoraldo
- OGRE Expert User
- Posts: 517
- Joined: Tue Mar 07, 2006 11:22 pm
- Location: Buenos Aires, Argentina
- x 1
- Contact:
Alll the updated code is in the wiki, excepting the last xvid modification (but I couldn't test it yet).
And for linking, did you add UtilsOgreDshow.cpp to your project? Only including the .h files won't work, as the builder needs to know that it needs to compile and link that cpp file too. I think that's your problem.
And for linking, did you add UtilsOgreDshow.cpp to your project? Only including the .h files won't work, as the builder needs to know that it needs to compile and link that cpp file too. I think that's your problem.
H. Hernan Moraldo
Personal website
Personal website
-
- Gnoblar
- Posts: 2
- Joined: Thu Sep 13, 2007 4:33 pm
- hmoraldo
- OGRE Expert User
- Posts: 517
- Joined: Tue Mar 07, 2006 11:22 pm
- Location: Buenos Aires, Argentina
- x 1
- Contact:
Check with some standard video that you can see with the Windows Media Player with no problems. If you can do that, you shouldn't have problems with the code. If that's the case, then the problem is probably in how you use the library.nacsasoft wrote:Ohh sorry !!!!!!!!
I forgot it UtilsOgreDshow.cpp to add a file to the project. :oops: :oops:
Thank you for the help !!!!
Already only so much the problem that the avi the opening of a file the program is frozen off.
May be that not good codec I compressed it ?
H. Hernan Moraldo
Personal website
Personal website
-
- Halfling
- Posts: 44
- Joined: Sun Aug 13, 2006 4:04 pm
- Location: Norman, OK, USA
- Contact:
-
- Gnoblar
- Posts: 3
- Joined: Sun Sep 23, 2007 4:30 pm
Hi all,
I've had no trouble compiling and linking this together. However I am getting the following error message while running this code snippet in my Ogre.log
01:51:48: OGRE EXCEPTION(6:FileNotFoundException): Cannot locate resource DirectShowManualTexture in resource group General or any other group. in ResourceGroupManager::openResource at c:\cdev\cubedev\projects\echo\ogrenew\ogremain\src\ogreresourcegroupmanager.cpp (line 603)
I believe I've created the required libs and am using the code as documented.
I'm using Ogre Version 1.4.3 (Eihort) and things appear to be loading correctly as indicated in my log.
01:51:46: [DSHOW] Creating texture with dimensions 800x600.
01:51:46: [DSHOW] Loading movie named 'C:/h.avi'.
01:51:47: [DSHOW] -> This movie has dimensions: 624x352.
While in my application sound can be heard but white is rendered if I'm using DX and a weird black and yellow texture if using OpenGL.
Incase I've screwed up
I have this to initialize -
And then per every frame (checking removed for brevity) -
When checking if "DirectShowManualTexture" exists
I naturally find it's not there. I'm assuming this is the source of my troubles? However mTexture appears to be created correctly as I can inspect it in the debugger.
As pointed out by someone earlier the line -
Does seem to cause problems. Stepping through the debugger it completely exits out of the application before I can read what the hr value is. My knowledge of Directshow is pretty lacking so I'm not sure why.
Hope my first post to these forums doesn't make me come across as useful as a glass hammer... But I'm out of ideas and\or I'm completely missing something obvious.
Thanks!
Bino
I've had no trouble compiling and linking this together. However I am getting the following error message while running this code snippet in my Ogre.log
01:51:48: OGRE EXCEPTION(6:FileNotFoundException): Cannot locate resource DirectShowManualTexture in resource group General or any other group. in ResourceGroupManager::openResource at c:\cdev\cubedev\projects\echo\ogrenew\ogremain\src\ogreresourcegroupmanager.cpp (line 603)
I believe I've created the required libs and am using the code as documented.
I'm using Ogre Version 1.4.3 (Eihort) and things appear to be loading correctly as indicated in my log.
01:51:46: [DSHOW] Creating texture with dimensions 800x600.
01:51:46: [DSHOW] Loading movie named 'C:/h.avi'.
01:51:47: [DSHOW] -> This movie has dimensions: 624x352.
While in my application sound can be heard but white is rendered if I'm using DX and a weird black and yellow texture if using OpenGL.
Incase I've screwed up
I have this to initialize -
Code: Select all
dshowMovieTextureSystem = new OgreUtils::DirectShowMovieTexture(800, 600);
Ogre::String movieName="C:/h.avi";
dshowMovieTextureSystem->loadMovie(movieName);
dshowMovieTextureSystem->playMovie();
Code: Select all
dshowMovieTextureSystem->updateMovieTexture();
mat=Ogre::MaterialManager::getSingleton().getByName(materialName);
tex=mat->getTechnique(0)->getPass(0)->getTextureUnitState(0);
tex->setTextureName(dshowMovieTextureSystem->getMovieTexture()->getName());
Code: Select all
if (!Ogre::TextureManager::getSingleton().resourceExists("DirectShowManualTexture")) { ... }
As pointed out by someone earlier the line -
Code: Select all
hr=dsdata->pGraph->RenderFile(filepath, NULL);
Hope my first post to these forums doesn't make me come across as useful as a glass hammer... But I'm out of ideas and\or I'm completely missing something obvious.
Thanks!
Bino
- hmoraldo
- OGRE Expert User
- Posts: 517
- Joined: Tue Mar 07, 2006 11:22 pm
- Location: Buenos Aires, Argentina
- x 1
- Contact:
wynnj: there is nothing to do for video performance as we are playing the videos with the Direct Show player. Keep using the videos that play better or, if you want to advance more, check earlier in this thread as a solution for another codec was discussed, if I remember it well.
Bino: you seem to have two different problems: the texture isn't being created, and maybe you have a problem with render. First try solving the problem with the texture. This could be a problem with some change in the Ogre compatibility when changing versions from Dagon to Eihort, as this code was written for Dagon if I remember well. Maybe some slight change makes it work again in Eihort.
As I didn't receive other comments about this code not working in Eihort, it could be something else too. One thing is that the texture code assignment should be done after loadMovie, not once per frame; but that shouldn't produce that error there. Please check your initialization code is executed always _before_ the "every frame" code (that is: the every frame code shouldn't be executed ever before init).
Hope this helps...
Bino: you seem to have two different problems: the texture isn't being created, and maybe you have a problem with render. First try solving the problem with the texture. This could be a problem with some change in the Ogre compatibility when changing versions from Dagon to Eihort, as this code was written for Dagon if I remember well. Maybe some slight change makes it work again in Eihort.
As I didn't receive other comments about this code not working in Eihort, it could be something else too. One thing is that the texture code assignment should be done after loadMovie, not once per frame; but that shouldn't produce that error there. Please check your initialization code is executed always _before_ the "every frame" code (that is: the every frame code shouldn't be executed ever before init).
Hope this helps...
H. Hernan Moraldo
Personal website
Personal website
-
- Gnoblar
- Posts: 3
- Joined: Sun Sep 23, 2007 4:30 pm
Hi hmoraldo,
I tried a few slight changes but wasn't quite sure where to start. Made a few changes to the Ogre::TextureManager::getSingleton().createManual( in the DirectShowMovieTexture constuctor.
- Specifically added the texture DirectShowManualTexture to the "General" group
- Specified a depth of 1
- Changed usage to Ogre::TU_DYNAMIC_WRITE_ONLY
- Even created the texture from my function and passed that in as a parameter.
No luck. Any other ideas on things to change?
I'm absolutely positive that the initialization code is executed before the "every frame" code. (Pasted below).
It seems like Ogre just seems to "lose" the created DirectShowManualTexture texture. I had Kojack take a look at it and he was equally puzzled. (Kojack is my lecturer at uni).
I did some debugging output to see if the DirectShowManualTexture exists. On the very first call of the "every frame" code, it doesn't exist and then afterwards it does. I even tried just running the "every frame" code when it does (apparently) exist and still no luck.
Any other ideas would be much appreciated but I understand you not wanting to worry about this weird problem
Here's the code. I've tried it with a variety of formats that all work in Windows Media Player. The all exhibit the same problem.
Playground is a simple test level loaded from an oFusion created .osm file.
screenMaterial is a material attached to a cube.
Update is a function that gets called once per frame.
I tried a few slight changes but wasn't quite sure where to start. Made a few changes to the Ogre::TextureManager::getSingleton().createManual( in the DirectShowMovieTexture constuctor.
- Specifically added the texture DirectShowManualTexture to the "General" group
- Specified a depth of 1
- Changed usage to Ogre::TU_DYNAMIC_WRITE_ONLY
- Even created the texture from my function and passed that in as a parameter.
No luck. Any other ideas on things to change?
I'm absolutely positive that the initialization code is executed before the "every frame" code. (Pasted below).
It seems like Ogre just seems to "lose" the created DirectShowManualTexture texture. I had Kojack take a look at it and he was equally puzzled. (Kojack is my lecturer at uni).
I did some debugging output to see if the DirectShowManualTexture exists. On the very first call of the "every frame" code, it doesn't exist and then afterwards it does. I even tried just running the "every frame" code when it does (apparently) exist and still no luck.
Any other ideas would be much appreciated but I understand you not wanting to worry about this weird problem
Here's the code. I've tried it with a variety of formats that all work in Windows Media Player. The all exhibit the same problem.
Playground is a simple test level loaded from an oFusion created .osm file.
screenMaterial is a material attached to a cube.
Update is a function that gets called once per frame.
Code: Select all
#include "PlayGround.h"
#include "conio.h"
#include "ConcaveTrimesh.h"
#include "OIDs.h"
#include "Util.h"
#include "ArenaSceneCallback.h"
#include <EObjectManagerOgre.h>
#include <EObjectOgre.h>
#include "Match.h"
PlayGround::PlayGround(string osmLevelFile, Ogre::SceneManager* pSceneMgr, Ogre::RenderWindow *pRenderWindow, EObjectManagerOgre *m) : Arena(osmLevelFile, pSceneMgr, pRenderWindow, m)
{
tex=0;
dshowMovieTextureSystem = new OgreUtils::DirectShowMovieTexture(800, 600);
Ogre::String movieName="C:/Vid.mpeg";
dshowMovieTextureSystem->loadMovie(movieName);
dshowMovieTextureSystem->playMovie();
}
PlayGround::~PlayGround()
{
if(dshowMovieTextureSystem)
delete dshowMovieTextureSystem;
}
void PlayGround::Update(f32 deltaT)
{
dshowMovieTextureSystem->updateMovieTexture();
Ogre::String materialName="screenMaterial";
mat=Ogre::MaterialManager::getSingleton().getByName(materialName);
tex=mat->getTechnique(0)->getPass(0)->getTextureUnitState(0);
tex->setTextureName(dshowMovieTextureSystem->getMovieTexture()->getName());
}
- hmoraldo
- OGRE Expert User
- Posts: 517
- Joined: Tue Mar 07, 2006 11:22 pm
- Location: Buenos Aires, Argentina
- x 1
- Contact:
Well, a good first test could be to see if you get the same problem with Dagon version of Ogre. If so, we know the video code needs to be ported to Eihort.
Also, the right way to use the code would be:
That is, you only need to set the texture once, and not once per frame.
Best regards,
Also, the right way to use the code would be:
Code: Select all
Ogre::String movieName="C:/Vid.mpeg";
dshowMovieTextureSystem->loadMovie(movieName);
dshowMovieTextureSystem->playMovie();
mat=Ogre::MaterialManager::getSingleton().getByName(materialName);
tex=mat->getTechnique(0)->getPass(0)->getTextureUnitState(0);
tex->setTextureName(dshowMovieTextureSystem->getMovieTexture()->getName());
}
Best regards,
H. Hernan Moraldo
Personal website
Personal website
-
- Kobold
- Posts: 38
- Joined: Wed Nov 01, 2006 8:19 am
- Location: Gothenburg, Sweden
[Update]
It seems this is a bug outside of the video code. When I let Ogre automatically create a window through mRoot->initialise(true, "MainWin"); the bug disappears. It still doesn't render anything while another program is active but it starts rendering again as soon as I click on the Ogre app. That is the expected behaviour I assume.
[/Update]
Hi. first of all thanks to hmoraldo (and other contributors) for the code!
I have a strange bug though. Normally everything works just fine, but if I click on a window of another program before the video starts to play the rendering stops working. The sound still plays, but nothing is rendered on screen. The video normally plays before the player starts the game. I can even start the game and it seems to work ok, except nothing more is rendered on the screen.
It would be interresting for me if anyone could test if you have the same bug.
OBS this error only shows up when using Direct3D, OpenGL works 100%!
It seems this is a bug outside of the video code. When I let Ogre automatically create a window through mRoot->initialise(true, "MainWin"); the bug disappears. It still doesn't render anything while another program is active but it starts rendering again as soon as I click on the Ogre app. That is the expected behaviour I assume.
[/Update]
Hi. first of all thanks to hmoraldo (and other contributors) for the code!
I have a strange bug though. Normally everything works just fine, but if I click on a window of another program before the video starts to play the rendering stops working. The sound still plays, but nothing is rendered on screen. The video normally plays before the player starts the game. I can even start the game and it seems to work ok, except nothing more is rendered on the screen.
It would be interresting for me if anyone could test if you have the same bug.
OBS this error only shows up when using Direct3D, OpenGL works 100%!
-
- Gnoblar
- Posts: 23
- Joined: Mon Sep 24, 2007 8:54 pm
- hmoraldo
- OGRE Expert User
- Posts: 517
- Joined: Tue Mar 07, 2006 11:22 pm
- Location: Buenos Aires, Argentina
- x 1
- Contact:
Sorry for not replying here in a while...
Maybe you can try using a specific codec (ie ogg) that you are sure Nero isn't going to use?
Maybe you can try using a specific codec (ie ogg) that you are sure Nero isn't going to use?
H. Hernan Moraldo
Personal website
Personal website
-
- Gnoblar
- Posts: 23
- Joined: Mon Sep 24, 2007 8:54 pm