vc++8.0 project file and some ideas

fakier

13-09-2008 13:31:58

hi
i would like to ask if its possible to include a visual studio 05 projektfile for me. now i am using a mix of the old theora plugin projekt and the new source.....
and there is a question i am not able to compile the plugin with the new theoro lib, i got the some linking error like you some weeks before.. not sure is it a vc8.0 problem. well i am very interessted in this project. i need some features, that i am going to try to implement. i can imagin a windows direct x "hack" that provides you fast full screen video and i need the possibility to buffer frames before the video starts. it has to run as smooth as possible. good work man, i will to try support your work :)

Kreso

15-09-2008 09:27:28

that would be great :)

if you manage to do something useful, send me a patch. I have written extensive information about the plugin and how the code is organised. you should be able to dive into the code quickly.

fakier

15-09-2008 21:20:23

hi
today i added some lines of code to implement something, i call it "preload".
it means the program loads the frames from the repository before the movie begins. but i dont know if this is synchronised with the sound. well its pretty funny, when the movie starts it runs petty nice, but after a short time it slows down. i dont know why it takes so much calculation time! afer that i implemented a "real" prebuffer, but it used a lot of new and delete... i think this wasnt a good idea, because allocating memory takes a lot of times. i think i will remove it, but "preload" seams to be a nice option.

Kreso

16-09-2008 09:19:38

definetly. precaching same 16-30 frames prior to playback.

you don't have to worry about audio right now as it doesn't work. I'll have to rewrite the audio system from scratch.

fakier

19-09-2008 14:45:18

hi
After updating to the newest theora lib i got a huge speed improvement.
oh, it was note easy to built it under windows.
i implemented full screen with ogre overlay. i wasted a lot of time with directx, because its not possible to lock the backbuffer from direct3d in ogre, because the flag is not set at creation time. i went further with direct draw overlay. but this was definitly the wrong way. i made it work, but its spezific for a system and it was not realy the thing i was looking for. ogre overlay seams to be a good solution. i implemented it outside of Theora, but to keep the ratio of the video i need the dimensions of the viedo. so i added some getter functions...
---edit---
ohh forget about that... i just recognised getVideoDriver()->getHeight()
--
here is a pach...
thats what i would like to have in the new theora.
well, the prefbuf works, but not sure if this is the best solution or even usefull... take a look and let me know your opinon.
to make prebuf work with sound i also need a new pure virtual function insinde the soundsytem.
i know its deprecated, but for now its ok for me. i am yearning for the new soundsystem ;)



Index: TheoraVideoPlugin/include/TheoraAudioDriver.h
===================================================================
--- TheoraVideoPlugin/include/TheoraAudioDriver.h (revision 30)
+++ TheoraVideoPlugin/include/TheoraAudioDriver.h (working copy)
@@ -99,6 +99,13 @@
*/
virtual bool closeAudioStream( ) = 0;

+ /**
+ @remarks
+ Used to reset the Time, if the Videostream uses this thime
+
+ */
+ virtual void resetAudioStreamTime()=0;
+
virtual void autoUpdate() {}

bool open( vorbis_info *vorbisInfo, unsigned int newMilliSeconds = 0 );
Index: TheoraVideoPlugin/include/TheoraVideoClip.h
===================================================================
--- TheoraVideoPlugin/include/TheoraVideoClip.h (revision 30)
+++ TheoraVideoPlugin/include/TheoraVideoClip.h (working copy)
@@ -185,6 +185,8 @@
Mode to change to
*/

+ void setPreBuffering(bool mode){mPrebuffer=mode;};//set prebuffering
+
void setOutputMode(TheoraVideo_OutputMode mode);
TheoraVideo_OutputMode getVideoMoge() { return mOutputMode; }

@@ -255,6 +257,18 @@

/**
@remarks
+ returns movie width
+ */
+ int getMovieWidth();
+
+ /**
+ @remarks
+ return movie heidth
+ */
+ int getMovieHeidth();
+
+ /**
+ @remarks
Gets the movie name
@returns
Returns the string name of this movie
@@ -304,8 +318,10 @@
Returns the time of playing (in seconds)
*/
float getMovieTime();
+
+ bool mPrebuffer;//fill buffer first?
+

-
void initVorbisTheoraLayer( );
void parseVorbisTheoraHeaders( bool useAudio );
void activateVorbisTheoraCodecs( bool useAudio );
Index: TheoraVideoPlugin/src/TheoraVideoClip.cpp
===================================================================
--- TheoraVideoPlugin/src/TheoraVideoClip.cpp (revision 30)
+++ TheoraVideoPlugin/src/TheoraVideoClip.cpp (working copy)
@@ -96,7 +96,8 @@
mSumBlited(0),
mNumFramesEvaluated(0),
mFramesReady(false),
- mOutputMode(TH_RGB)
+ mOutputMode(TH_RGB),
+ mPrebuffer(false)
{
//Ensure all structures get cleared out. Already bit me in the arse ;)
memset( &mOggSyncState, 0, sizeof( ogg_sync_state ) );
@@ -402,7 +403,19 @@
mPlayMode = eMode;
}
}
+ //--------------------------------------------------------------------//
+ int TheoraVideoClip::getMovieWidth()
+ {
+ return mVideoInterface.getWidth();
+ }
+ //--------------------------------------------------------------------//

+ int TheoraVideoClip::getMovieHeidth()
+ {
+
+ return mVideoInterface.getHeight();
+ }
+
//--------------------------------------------------------------------//
void TheoraVideoClip::blitFrameCheck()
{
@@ -594,13 +607,32 @@
mAvgYUVConvertedTime=sumYUV/numFramesEvaluated;


- mFrameMutex.lock();
- if (mFrames.size() == 0) mFramesReady=true;
- mFrames.push(frame);
- mFrameMutex.unlock();
- mVideoFrameReady=false;
- timer.reset();
- continue;
+ if(mPrebuffer){
+ mFrameMutex.lock();
+ if(mFrames.size()==mFrameRepository.size()-1){
+ mPrebuffer=false;//never come back
+ mFramesReady=true; // now go on
+ if( mAudioInterface ){
+ mAudioInterface->resetAudioStreamTime(); //to prevent that our frames will be deleted
+ }
+ delete mTimer; //to prevent that our frames will be deleted
+ mTimer=0;
+ }else{
+ mFrames.push(frame);
+ mVideoFrameReady=false;
+ }
+ mFrameMutex.unlock();
+ continue;
+ }else{
+ mFrameMutex.lock();
+ if (mFrames.size() == 0) mFramesReady=true;
+ mFrames.push(frame);
+ mFrameMutex.unlock();
+ mVideoFrameReady=false;
+ //timer.reset();
+ continue;
+ }
+
}
//Buffer data into Ogg Pages
if( bytesRead > 0 )