Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: sfTheora 1.4 - Play videos in SFML  (Read 69654 times)

0 Members and 2 Guests are viewing this topic.

roosterkin123

  • Newbie
  • *
  • Posts: 43
    • MSN Messenger - rogerboy@hotmail.co.uk
    • View Profile
SFMLTheora 1.3 - Play videos in SFML
« Reply #15 on: April 14, 2011, 04:48:40 pm »
viddy->Stop does not exist?

zorexx

  • Full Member
  • ***
  • Posts: 109
    • View Profile
    • zorexx@site
SFMLTheora 1.3 - Play videos in SFML
« Reply #16 on: April 14, 2011, 05:02:00 pm »
It does.

Did you replace all the SFMLTheora files with the 1.2.1 version?

Maybe you left out something? (Maybe this is the cause of the heap corruption?)

roosterkin123

  • Newbie
  • *
  • Posts: 43
    • MSN Messenger - rogerboy@hotmail.co.uk
    • View Profile
SFMLTheora 1.3 - Play videos in SFML
« Reply #17 on: April 14, 2011, 07:19:45 pm »
Ah yes your exactly right. I somehow messed up the folder. Deleted everything and used 1.2.1 and it doesnt cause any heap errors.

However now there seems to be some weird audio skipping. It kind of stutters.
Although when I restart pc it works first time perfect and the second time starts stuttering.

Do I need to call release or something?

zorexx

  • Full Member
  • ***
  • Posts: 109
    • View Profile
    • zorexx@site
SFMLTheora 1.3 - Play videos in SFML
« Reply #18 on: April 15, 2011, 04:54:53 am »
You shouldn't need to.

Is the audio still in sync? Or does it goes out of sync?

Are you using the same code you posted earlier?
Does the example code works properly? If it does try replacing the bunny.ogg with your own video. Else try using the normal new delete method or SFMLTheora::Video without dynamic memory allocation.

roosterkin123

  • Newbie
  • *
  • Posts: 43
    • MSN Messenger - rogerboy@hotmail.co.uk
    • View Profile
SFMLTheora 1.3 - Play videos in SFML
« Reply #19 on: April 15, 2011, 10:29:42 am »
Code: [Select]
bool PlayVideo(std::string name)
{
auto viddy = std::make_shared<SFMLTheora::Video>();
if(!viddy)return false;
viddy->LoadClip(name);
//viddy->SetX(0);
//viddy->SetY(0);
GLRenderer::GetInstance()->GetMainWindow()->EnableVerticalSync(true);

bool result = true;
bool stopvideo = false;

while(!viddy->IsDone())
{
sf::Event sfEvent;
while(GLRenderer::GetInstance()->GetMainWindow()->PollEvent(sfEvent))
{
 if(sfEvent.Type == sf::Event::Closed){result = false; stopvideo = true; break;}

 if((sfEvent.Type == sf::Event::KeyPressed) && (sfEvent.Key.Code == sf::Key::Escape))
 {
 viddy->Stop();
 //viddy->SetAudioGain(0.0f);
 result = true;
 stopvideo = true;
 break;
 }

 if ((sfEvent.Type == sf::Event::KeyPressed) && (sfEvent.Key.Code == sf::Key::F12))Screenshot();
}

if(stopvideo)break;

viddy->Resize(IniOptions::GetInstance()->window_width, IniOptions::GetInstance()->window_height);
viddy->Update(GLRenderer::GetInstance()->GetMainWindow()->GetFrameTime());
GLRenderer::GetInstance()->GetMainWindow()->Clear();
GLRenderer::GetInstance()->GetMainWindow()->Draw(*viddy);
GLRenderer::GetInstance()->GetMainWindow()->Display();
}

if(IniOptions::GetInstance()->vsync)GLRenderer::GetInstance()->GetMainWindow()->EnableVerticalSync(true);
else GLRenderer::GetInstance()->GetMainWindow()->EnableVerticalSync(false);

return result;
}


That is my code. Can you please test the library with sfml2. A lot of people use sfml2 and I hope this library will provide support for both sfml1 and sfml2.

I tried other video files and it still stutters. You can barely hear the audio just click click cluck click. I tried without dynamic memory and it still behaves the same

WitchD0ctor

  • Full Member
  • ***
  • Posts: 100
    • View Profile
    • http://www.teleforce-blogspot.com
SFMLTheora 1.3 - Play videos in SFML
« Reply #20 on: April 15, 2011, 10:52:16 am »
I think i had the same problem as you when i tried using the sfml audio module to provide sound, if you use the standard openAL that the theora playback lib comes with it will avoid that problem, but you wont be able to hear any other music/sounds that use sfml's stuff,
to fix it you just have to look in the openAL sound factory that it libtheora playback comes with and remove an openal init call.

