0.8 ffmpeg videoplayer with threaded sound (openAL) in synch

Post those lines of code you feel like sharing or find what you require for your project here; or simply use them as tutorials.
PauloPina
Posts: 8
Joined: Wed Apr 28, 2010 3:34 am

Post by PauloPina »

Guys,

Evan changing the memcpy for a loop the image is messed...

Code: Select all

    for (int i = 0; i < width*height; i++) 
		_p[i] = _pimage[i]; 

For now, the only way the image is OK here is creating the texture every frame...
PauloPina
Posts: 8
Joined: Wed Apr 28, 2010 3:34 am

Post by PauloPina »

Correct post bellow...
Last edited by PauloPina on Fri Apr 30, 2010 6:15 am, edited 1 time in total.
PauloPina
Posts: 8
Joined: Wed Apr 28, 2010 3:34 am

Post by PauloPina »

Guys,

I Have found my problem...

When I have tried the Thespecial sample in first page of this topic, with

Code: Select all

videoPlayer = new murmuurVIDEO(irrVideo, device->getTimer(), 1024, 768, videoOutput);
I have found this problem in sws_scale():
Unhandled exception at 0x066d6570 in FFMpeg2.exe: 0xC0000005: Access violation.
Every time I tried to create the murmuurVIDEO with bigger desiredW and desiredH than my original video height and width, this error happens...

So I have changed the creation call to:

Code: Select all

videoPlayer = new murmuurVIDEO(irrVideo, device->getTimer(), 350, 240, videoOutput);
The program runs, but the image is all messed... Why?

I have found the answer ...

when I look for my IImage pitch with _imCurrentImage->getPitch(), I've found 1400 bytes per line, that is 361 pixels per line multiply by 4 bytes per pixel.

But...

when I look for my ITexture pitch with _txCurrentTexture->getPitch(), I've found 2048 bytes per line, that is 512 pixels per line multiply by 4 bytes per pixel.

So, appear that the driver is free to add padding at the end of each scanline, and this is frequently done with non-power-of-2 textures. In this case, the driver seems to be padding each scanline to a multiple of 32 pixels.

Just to confirm, I have changed that values to 256x128 that are power-of-2 numbers...:

Code: Select all

videoPlayer = new murmuurVIDEO(irrVideo, device->getTimer(), 256, 128, videoOutput);
So, my messed image problem has disappeared and now my video is shown correctly...

Apologize me for my ignorance and for change this values...

But I'm still with 2 problems:

1- sws_scale() only works if my Video size is bigger than the "new murmuurVIDEO" size values. If width or height of the video is smaller than the width / height values supplied during criation, the program drops Access Violation.

2- The video still playing slowly... Appear that some frames are droped... The audio works perfecly, but the video is not smooth...

One more time, Apologize me for the prior problem... but I will be happy if anyone can help me with those 2 other problems...
thespecial1
Posts: 135
Joined: Thu Oct 30, 2008 11:56 am
Location: UK
Contact:

Post by thespecial1 »

Hyy randomMesh
randomMesh wrote:
PauloPina wrote:Using memcpy the picture is aways messed...
Maybe sizeof(irr::s32) is not 4 on your system. It would be best to replace all occurrences of irr::s32 by uint32_t anyway.
is this the only type that should be replaced me wonders???
tnx
rrrrrrrrrr

Hyy paulo,
PauloPina wrote: 1- sws_scale() only works if my Video size is bigger than the "new murmuurVIDEO" size values. If width or height of the video is smaller than the width / height values supplied during criation, the program drops Access Violation.
hmm, i dont see this one, dont get a crash whichever size i set the output to
PauloPina wrote: 2- The video still playing slowly... Appear that some frames are droped... The audio works perfecly, but the video is not smooth...

One more time, Apologize me for the prior problem... but I will be happy if anyone can help me with those 2 other problems...
this is the original problem, i have solved this partially by setting

Code: Select all

videoPlayer->setVideoSpeed(900);
after the class has been initialised, this is abit of a hack solution however 1000 is normal speed, sub 1000 is faster. My thoughts are that this class does have a timing problem todo with video only, am currently building a shader effects library so this isn't my priority project but i will see if i can come up with a better solution.

thanks
Rob
PS i havnt added you on MSN as i dont use chat ;0)
nile997
Posts: 1
Joined: Mon May 11, 2009 3:36 am

Post by nile997 »

Hi thespecial1.
I tried to play a movie loop like this:

Code: Select all


        if (videoPlayer->psVideostate == Playing) {  // play active 
           if (!videoPlayer->refresh()) {  // no more AV 

			   videoPlayer->goToFrame(0);
/*
              if (videoPlayer->bVideoLoaded) { 
                           videoPlayer->close(); 
                           delete videoPlayer; 
                           videoPlayer = new murmuurVIDEO( device->getVideoDriver(), device->getTimer(), VideoWidth, VideoHeight); 
						   videoPlayer->open("..\\..\\movie\\1.avi",0);
                        } 
*/
           } else {  // still playing so draw the next frame 
              videoPlayer->drawVideoTexture(); 
           }                         
        }

and then i found the process memory getting bigger.
Ummm...the class needs some memory clean up work ?
sorry for my English
Post Reply