~ubuntu-branches/ubuntu/natty/ultrastar-ng/natty

« back to all changes in this revision

Viewing changes to src/video.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Miriam Ruiz, Miriam Ruiz, Mario Bonino, Jon Dowland, Ansgar Burchardt
  • Date: 2008-06-07 16:43:18 UTC
  • mfrom: (4.1.1 lenny)
  • Revision ID: james.westby@ubuntu.com-20080607164318-4cnzizck1tp8mrwp
Tags: 0.2.1-1
[ Miriam Ruiz ]
* New Upstream Release (Closes: #453132)
* Removed unneeded patches
* Added packages to build deps:
  + libtool
  + portaudio19-dev | portaudio-dev
  + libboost-dev, libboost-thread-dev, libboost-serialization-dev
  + libboost-program-options-dev, libboost-regex-dev
* Moved shared objects to private directory: /usr/lib/ultraster-ng
* Added rpath to binaries to search for shared objects in the private dir
* Uses ultrastar-ng-gstreamer as default, instead of ultrastar-ng-xine,
  since there are significantly less issues with GStreamer.
* Added patch to fix upstream desktop file
* Added -Wl,-as-needed to LDFLAGS
* Replaced fftw3-dev by libfftw3-dev in build dependencies.
* Standards-Version upgraded to 3.7.3

[ Mario Bonino ]
* Fixed data/Makefile.am to install .desktop file and icon

[ Jon Dowland ]
* add Homepage: control field to source stanza
* fix a bashism in debian/rules (Closes: #478634)

[ Ansgar Burchardt ]
* debian/control: Change XS-Vcs-* to Vcs-*
* Remove Homepage semi-field from description

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
#include <video.h>
2
2
 
3
 
CVideo::CVideo()
4
 
{
 
3
CVideo::CVideo() {
5
4
#ifdef USE_SMPEG
6
5
        mpeg=NULL;
7
6
#endif
8
7
}
9
8
 
10
 
CVideo::~CVideo()
11
 
{
12
 
#ifdef USE_SMPEG
13
 
        if(mpeg != NULL)
14
 
                unloadVideo();
15
 
#endif
 
9
CVideo::~CVideo() {
 
10
        unloadVideo();
16
11
}
17
12
 
18
 
bool CVideo::isPlaying()
19
 
{
 
13
bool CVideo::isPlaying() {
20
14
#ifdef USE_SMPEG
21
 
        if(mpeg != NULL)
22
 
                return (SMPEG_status(mpeg) == SMPEG_PLAYING);
23
 
        else
24
 
                return false;
 
15
        if (mpeg) return (SMPEG_status(mpeg) == SMPEG_PLAYING);
25
16
#endif
26
17
        return false;
27
18
}
28
19
 
29
 
void CVideo::play(void)
30
 
{
 
20
void CVideo::play() {
31
21
#ifdef USE_SMPEG
32
 
        if(mpeg != NULL)
33
 
                SMPEG_play(mpeg);
 
22
        if (mpeg) SMPEG_play(mpeg);
34
23
#endif
35
24
}
36
25
 
37
 
void CVideo::unloadVideo( void )
38
 
{
 
26
void CVideo::unloadVideo() {
39
27
#ifdef USE_SMPEG
40
 
        if( mpeg != NULL ) {
 
28
        if (mpeg) {
41
29
                SMPEG_delete(mpeg);
42
30
                mpeg=NULL;
43
31
        }
44
32
#endif
45
33
}
46
34
 
47
 
void CVideo::loadVideo( char * _videoFile, SDL_Surface * _videoSurf, int _width , int _height )
48
 
{
 
35
bool CVideo::loadVideo(std::string const& _videoFile, SDL_Surface* _videoSurf, int _width , int _height) {
49
36
#ifdef USE_SMPEG
50
37
        unloadVideo();
51
 
        mpeg = SMPEG_new(_videoFile, &info, 0);
52
 
        if( SMPEG_error( mpeg ) ) {
53
 
                fprintf( stderr, "SMPEG error: %s\n", SMPEG_error( mpeg ) );
54
 
                SMPEG_delete( mpeg );
 
38
        mpeg = SMPEG_new(_videoFile.c_str(), &info, 0);
 
39
        if(SMPEG_error(mpeg)) {
 
40
                fprintf(stderr, "SMPEG error: %s\n", SMPEG_error(mpeg));
 
41
                SMPEG_delete(mpeg);
55
42
                mpeg = NULL;
 
43
                return false;
56
44
        } else {
57
45
                SMPEG_setdisplay(mpeg, _videoSurf, NULL, NULL);
58
46
                SMPEG_enablevideo(mpeg, 1);
59
47
                SMPEG_enableaudio(mpeg, 0);
60
48
                SMPEG_setvolume(mpeg, 0);
61
 
                SMPEG_scaleXY(mpeg, _width , _height );
 
49
                SMPEG_scaleXY(mpeg, _width , _height);
 
50
                return true;
62
51
        }
63
52
#else
64
53
        fprintf(stdout,"Video file was found, but Ultrastar-ng was compile without video support\n");
 
54
        return false;
65
55
#endif
66
56
}