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

Author Topic: sfeMovie project [v1.0 RC1 available]  (Read 156974 times)

0 Members and 10 Guests are viewing this topic.

Ceylo

  • Hero Member
  • *****
  • Posts: 2325
    • View Profile
    • http://sfemovie.yalir.org/
    • Email
Re: sfeMovie project [v1.0 RC1 available]
« Reply #210 on: August 19, 2013, 05:45:33 pm »
Want to play movies in your SFML application? Check out sfeMovie!

Ixrec

  • Hero Member
  • *****
  • Posts: 1241
    • View Profile
    • Email
Re: sfeMovie project [v1.0 RC1 available]
« Reply #211 on: October 12, 2013, 09:49:47 am »
I just dl'd and got the vs2010 binaries working with your test code, so first off thanks for making sfeMovie not a pain in the ass to setup (I also tried cmusphinx today and those guys...left out a few steps).

I wanted to ask if these error messages in the console are a problem at all:

As you can see the actual video made it all the way to the end; I didn't see or hear anything with the video itself that implied a problem.

Also, any idea how to get rid of the console entirely?  My VS project isn't a console app.

Edit: The ad-hoc #pragma method for getting rid of it shown here seemed to work, though I'd still like to know how it got in there in the first place.

Plus I hit another snag: Closing the window causes an unhandled exception/access violation.  All the debugger can tell me is that it's happening sometime after main() exits. Never mind, forgot about SFML's longstanding audio crash issues.  I really hope that gets fixed someday. =(
« Last Edit: October 12, 2013, 10:48:59 am by Ixrec »

Ceylo

  • Hero Member
  • *****
  • Posts: 2325
    • View Profile
    • http://sfemovie.yalir.org/
    • Email
Re: sfeMovie project [v1.0 RC1 available]
« Reply #212 on: October 12, 2013, 11:01:19 am »
Hello Ixrec,

Glad you like sfeMovie!

I wanted to ask if these error messages in the console are a problem at all:
I don't know: I often see those too, it depends on the movie I read. So until it works and until you don't get errors printed, I guess it's ok.

Also, any idea how to get rid of the console entirely?  My VS project isn't a console app.
You mean you chose to make a GUI application when creating your project but VS is still showing this console?

Plus I hit another snag: Closing the window causes an unhandled exception/access violation.  All the debugger can tell me is that it's happening sometime after main() exits.
You'd need to check but I guess it is
I use Windows and my program crashes at exit

Check out SFML issue #30.
I wonder if there's any workaround at the moment though.

Want to play movies in your SFML application? Check out sfeMovie!

Ixrec

  • Hero Member
  • *****
  • Posts: 1241
    • View Profile
    • Email
Re: sfeMovie project [v1.0 RC1 available]
« Reply #213 on: October 12, 2013, 11:26:58 am »
I believe I chose an empty project, to be precise.  I'm fairly sure it didn't auto-generate any useless code for me.

I think my only real concern with the library at this point is that I can't statically link to it, which means I'd be going from 2 dlls in my project to 11 (since I can't link SFML statically while using sfeMovie).  Then again your library actually uses multithreading so there may be a legitimate benefit to dynamic linking in this case, in addition to not having to worry about whatever the hell the LGPL actually requires...ugh.
« Last Edit: October 12, 2013, 11:28:40 am by Ixrec »

Ceylo

  • Hero Member
  • *****
  • Posts: 2325
    • View Profile
    • http://sfemovie.yalir.org/
    • Email
Re: sfeMovie project [v1.0 RC1 available]
« Reply #214 on: October 13, 2013, 02:47:34 pm »
I believe I chose an empty project, to be precise.  I'm fairly sure it didn't auto-generate any useless code for me.
Then you should be able to fix this in the project's properties.

I think my only real concern with the library at this point is that I can't statically link to it, which means I'd be going from 2 dlls in my project to 11 (since I can't link SFML statically while using sfeMovie).  Then again your library actually uses multithreading so there may be a legitimate benefit to dynamic linking in this case, in addition to not having to worry about whatever the hell the LGPL actually requires...ugh.
There is a constraint that prevents full static linking but multithreading isn't one. The fact that's you can't statically link against sfeMovie yet is just because I didn't make it possible yet. That's on the todo list though. However, when using VS, you'll always at least have the FFmpeg dlls next to your program, because FFmpeg libraries were not built with VS, and it somehow works when linked dynamically, but not statically (function addresses).

So what is possible but yet "to be done" is linking against static SFML and sfeMovie libraries, but keep FFmpeg dlls.
Want to play movies in your SFML application? Check out sfeMovie!

Ixrec

  • Hero Member
  • *****
  • Posts: 1241
    • View Profile
    • Email
Re: sfeMovie project [v1.0 RC1 available]
« Reply #215 on: October 13, 2013, 02:53:25 pm »
Out of curiosity, is it possible to build ffmpeg from source as a single dll?  Is there any particular reason it's split up like that?

When I mentioned multithreading I didn't mean to say that I thought it made static linking impossible; rather I mean it might give dynamic linking a legitimate benefit (because multiple threads share the code) beyond merely keeping the LGPL happy.  No idea if that's a real issue with real performance implications, but that possibility is what I was referring to.

Ceylo

  • Hero Member
  • *****
  • Posts: 2325
    • View Profile
    • http://sfemovie.yalir.org/
    • Email
Re: sfeMovie project [v1.0 RC1 available]
« Reply #216 on: October 13, 2013, 05:19:06 pm »
FFmpeg does not provide any way to build a single, but it is technically possible yes. However, the FFmpeg license doesn't allow this. And from what I know... it's split up because it's several projects put together for FFmpeg.
Want to play movies in your SFML application? Check out sfeMovie!

Ixrec

  • Hero Member
  • *****
  • Posts: 1241
    • View Profile
    • Email
Re: sfeMovie project [v1.0 RC1 available]
« Reply #217 on: October 14, 2013, 12:09:07 am »
Thanks for clearing that up.

Also, since sfeMovie is also under LGPL, how would static linking work?  Would it require me to put sfeMovie source somewhere in my distribution?  I've read a lot about the LGPL but tl;dr no one seems to have a clue what it actually means, so I kind of have to ask you what you intend it to mean for sfeMovie.

By the way, any reason you used std::cerr instead of sf::err()? (or maybe sfe::err())  I can't figure out a way to redirect std::cerr so I can deal with sfeMovie errors myself, plus it seems a bit inconsistent.

Edit: I think I'm done playing around with this for the time being.  Unfortunately I still get the crash-on-exit bug in any code that constructs an sfe::Movie object, yet not in any of my own code.  I know the bug isn't on your end but I won't be able to integrate this library until there's some kind of solution for that (and preferably the static link option).
« Last Edit: October 14, 2013, 05:07:41 am by Ixrec »

Ceylo

  • Hero Member
  • *****
  • Posts: 2325
    • View Profile
    • http://sfemovie.yalir.org/
    • Email
Re: sfeMovie project [v1.0 RC1 available]
« Reply #218 on: October 18, 2013, 07:42:44 pm »
Hmm.. I forgot to answer, sorry.

Thanks for clearing that up.

Also, since sfeMovie is also under LGPL, how would static linking work?  Would it require me to put sfeMovie source somewhere in my distribution?  I've read a lot about the LGPL but tl;dr no one seems to have a clue what it actually means, so I kind of have to ask you what you intend it to mean for sfeMovie.
This would mean your software is under LGPL too and you have to provide the sources of your program. You have to provide sfeMovie's sources only if you modify them. So depending on whether your project is private/commercial, this can be annoying.

By the way, any reason you used std::cerr instead of sf::err()? (or maybe sfe::err())  I can't figure out a way to redirect std::cerr so I can deal with sfeMovie errors myself, plus it seems a bit inconsistent.
Is "because I didn't think of sf::Err" a valid answer? ;D However, redirecting std::err or sf::Err should be exactly the same thing, because they're both std::ostream objects, or I missed something.

Edit: I think I'm done playing around with this for the time being.  Unfortunately I still get the crash-on-exit bug in any code that constructs an sfe::Movie object, yet not in any of my own code.  I know the bug isn't on your end but I won't be able to integrate this library until there's some kind of solution for that (and preferably the static link option).
Yup I understand, I don't know when that'll be fixed though.
Want to play movies in your SFML application? Check out sfeMovie!

Rodion777

  • Newbie
  • *
  • Posts: 16
    • View Profile
    • Email
Re: sfeMovie project [v1.0 RC1 available]
« Reply #219 on: November 06, 2013, 08:56:02 am »
Hi! I recently dealt with the work of SFML + sfe, but immediately ran into a problem. When I change the video file ("movie.openFromFile(playlist[file_num]") i get  memory leak, maybe I'm doing something wrong ...

*I also tried to allocate memory dynamically, but the operator "delete movie" do not release a memory.



my code:

#include <SFML/Graphics.hpp>
#include <sfeMovie/Movie.hpp>
#include <iostream>
#include <vector>

using namespace std;

int main(int argc, const char *argv[])
{
                vector<string> playlist;
                playlist.push_back("Skorbaks31.12.13_wmv2.avi");
                playlist.push_back("porche_wmw.avi");
                playlist.push_back("exp11_01_p1_wmv2_001.avi");

        // Some settings
        const std::string windowTitle = "sfeMovie Player";
        const int windowWidth = 800;
        const int windowHeight = 600;
        bool fullscreen = false;
        std::string movieFile;
        if (argc < 2)
        {
                std::cout << "Usage: " << std::string(argv[0]) << " movie_path" << std::endl;
                //return 1;
                                movieFile=playlist[0];

        }
                else
                {
                movieFile = std::string(argv[1]);
                }

        std::cout << "Going to open movie file \"" << movieFile << "\"" << std::endl;
       
        // Create window
       // sf::RenderWindow window(sf::VideoMode(windowWidth, windowHeight), windowTitle, sf::Style::Close);
                sf::RenderWindow window(sf::VideoMode::getDesktopMode(), windowTitle, sf::Style::Fullscreen);
        window.setFramerateLimit(60);
        // Create and open movie
                sfe::Movie movie;
        //movie=new sfe::Movie();
        if (!movie.openFromFile(movieFile))
                return 1;
        // Scale movie to the window drawing area and enable VSync
        movie.resizeToFrame(0, 0, window.getSize().x, window.getSize().y);
        window.setVerticalSyncEnabled(true);
                sf::Texture pTexture;
                sf::Font font1;
                font1.loadFromFile("arial.ttf");
                sf::Text text1;
                text1.setFont(font1);
                text1.setStyle(sf::Text::Bold);
                text1.setColor(sf::Color::Green);
                text1.setPosition(300,50);

                sf::Sprite playerImage;
                if (!pTexture.loadFromFile("image.png")) //,sf::IntRect(32,0,32,32))
                cout<<"Error loadd image"<<endl;
                playerImage.setTexture(pTexture);
                float timer1=0;
                sf::Clock cl1;
        // Start movie playback
      //  movie.play();
                int counter=0;
                int file_num=0;
                char *buf=new char(255);
                playerImage.move(500,300);
                movie.play();
        while (window.isOpen())
        {

                        /*
                        timer1 =cl1.getElapsedTime().asMilliseconds();
                        //itoa((int)1000/timer1,buf,10);
                        sprintf(buf, "%f", 1000/timer1);
                        text1.setString(buf);
                        cl1.restart();
                        */

                                                if (movie.getStatus()<2){

                                                //movie.play();
                                                movie.stop();

                                                //delete movie;
                                                //movie=NULL;
                                                //movie=new sfe::Movie();
                                               
                                                text1.setString("OFF");
                                               
                                                        file_num++;
                                                        if (file_num>=playlist.size())
                                                        file_num=0;

                                                        if (movie.openFromFile(playlist[file_num]))
                                                        {
                                                        window.setVerticalSyncEnabled(true);
                                                        movie.resizeToFrame(0, 0, window.getSize().x, window.getSize().y);
                                                        movie.play();
                                                        }
                                                        else
                                                        {
                                                        exit(0);
                                                        }

                                                }
                                                else
                                                {
                                                text1.setString("ON");
                                                }

                sf::Event ev;
                while (window.pollEvent(ev))
                {
                        // Window closure
                        if (ev.type == sf::Event::Closed ||
                                (ev.type == sf::Event::KeyPressed &&
                                 ev.key.code == sf::Keyboard::Escape))
                        {
                                window.close();
                        }
                       
                        // Handle basic controls
                        else if (ev.type == sf::Event::KeyPressed)
                        {
                                // Play/Pause
                                if (ev.key.code == sf::Keyboard::Space)
                                {
                                        if (movie.getStatus() != sfe::Movie::Playing)
                                                movie.play();
                                        else
                                                movie.pause();
                                }
                                // Stop
                                if (ev.key.code == sf::Keyboard::S)
                                        movie.stop();
                               
                                // Restart playback
                                if (ev.key.code == sf::Keyboard::R)
                                {
                                        movie.stop();
                                        movie.play();
                                }
                               
                                // Toggle fullscreen mode
                                if (ev.key.code == sf::Keyboard::F)
                                {
                                        fullscreen = !fullscreen;
                                        // We want to switch to the full screen mode
                                        if (fullscreen)
                                        {
                                                window.create(sf::VideoMode::getDesktopMode(), windowTitle, sf::Style::Fullscreen);
                                                                                                window.setVerticalSyncEnabled(true);
   
                                                movie.resizeToFrame(0, 0, window.getSize().x, window.getSize().y);
                                        }
                                       
                                        // We want to switch back to the windowed mode
                                        else
                                        {
                                                window.create(sf::VideoMode(windowWidth, windowHeight), windowTitle, sf::Style::Close);
                                                window.setVerticalSyncEnabled(true);
                                                movie.resizeToFrame(0, 0, window.getSize().x, window.getSize().y);
                                        }
                                }
                        }
                }
               
                // Render movie
               
                counter++;
                // Render movie
                                if (counter>2){
                                playerImage.rotate(0.2);
                                counter=0;
                                }
                               
                window.clear();
                               
                                window.draw(movie);
                                window.draw(playerImage);
                                window.draw(text1);
                window.display();
        }

        return 0;
}

Ceylo

  • Hero Member
  • *****
  • Posts: 2325
    • View Profile
    • http://sfemovie.yalir.org/
    • Email
Re: sfeMovie project [v1.0 RC1 available]
« Reply #220 on: November 07, 2013, 07:18:02 pm »
Hi Rodion777,

No, you did nothing wrong. After running your program and using a leak detection tool, it showed me that there was indeed a leak (and a big one ;D). I've made a fix and I can no more see the leak now. Please tell me if it's ok on your side too :) The fix is available with the latest sources from the git repo.

Ceylo
« Last Edit: November 07, 2013, 07:20:43 pm by Ceylo »
Want to play movies in your SFML application? Check out sfeMovie!

Rodion777

  • Newbie
  • *
  • Posts: 16
    • View Profile
    • Email
Re: sfeMovie project [v1.0 RC1 available]
« Reply #221 on: November 12, 2013, 04:03:34 pm »
Thx for operativeness! But I don't  have experience with Linux compilers. I tried to build with MinGW for Windows, but I didn't succeed. Please compile the updated library or give step by step manual. Instructions from section "Getting started" was not enough for me.

Ceylo

  • Hero Member
  • *****
  • Posts: 2325
    • View Profile
    • http://sfemovie.yalir.org/
    • Email
Re: sfeMovie project [v1.0 RC1 available]
« Reply #222 on: November 12, 2013, 09:13:51 pm »
Hum yes you're right, building steps changed "a bit" since version 1.0.

Do you need to build sfeMovie for Linux or Windows or both?
Want to play movies in your SFML application? Check out sfeMovie!

Rodion777

  • Newbie
  • *
  • Posts: 16
    • View Profile
    • Email
Re: sfeMovie project [v1.0 RC1 available]
« Reply #223 on: November 13, 2013, 08:12:47 am »
My programm will working on windows, but I would like to know both ways.

Ceylo

  • Hero Member
  • *****
  • Posts: 2325
    • View Profile
    • http://sfemovie.yalir.org/
    • Email
Re: sfeMovie project [v1.0 RC1 available]
« Reply #224 on: November 13, 2013, 11:46:04 pm »
I don't know if you're familiar with CMake tools but except with Windows, the build steps are quiet usual:

On Linux, choose your settings with the CMake GUI then run make and sudo make install.
On Windows, make sure you have a full MinGW+MSYS installation, then use the CMake GUI, then build sfeMovie within your IDE.

There are some important configuration choices during the CMake step:
- CMAKE_BUILD_TYPE, either Release or Debug, and the build mode in your Windows IDE need to match this setting
- LINK_AGAINST_INTERNAL_FFMPEG, to choose whether you want to provide your own FFmpeg binaries (FALSE) or let the sfeMovie build process also build FFmpeg (TRUE)
- ENABLED_DECODERS, in case LINK_AGAINST_INTERNAL_FFMPEG=TRUE, this defines the video/audio codecs that will be supported by the final sfeMovie build.
- SFML_ROOT, set to the directory containing SFML include et lib directories
- MINGW_DIR, on Windows, is the path of the directory of your MinGW (also containing MSYS) installation
Want to play movies in your SFML application? Check out sfeMovie!