Hope this helps
John Carmack can Divide by zer0.

roosterkin123

  • Newbie
  • *
  • Posts: 43
    • MSN Messenger - rogerboy@hotmail.co.uk
    • View Profile
SFMLTheora 1.3 - Play videos in SFML
« Reply #21 on: April 15, 2011, 11:27:59 am »
Hey can you please elaborate on that? I cant find that openal init code.

zorexx

  • Full Member
  • ***
  • Posts: 109
    • View Profile
    • zorexx@site
SFMLTheora 1.3 - Play videos in SFML
« Reply #22 on: April 15, 2011, 06:23:51 pm »
Hi, I just tried it with sfml2. Here's my results:
1st test: Yes, there's problem with the audio.
Then I went out, and when I came back and ran it again:
2nd test: No problem at all.
Ran it again:
3rd test: The problem came back.
4th test: The problem is gone.
5th test: No problem.
Made some changes to the code, tested for another 5 times (the same code), no problem.

I've just uploaded the latest code, version 1.2.2, try that, it may or may not solve the problem, either way, please let me know the results. :)

roosterkin123

  • Newbie
  • *
  • Posts: 43
    • MSN Messenger - rogerboy@hotmail.co.uk
    • View Profile
SFMLTheora 1.3 - Play videos in SFML
« Reply #23 on: April 15, 2011, 07:25:35 pm »
Nope it still stutters for me with the latest update :(

zorexx

  • Full Member
  • ***
  • Posts: 109
    • View Profile
    • zorexx@site
SFMLTheora 1.3 - Play videos in SFML
« Reply #24 on: April 15, 2011, 07:46:47 pm »
That's odd, I tried running it again:
1st test: Problem occurs.
2nd test: No problem.
3rd test: No problem.

As you can see, it is occurring rather randomly for me, does it happen every time you run yours? Or once in a while like mine?

roosterkin123

  • Newbie
  • *
  • Posts: 43
    • MSN Messenger - rogerboy@hotmail.co.uk
    • View Profile
SFMLTheora 1.3 - Play videos in SFML
« Reply #25 on: April 15, 2011, 08:09:31 pm »
Every time, unless I restart computer in that case it runs fine one time.
Have you tried other videos?

WitchD0ctor

  • Full Member
  • ***
  • Posts: 100
    • View Profile
    • http://www.teleforce-blogspot.com
SFMLTheora 1.3 - Play videos in SFML
« Reply #26 on: April 15, 2011, 08:24:26 pm »
in OpenAL_AudioInterface.cpp

you'll find this line,

Code: [Select]
gDevice = alcOpenDevice("");


comment this out
John Carmack can Divide by zer0.

roosterkin123

  • Newbie
  • *
  • Posts: 43
    • MSN Messenger - rogerboy@hotmail.co.uk
    • View Profile
SFMLTheora 1.3 - Play videos in SFML
« Reply #27 on: April 15, 2011, 09:58:00 pm »
I found that file in the demos folder? I dont think its even part of the library.
Anyway I tried it and it did not fix anything sadly.

Its weird because sfmlTheora 1.0 worked perfect with sfml2.
So either something went wrong with sfmlTheora or sfml2.

I am using same folder for libtheora and theoraplayer as I did with 1.0

zorexx

  • Full Member
  • ***
  • Posts: 109
    • View Profile
    • zorexx@site
SFMLTheora 1.3 - Play videos in SFML
« Reply #28 on: April 16, 2011, 06:47:41 am »
Hmm, I suspect it has something to do with the syncing, so I went and check, well, it does go out of sync for a while (bout a second or less) when you seek, so I thought maybe it has something to do with that.

I fixed that and uploaded it as 1.2.3, tested it with 2 videos and there's no audio stuttering, however, when I tried testing it with 1.2.2, there's also no audio stuttering, it really occurs very randomly for me. Please try downloading 1.2.3 and see if it still occurs.

One more thing, try replacing the openal32.dll and libsndfile-1.dll with the new one (In the SFMLTheora 1.2.3 folder or the sfml2 extlibs folder). I forgotten to replace them when I switched over to sfml2, since the 2 dlls changed since sfml 1.6 (there's a big difference in file size).

roosterkin123

  • Newbie
  • *
  • Posts: 43
    • MSN Messenger - rogerboy@hotmail.co.uk
    • View Profile
SFMLTheora 1.3 - Play videos in SFML
« Reply #29 on: April 16, 2011, 11:22:08 am »
Hmm well it still stutters. But you know whats weird. Your sample application also stutters. I am begging to think this must be an audio driver issue so I cleaned out my drivers and reinstalled hoping it would fix it. But nope.

I dunno what else to try. The ogg files play fine with a video player just not with your library :(